I tried to obtain the sequence of statements run by junit test case, but I do not find any solution. This problem apparently is related to the code coverage, but I think the code coverage tools do not find the sequence of statements run for the test case.
For example:
1. abs(x){
2. if x is not a number
3. return null
4. if x > 0
5. return x
6. else
7. return -x
8. }
1. TestAbs{
2. @Test 1
3. assert(abs(1), 1)
4.
5. @Test 2
6. assert(abs(-1), 1)
7. }
With coverage tools (emma, JMockit and so on):
- Test 1:
- Line coverage: 3/5
- Path coverage: 1/3
- Branch coverage: 2/4
- Test 2:
- Line coverage: 3/5
- Path coverage: 1/3
- Branch coverage: 2/4
- TestAbs:
- Line coverage: 4/5
- Path coverage: 2/3
- Branch coverage: 3/4
My ideal output: (the sequence of statements run by each test/function call)
- Test 1: 1->2->4->5->End
- Test 2: 1->2->4->7->End
Is there any solution to obtain the sequence of statements (or sequence of bytecode statements) run by a function/junit test case in java?
Thanks
Aucun commentaire:
Enregistrer un commentaire