JExample Extending JUnit with explicit dependencies Bachelor Project Lea Hänsenberger
Overview which were the goals of the project how were the goals achieved case study lessons learned
Goals Problem of conventional tests: defect localization Failing setUp method Multiple test methods use same method of unit under test
Goals Solution: explicit dependencies Set up of the test fixture in a test method methods used to extend the fixture are called in one test method Test methods ignored if dependency failed
Goals Implementation: define dependencies between testmethods (also between testmethods of different classes) define testmethods that have a return value define testmethods that public String stringTest(String aString){ … return aString; }
How are the goals achieved? Dependencies between test
How are the goals achieved? Methods can have return values: validation of test methods public String aTest(){ … return aString; }
How are the goals achieved? Methods can take arguments: JUnit JExample has constraints for arguments: number of arguments. types of the arguments. cloning return public String aTest(){ … return public void anotherTest (String clonedString){ … }
UML
Case Study Unit under test: Ullman subgraph isomorphism algorithm algorithm to compare graphs core of a research tool for frequent subgraph mining in bioinformatics Tests implemented as JExample tests Criteria: defect localization test-suite run time performance test size code duplication
Case Study Results: defect localization: failing methods between 3% and 6% (original from 17% to 66%) Up to 14 test methods ignored
Lessons learned Schedule Reading and understanding someone else’s code Do it -> do it right -> do it fast Writing a paper
Questions?