test case generator module--guitar
TRANSCRIPT
![Page 1: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/1.jpg)
TEST CASE GENERATORMahmoud, Nidhi, Fernando, Chris, Joe, John, and Thomas present:
![Page 2: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/2.jpg)
GUI Testing Background
• Motivation
• GUIs are common within consumer software
• GUI Testing Problem
• How to test a GUI?
• Manual• Resource intensive
• Unreliable
• Automated• Systematic method of test case generation
![Page 3: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/3.jpg)
Automated GUI Testing
• GUITAR
• a GUI testing framework
• Contains four parts:
• The GUIRipper
• used to extract GUI information from a program.
• The GUIStructure2Graph
• uses this output to build a traversable graph representation of the GUI elements.
• The TestCaseGenerator
• creates an extensive set of test cases based on the graph.
• The GUIReplayer
• runs the program as instructed by these tests.
![Page 4: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/4.jpg)
Test Case Generator
• Generates test cases given two inputs:
• Formal model of the GUI in the form of a Graph
• Graph traversal algorithm to simulate a user’s possible interactions with the GUI
• Event Flow Graph
• Bundled plugins
• Sequence Length
• Random
![Page 5: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/5.jpg)
TCG Demo
• Test case generator arguments:• Output.dir
• EFG
• Plugin
• Length
• Max-number
• These arguments can be changed in the TestCaseGenerator.properties file
![Page 6: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/6.jpg)
Sequence Length Plugin Demo
Looking at a sequence generated:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TestCase> <Step> <EventId>e16</EventId> <ReachingStep>false</ReachingStep> </Step> <Step> <EventId>e18</EventId> <ReachingStep>false</ReachingStep> </Step> <Step> <EventId>e39</EventId> <ReachingStep>false</ReachingStep> </Step></TestCase>
![Page 7: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/7.jpg)
WeightedRandom Plugin Demo
• Takes as input an EFG representing the graph structure and an EFG representing the weights of edges.
• Generates shortest path test cases for each potential starting event to every reachable event.
• Rest of tests generated by picking starting event and rest of path randomly, weighted by out edges.
![Page 8: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/8.jpg)
![Page 9: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/9.jpg)
Example Test Cases
![Page 10: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/10.jpg)
GUITAR Recap
JFC Ripper GUI Structure2 EFG
TestcaseGenerator
JFC Replayer
![Page 11: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/11.jpg)
TCG Plugin Structure
TestCaseGenerator Core
SequenceLength
Coverage
RandomTest Case
CustomPlugin
![Page 12: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/12.jpg)
An EFG
e0
e1 e2
e3 e4
![Page 13: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/13.jpg)
A Graph Traversal (SequenceLengthCoverage)
Testcases:e0 → e2 → e4e0 → e2 → e3
![Page 14: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/14.jpg)
Another Graph Traversal (Random)
Testcases:e0 → e1 → e3e0 → e2 → e4
![Page 15: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/15.jpg)
Plugin Goals
TestCaseGenerator uses this plugin mechanism due to different goals in graph traversal:
Speed: Complete coverage plugins may be infeasible for larger graphs
Completeness: For smaller GUIs, all possible test cases may be preferred
Focus: Specific types of test cases, e.g. “All test cases with no cycles”
![Page 16: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/16.jpg)
Plugin Implementation
GUITAR TestCaseGenerator plugins are based off the TCPlugin abstract class
public abstract class TCPlugin * generate(EFG efg, String outputDir, int nMaxNumber) * getConfiguration() * isValidArgs()
* writeToFile(String tCName, LinkedList<EventType> path) * initialize() * getPathToRoot(EventType event)
![Page 17: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/17.jpg)
Plugin Implementation (ctd)
TCG events are broken down into three types:Successors
PredecessorsInitial Events
1
2 3
![Page 18: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/18.jpg)
Relevant GUITAR Constants
NO_EDGE: There is no relationship between the two events
FOLLOW_EDGE: Typical edges in a graph
REACHING_EDGE: Edges used to reach an event
![Page 19: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/19.jpg)
initialize()
e0
e1 e2
e3 e4
FOLLOW_EDGE
REACHING_EDGE
![Page 20: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/20.jpg)
initialize()
e0
e1 e2
e3 e4
initialEvents: {e0}preds: {e0 → Ø}
{e1 → Ø}{e2 → e0, e4}{e3 → e2}{e4 → Ø}
succs: {e0 → e1, e2}{e1 → e3}{e2 → e3, e4}{e3 → Ø}{e4 → e2}
![Page 21: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/21.jpg)
getPathToRoot(EventType event)
e0
e1 e2
e3 e4
Paths to Root - e0 : e0e1 : Øe2 : e0 → e2e3 : e0 → e2 → e3e4 : Ø
![Page 22: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/22.jpg)
ConfigurationIn many cases, additional arguments are needed for a TestCaseGenerator plugin.
Plugins can override a “getConfiguration” method in the TCPlugin interface.
The configuration specifies which additional arguments are to be parsed from the command line.
![Page 23: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/23.jpg)
Example: Weighted Random Configuration
Configuration Class File:
Implementation of getConfiguration() in WeightedRandom.java:
![Page 24: test Case generator module--GUITAR](https://reader033.vdocuments.us/reader033/viewer/2022061618/5521c6654a7959455e8b466a/html5/thumbnails/24.jpg)
Relevant Java Imports
org.kohsuke.args4j:useful command line parser that contains
an “Option” object, which acts as afield/setter that receives a command line
switch value