150 likes | 260 Views
Towards Model-Driven Unit Testing Gregor Engels Baris Güldali Marc Lohmann 02. October 2006 3rd Workshop on Model design and Validation @ MoDELS 2006. Unit Testing. Model-driven Unit Testing. 1. Models. 3. 2. generate. generate. 4. Test Case Input. Expected Output. Test Oracle.
E N D
TowardsModel-Driven Unit TestingGregor EngelsBaris GüldaliMarc Lohmann02. October 20063rd Workshop on Model design and Validation @ MoDELS 2006
Unit 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
Model-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
Test Oracle Designer created by Test driver SUT check pre-condition created by [else] throw pre-condition exception [pre-condition holds] … system state sk+1 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
Model-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
Test Case Generation Test case inputs: call parameters + system state • Generation of call parameters P = {cid=„abc“, prNo=„def“, num=1} • Generation of system state Well-known test case generation techniques or random generation sinput=
Setting 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
Model-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
Development Process + Testing VC Workbench JML JML Compiler JMLUnit
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 Conclusion
Software Quality Lab University of Paderborn Warburger Str. 100 33098 Paderborn Germany http://s-lab.upb.de Baris Güldali baris@s-lab.upb.de Telefon: +49 5251-60 53 91 Fax: +49 5251-60 34 31 Contact