View
71
Download
0
Embed Size (px)
DESCRIPTION
EuroSTAR Software Testing Conference 2010 presentation on A Lean And Mean Approach To Model-Based Testing by Bert Zuurke. See more at: http://conference.eurostarsoftwaretesting.com/past-presentations/
Citation preview
W20 - A Lean And Mean Approach To Model-Based Testing
Bert Zuurke
Logica Netherlands
Presenting
• I will present a method :
– where the test scripts are generated from state transition diagrams
– and populated with test data from an Excel spreadsheet.
Including
• Demonstrating the use of open source tools
– For making state transition diagrams
– For generating test scripts
– For recording test results
– For automating tests
Not included
• This is not a tutorial on model based testing
• This is not a tutorial on how to test with state transition diagrams
• This is not a demonstration of all features of all the tools
Lean and mean
• Only open source
– Low costs to start with MBT
• Understandable and usable by any average tester
We all use models
Hmmm…if I want to make a note
than I need to start Notepad, enter my text,
save it and close Notepad
start
Save
Type text
CancelNo
A state transition diagram
START State Action END State
Start Start notepad Notepad running
Notepad running Type text Text entered
Text entered Close window Save the changes?
Save the changes? No Notepad not running
Save the changes Cancel Text entered
startSave
Type text
CancelNo
Start Notepad
And also depictured as
Save
Type text
CancelNo
How to test using state transition diagrams
Test scenario’s
All states
All Edges
Statistics:- Edge coverage- State coverage- Test cases coverage
Where is the test data?
Endless edges?
For every test case we need an extra edge
Why using Excel for test data?
Action wordWhat to do
Arguments= test data
Field labels
Use of excel
Edge name Label
Type Text 1 A note for Eurostar 2010
2 Another line
3 Last line to type
Putting it all together
Use Model State Diagram for navigation
Use Excel for the test data
Add a user interface
Model engine
Testdata
Model state diagram
SOAP Request SOAP Repley
Testdata
Test engine
• Offline mode
• Online mode
• Test automation
Operation Modes
Navigation
Details
Demo YeDmake a transition diagram for Notepad
The following sheets are placeholders for the real demonstration.
Generate Excel worksheet
Generate an Excel worksheet (2)
Supply the test data
Run and have fun!
Automation
Test Automation can be added in the same way as with keyword driven tests
keyword testdata3testdata2testdata1
Step 1: action (enter testdata1 in field 1)Step2: action …
Notepad running
Text added
Add Text
Edge name testdata1
Func Add_textsend(“A note for Eurostar 2010{ENTER}”)Endfunc
Automation (2)
Per step automatione.g.Start the application run("Notepad.exe")Enter text send(“A note for Eurostar 2010{ENTER}”)Close the window WinClose("Untitled - Notepad","")Cancel “Save the changes” ; click No button
ControlClick("Notepad","","[CLASS:Button; INSTANCE:2]")
Do not “Save the changes” ; click No buttonControlClick("Notepad","","[CLASS:Button; INSTANCE:2]")
How it is done:1. Generate an autoit script template2. Add programming statements for each step inside the functions3. Compile with engine4. Test the test
Demo: generate the programming frameand add the statements to automate the test
Switch $namecase “e_Type_A”$nextaction=e_Type-A($sproc,$itestcase,$aArguments)case “e_Close”$nextaction=e_Type-A($sproc,$itestcase,$aArguments)
…
End switch
Func a_Type_A($Proc,$testnr,$aData); do the action on the SUTWinWait("Untitled - Notepad","")If Not WinActive("Untitled - Notepad","") Then WinActivate("Untitled - Notepad","")WinWaitActive("Untitled - Notepad","")send()Endfunc ;e_Type_A
Run again and have more fun
This page is a placeholder for the real life demo
Extensions to the model
Use of guards and expressions
Edge can only be used if the condition is true:Test_entered=true
Expressions can change the stateVariables:Test-entered=true
Syntax:Name[guard1;guard2;]/expression1;expression2
Run again and have more fun
This page is a placeholder for the real life demo
Summary
• I have demonstrated the use of open source tools√ For making state transition diagrams√ For generating test scripts√ For recording test results√ For automating test√ Can be used for a start with Model based testing.
• Commercial tools add more features• Better GUI• More input models• Data generation from class diagrams• Integration with QTP and other tools
Thank you