Peter Braun Benjamin Flach Reinhard Jeschull Jan Philipps
Peter Braun, Benjamin Flach, Reinhard Jeschull, Jan Philipps Tactic-Based Testing MBTUC 2011 | Berlin, 18 -20 October 2011
Model-Based Testing Behavior model Model determines search paths Search criteria Test case generator Model provides reference values Model returns coverage data Test cases Validas AG Page 2
Lessons Learned Complex data spaces and algorithms Inclusion of prior knowledge of developers Modeling language and tool issues Validas AG Page 3
Tactic-Based Testing Main idea: Seamless combination of model- and script-based testing Data model Tactic determines search paths Tactic Interpreter & Coverage measurement Test cases Coverage over tactic, data and oracle models Oracle model provides reference values Validas AG Oracle model Page 4
Tactic-Based Testing - Framework Tactics JRuby as tactic language Data models based on EMF, Java, … Data model Tactic Interpreter & Coverage measurement Oracle model Validas AG Oracle models in UML, Java or JRuby. Generic interface for other languages Test case and coverage data output as XML Page 5
Tactic-Based Testing – Tactics Use of tactics to build up arbitrary search strategies The structure of the tactics defines the structure of the test cases Tactic parameters Partial test case Validas AG T Set of partial test cases Page 6
Tactic Based Testing – Sample Tactic written in JRuby incorrect_pins tac. Sel. File tac. Nothing tac. Verify. Once tac. Verify. Twice tac. Read = = = [. . . ] # List of 5 incorrect PINs step("select", {"file" => ["1 C 38", "69 A 5", "CA 4 B"]}) identity(); step("verify_chv", {"chv. Value" => CORRECT_CHV}) step("verify_chv", {"chv. Value" => incorrect_pins}) >> step("verify_chv", {"chv. Value" => CORRECT_PIN}) = step("select", {"rec. No" => [1, 3, 10], "mode" => [Record. Mode: : ABSOLUTE]}) # Try to read a record of a file after (in)correct/missing card holder verification return tac. Sel. File >> (tac. Nothing | tac. Verify. Once | tac. Verify. Twice) >> tac. Read Results in 63 generat ed test cas es Visualization of a tactic structure Validas AG Page 7
Validas AG ‣ Founded 2000 ‣ 17 employees ‣ Competences - Model-based development - (Test-) Specification - Test automation - Tool qualification - AUTOSAR ‣ Customers & Partners - BMW - EADS - ESG - Giesecke & Devrient - Infineon - Audi/AEV Validas AG Page 8
Free. RTOS – Interface Testing Interface and robustness testing of off-the-self components Large parameter space Sequences of interface calls Parameter structures Parameter data Validas AG Potential side effects Functional dependencies Hardware configuration (memory size, address layout, …) Return code Nontermination Crash Page 9
Free. RTOS – Test Setup 30. 444 test cases, 153. 851 test steps 41 tactics Tactics Data model About 850 lines of JAVA code Tactic interpreter Oracle model Test Case Generation Validas AG About 1600 lines of JAVA code 41 API-interfaces tested Code generator XML test cases Test framework Compiler Test Case Compilation Execution time of about 7 hours Free. RTOS Test control Compiled test cases Test Case Execution on SUT (Cortex M 3) Page 10
Free. RTOS – Test Results Correct Returncode 7092 Incorrect Returncode 19, 474 Nontermination 805 5496 Crash 0 5000 10000 15000 20000 25000 Example: pv. Port. Malloc (232 -5) – Expected result: NULL-Pointer – Observed result: Valid memory address – Reason: Integer overflow (232 – 5) + 16 = 232 + 11 Header of linked list block for heap management Validas AG Page 11
Smart Card – Command Testing Exhaustive testing of CREATE_FILE and its parameters to create elementary files on a smart card Complex parameters Functional dependencies High variability of parameter structures Command sequences Parameter structures Parameter data Validas AG Configuration of the smart card (max. file size, reserved IDs, …) Statusword Create. EF Data Crash Page 12
Create File – Test Setup Test Execution on SUT Test Case Generation 16 tactics Data model EMF-based, generated JAVA code Tactics About 1000 test cases Test results Tactic interpreter Test cases Test executer Report generator Smart card Report Oracle model About 900 lines of Ruby code (CREATE_EF and 10 supporting commands) Validas AG Report Generation Execution time 7: 30 minutes Page 13
Create File – Data Model Generic and domainspecific data models based on EMF Validas AG Page 14
Create File – Test Execution Tactics to achieve test goals Test reports & analysis support Test execution environment Validas AG Page 15
Lessons Learned Complex data spaces and algorithms Inclusion of prior knowledge of developers Modeling language and tool issues Validas AG Page 16
Summary Tactic-based testing for flexible control of test case generation Precise specification of test cases with varying parameters and structures Applicable to wide range of test objects Create. EF Validas AG Tactics Data model Validas AG Arnulfstraße 27 80335 München Fon +49 (0) 89 -53 88 669 -0 Fax +49 (0) 89 -53 88 669 -10 info@validas. de www. validas. de Tactic Interpr eter & Coverage measuremen t Test cases Oracle mode l Page 17
- Slides: 17