How to generate a online test sequence
When generating a dynamic
test sequence, mbt
does not generate the complete sequence in one go (compare with offline).
It will deliver one edge or vertex at a time, waiting for user input
(at standard input).
What the user inputs back to
mbt
is important. There are 3 valid inputs, '0', '1' or '2'.
0 - Continue the test.
1 - If BACKTRACK is enabled, try to do backtracking, (This is only
valid in a FSM)
2 - Stop the test.
The are two important
options that has to be set: the stop-condition
and the generator. In
this article, we'll go through some different examples.
Generator - RANDOM
Stop-condition - TEST_LENGTH
This example will
demonstrate how to generate a test sequence
using the random generator, limiting the length of the test. The length
is set to 5 pairs of edges and vertices. The blue color is the user
input (standard input).
$> java -jar mbt.jar online -f graphml/reqtags/ -g RANDOM -s TEST_LENGTH:5
e_Initialize
0
v_KeePassNotRunning
0
e_Start
0
v_MainWindowEmpty
0
e_CloseApp
0
v_KeePassNotRunning
0
e_Start
0
v_MainWindowEmpty
0
e_CloseApp
0
v_KeePassNotRunning
Generator - RANDOM
Stop-condition - TEST_LENGTH
Keyword - BACKTRACK
The reason for this, is the possibility of using backtracking. Best way of showing how it works, is by an example.
Example:
Line 1: $> java -jar mbt.jar online -f graph.graphml -g SHORTEST -s EDGE_COVERAGE:100
Line 2: d
Line 3: 0
Line 4: B BACKTRACK
Line 5: 1
Line 6: C BACKTRACK
At line 1, we start thge execution, and the flag -g means that we
whant do run the test with generator SHORTEST, using the
model foo.graphml.
At line 2, mbt
gives us the first output, which always is an edge.
At line 3, mbt
waits, until we send back something. mbt
only accepts the integers 0,1 or 2.
'0' which means, continue
the test as normal
'1' which means backtracking
'2' will end the test normally
At line 4, mbt
gave us the vertex 'B' adding the keyword BACKTRACK,
which means that backtracking is allowed.
At line 5, mbt
waits, until we sent back the integer 1, which means that we want to do
backtracking.
At line 6, mbt
gave us the vertex 'C' adding the keyword BACKTRACK,
which means that backtracking is allowed.