Explanation slides

advertisement

CS4272 Hardware-Software Co-design

Assignment 2

Guo Liang

School of Computing

National University of Singapore

Testing

 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

Tools Involved

 Use JSlice to find dependence between test cases of JMeter

 JMeter test cases based on JUnit

 Execute JUnit for execution of JMeter test cases

JSlice

 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

Access

 Server: modelchk.ddns.comp.nus.edu.sg

 ID/password: sent

 Connect using SSH

Self Access

 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

JUnit

 A unit testing framework

 Test case template class provided

 Application test cases extending template class

JMeter

 Java based application

 Functional and performance evaluation

 Test cases provided by developer for unit testing

Overview

Slice

JSlice

Slicing Result

Execute

Trace

The Java Program

JUnit

Call test case methods using reflection

JMeter test cases

Slicing Criterion

 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

Slicing Result

 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

Execute JSlice

 Navigate to JMeter home folder

 Execute

– sh runtest.sh criteria sliceresult

 The slice result is saved in sliceresult

JMeter Test Cases

 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

A Sample Test Case

 public class HelloWorld extends TestCase { public void setUp() { … } public void testAddition() { … } public void testMultiplication() { … } public void tearDown() { … }

 }

Test Case Dependence

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

Two Types of A

B

 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

The Assignment

 Find all test case dependence

 Identify real dependence

 State the reason and solution

Download