Title: Towards%20Model-Driven%20Unit%20Testing%20Gregor%20Engels%20Baris%20G
1TowardsModel-Driven Unit TestingGregor
EngelsBaris GüldaliMarc Lohmann02. October
20063rd Workshop on Model design and Validation
_at_ MoDELS 2006
2Unit Testing
Model-driven Unit Testing
1
Models
3
2
generate
generate
4
Test Case Input
Expected Output
Test Oracle
Test Case Input
Actual Result
Test Cases
Operation
Comparator
Pass/No Pass
3Development Process
4UML Class Diagrams Visual Contracts
5Model-driven Unit Testing
?
1
Models
3
2
generate
generate
4
Test Case Input
Expected Output
Test Oracle
Operation under Test
Test Case Input
Actual Result
Test Cases
Comparator
Pass/No Pass
6Test Oracle
Designer
created by
Test driver
SUT
check pre-condition
created by
else
throw pre-condition exception
pre-condition holds
system state sk1
execute originaloperation with call parameters
system state sk
implemented by
call operation under test
Programmer
Pass
check post-condition
return
else
throw post-condition exception
exception
post-condition holds
No Pass
return normally
7Model-driven Unit Testing
- Which test cases are adequate for testing a
system wrt. a testing criterion? - How can a SUT be set to a state where the test
cases can be executed?
?
1
Models
?
3
2
generate
generate
4
Test Case Input
Expected Output
Test Oracle
Operation under Test
Test Case Input
Actual Result
Test Cases
Comparator
Pass/No Pass
8Test Case Generation
- Test case inputs call parameters system state
- Generation of call parameters
- P cidabc, prNodef, num1
- Generation of system state
Well-known test case generation techniques or
random generation
sinput
9Setting System State
10Setting System State
- Generation of system setting sequence
s0
cartCreate
s1
s2
st
su
operationn
Model checking techniques for computation of
the system setting sequence cartCreate, ,
operationn
sv
sv ? sinput
11Model-driven Unit Testing
?
1
Models
?
?
3
2
generate
generate
4
Test Case Input
Expected Output
Test Oracle
Operation under Test
Test Case Input
Actual Result
Test Cases
Comparator
Pass/No Pass
12Development Process Testing
VC Workbench
JML
JML Compiler
JMLUnit
13Conclusion
- To do
- Discussions on MoDeVa and other platforms
- Applying on a bigger case study
- Further reasearch with the aim of a dissertation
- Visual contracts for behavioral specification
- Generation of
- Test oracles
- Test cases
- Development Process and existing tools
- Editor for visual contracts
- Model checking tool
- Test driver
14Thank you for your attention!Any questions?
15Contact
- Software Quality Lab
- University of Paderborn
- Warburger Str. 100
- 33098 Paderborn
- Germany
- http//s-lab.upb.de
- Baris Güldali
- baris_at_s-lab.upb.de
-
- Telefon 49 5251-60 53 91
- Fax 49 5251-60 34 31