Download presentation
Presentation is loading. Please wait.
1
JExample Extending JUnit with explicit dependencies Bachelor Project Lea Hänsenberger
2
Overview which were the goals of the project how were the goals achieved case study lessons learned
3
Goals Problem of conventional tests: defect localization Failing setUp method Multiple test methods use same method of unit under test
4
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
5
Goals Implementation: define dependencies between testmethods (also between testmethods of different classes) define testmethods that have a return value define testmethods that take arguments @Test @Depends(“aTestMethod“) public String stringTest(String aString){ … return aString; }
6
How are the goals achieved? Dependencies between test methods: @Depends annotation @Depends(“testAdd“) @Depends(“testAdd(java.lang.String)“) @Depends(“ClassTest.testAdd“)
7
How are the goals achieved? Methods can have return values: validation of test methods adapted @Test public String aTest(){ … return aString; }
8
How are the goals achieved? Methods can take arguments: JUnit JExample has constraints for arguments: number of arguments. types of the arguments. cloning return values @Test public String aTest(){ … return aString; } @Test @Depends(“aTest“) public void anotherTest (String clonedString){ … }
9
UML
10
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
11
Case Study Results: defect localization: failing methods between 3% and 6% (original from 17% to 66%) Up to 14 test methods ignored
12
Lessons learned Schedule Reading and understanding someone else’s code Do it -> do it right -> do it fast Writing a paper
13
Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.