recheck und der stein der weisen - entwicklertag.de · founded 2017 ~ 15 employee karlsruhe open...

Post on 22-Jul-2020

6 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

recheckrecheck und der Stein der Weisen und der Stein der Weisen

Aus Selenium wird AdamantiumAus Selenium wird Adamantium

Martin VietzMartin Vietz

httpshttps://://retest.de/retest.de/

Martin VietzMartin Vietz

Software Developer since 2005

Focus on software development infrastructure

CTO & CoFounder of ReTest GmbH

reretesttest GmbH GmbH

founded 2017

~ 15 employee

Karlsruhe

Open Source & AI supporter

Some questionsSome questions

to the audience

Who is testing the GUI in general?

Who is testing the GUI automatically?

Who is testing more than a few (happy path) cases?

Who is happy with the current state?

Let's fix this!Let's fix this!

DemoDemo

MySeleniumTest.java

How does it work?How does it work?

Let's start at the basicsLet's start at the basics

automated tests

=

tests

automated tests

≠tests

testentesten

... Ziel des Prozesses ist sicherzustellen, dass diese allen

festgelegten Anforderungen genügen, dass sie ihren Zweck

erfüllen, und etwaige Fehlerzustände zu finden.

Q: http://glossar.german-testing-board.info

automated tests

≠tests

In which case we find changes withIn which case we find changes with

tests?tests?

In which case we find changes withIn which case we find changes with

tests?tests?

Only if something changes!Only if something changes!

In other words we track changes!

We have a name for it...

automated testsautomated tests

==

version controlversion control

The question that version control typically answers is:

The question that version control typically answers is:

Where has the Where has the CodeCode changed? changed?

⇒⇒

Where has the     Code      changed?

Where has the Software changed?

Closing the gap withClosing the gap with

automated tests

automated testsautomated tests

==

version controlversion control

Example

class ElementRemover

<?xml version="1.0" encoding="UTF-8" ?><root> <parent> <remove>should be removed</remove> <keep>should not be removed</keep> </parent></root>

<?xml version="1.0" encoding="UTF-8" ?><root> <parent> <keep>should not be removed</keep> </parent></root>

@Testpublic void extended_xml_should_be_removed_correctly() { // Prepare state String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" // + "<root>\n" // + "\t<parent>\n" // + "\t\t<remove>should be removed</remove>\n" // + "\t\t<keep>should not be removed</keep>\n" // + "\t</parent>\n" // + "</root>"; ElementRemover remover = new ElementRemover( "parent", "remove" ); // Execute feature under test InputStream transformed = remover.transform( new ByteArrayInputStream( xml.g // Assert result final String result = IOUtils.toString( transformed, "UTF-8" ); Assert.assertFalse( result.contains( "remove" ) ); Assert.assertTrue( result.contains( "keep" ) ); }

<?xml version="1.0" encoding="UTF-8" ?><root> <parent> <remove>should be removed</remove> <keep>should not be removed</keep> </parent></root>

<?xml keep</keep> </parent> </root>

=> pass

<?xml version="1.0" encoding="UTF-8" ?><root> <parent> <remove>should be removed</remove> <keep>should not be removed</keep> </parent></root>

<?xml keep</keep> </parent> </root>

<?xml version="1.0" encoding="UTF-8" ?><root> <parent> <remove>should be removed</remove> <keep>should not be removed</keep> </parent></root>

<?xml version="1.0" encoding="UTF-8" ?><root> <parent> <keep>should not be removed</keep> </parent></root>

Golden MasterGolden Master

Golden Master TestingGolden Master Testing

Golden Master Unit TestingGolden Master Unit Testing

Golden Master Unit TestingGolden Master Unit Testing

@Testpublic void extended_xml_should_be_removed_correctly_Using_Approvals() { // Prepare state final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" // + "<root>\n" // + "\t<parent>\n" // + "\t\t<remove>should be removed</remove>\n" // + "\t\t<keep>should not be removed</keep>\n" // + "\t</parent>\n" // + "</root>"; ElementRemover remover = new ElementRemover( "parent", "remove" ); // Execute feature under test InputStream transformed = remover.transform( new ByteArrayInputStream( xml.g // Assert result ApprovalsUtil.verifyXml( IOUtils.toString( transformed, "UTF-8" ) ); }

<?xml version="1.0" encoding="UTF-8" ?><root> <parent> <remove>should be removed</remove> <keep>should not be removed</keep> </parent></root>

<?xml version="1.0" encoding="UTF-8" ?><root> <parent> <keep>should not be removed</keep> </parent></root>

complete check?!complete check?!

Ideal amount of checks?

Ideal amount of checks

Ideal amount of checks

DemoDemo

GoogleTest.java

# Ignore file for recheck. # Ignore elements by attribute: matcher: id=banner # Ignore attributes globally: attribute=class # Ignore attributes with regex: attribute-regex=.* # combined: matcher: id=div-b4f23, attribute-regex: font.* ...

DemoDemo

recheck.ignore

ignore ≈ filter

DemoDemo

BudgetTest.java

But why Adamantium Version?But why Adamantium Version?

org.openqa.selenium.NoSuchElementException: no such element: Unable to locate element: {"method":"css selector","selector":".btn\-pri

Back to login demoBack to login demo

How it works?How it works?

Lookup in golden masterLookup in golden master

MultilocatorsMultilocators

1 on 1 assignments1 on 1 assignments

DemoDemo

MyUnbreakableSeleniumTest.java

What happens when the goldenWhat happens when the golden

master is updated?master is updated?

What happens when the goldenWhat happens when the golden

master is updated?master is updated?

It is not possible to find the old id anymore!

Stable IdsStable Ids

retestIdretestId

reference to identity

Auto healingAuto healing

DemoDemo

MyUnbreakableSeleniumTest.java

recaprecap

recheck benefitsrecheck benefits

whitelist testing

recheck benefitsrecheck benefits

whitelist testing

rule-based deterministic ignoring

recheck benefitsrecheck benefits

whitelist testing

rule-based deterministic ignoring

unbreakable selenium / test healing

recheck benefitsrecheck benefits

whitelist testing

rule-based deterministic ignoring

unbreakable selenium / test healing

usable open source version

recheck benefitsrecheck benefits

whitelist testing

rule-based deterministic ignoring

unbreakable selenium / test healing

usable open source version

offline usage possible

recheck benefitsrecheck benefits

whitelist testing

rule-based deterministic ignoring

unbreakable selenium / test healing

usable open source version

offline usage possible

works conceptional for any technical interface

Thank you for your attention!Thank you for your attention!

Questions?Questions?

More Infos: More Infos:

We love Feedback:

https://retest.de/https://retest.de/

http://feedback.retest.de/

top related