Guo Liang
School of Computing
National University of Singapore
Testing – an essential step of development
Organized as test cases for different components
Selectively executed
– Test cases must be independent
We are going to identify dependent test cases and discuss the solution
Use JSlice to find dependence between test cases of JMeter
JMeter test cases based on JUnit
Execute JUnit for execution of JMeter test cases
Dynamic slicing tool for Java
Another Java virtual machine
– Use it to execute Java program and to slice
Compatible with Java 1.4
Available on Linux
Server: modelchk.ddns.comp.nus.edu.sg
ID/password: sent
Connect using SSH
Copy the folder /usr/local/slicing on the server
Put under the same path in your own box
Tested on Fedora Core 3 and 4 only
A unit testing framework
Test case template class provided
Application test cases extending template class
Java based application
Functional and performance evaluation
Test cases provided by developer for unit testing
Slice
JSlice
Slicing Result
Execute
Trace
The Java Program
JUnit
Call test case methods using reflection
JMeter test cases
Method criterion
– (class, method)
– All statements executed between method entry and exit
Specified in file:
–
–
Number_of_criteria
Class_name_1 method_name_1
–
–
Class_name_2 method_name_2
…
A set of statements
– The criterion control/data dependent on
In result file:
– Class name 1
– Line number 1
– Class name 2
–
–
Line number 2
…
Navigate to JMeter home folder
Execute
– sh runtest.sh criteria sliceresult
The slice result is saved in sliceresult
8 test cases shown in JMeterTestSuite.java
Each test case may have several single tests
All methods within the test case class are considered as part of the test case
Report dependence between test cases, not between single tests
You may modify JMeter and its test cases
public class HelloWorld extends TestCase { public void setUp() { … } public void testAddition() { … } public void testMultiplication() { … } public void tearDown() { … }
}
A B
– Test case B is control / data dependent on test case A
A common case
– A global variable v defined during A while used during B
Execution sequence
Real test case dependence
–
Removing A, B’s behavior is different
– The variable is in the application
Other test case dependence
– Removing A does not affect B
– The variable is in Java library
Find all test case dependence
Identify real dependence
State the reason and solution