Narayana Notes 4
Narayana Notes 4
Narayana Notes 4
Week 5
Varun Dutt
School of Computing and Electrical Engineering
School of Humanities and Social Sciences
Indian Institute of Technology Mandi, India
1
Software Testing
.
Testing Methods: The Box Approach!
Integration testing
ü Testing that verifies the interfaces between components against a
software design
ü Tries to expose defects in the interfaces and interaction between
integrated components (modules)
Regression testing
ü Focuses on finding defects after a major code change has occurred
ü Uncover software regressions, or old bugs that have come back
Testing Process
Traditional Waterfall development model
UNIT TESTING
CODE (.Java TOOL (e.g.,
file) JUnit)
COVERAGE MUTATION
TOOL (e.g., TESTING TOOL
Emma) (e.g., Jester)
JUnit: A popular unit testing tool for Java
14
Writing and Running JUnit Tests
15
Writing and Running JUnit Tests
To an existing Project, add a JUnit TestMultiply.java suite file via Package Explorer.
Write the code in the file as mentioned below and then run the test case by right
clicking the TestMultiply.java file and doing Run As and JUnit Test.
Name of the method must begin with "test"
17
Output of the Test
18
Other Annotations
19
Assert Statements
21
Example
JAVA CLASS
JUNIT CLASS
JUNIT OUTPUT 22
Code Coverage: Emma
24
Installing EclEmma
25
Installing EclEmma: Coverage Decorators
26
Installing EclEmma: Coverage Mode
27
Installing EclEmma: Source Code
Annotation
28
Installing EclEmma: Coverage View
29
What Next?
30
References: Please read them!