Professional Documents
Culture Documents
Unit Testing
Testing
Unit testing
Testing
concepts
tools
JUnit
Practical
use of tools
Examples
How
Why?
Why testing?
Working code
Good set of unit tests
Unit testing with JUnit
System
specification
System
integration
testplan
Acceptance
testplan
Service
System
design
Acceptance
test
Detailed
design
Subsystem
integration
testplan
System
integrationtest
Moduleand
unitcode
andtess
Subsystem
integrationtest
Fact of testing
10
11
Input
Output
12
Input
Output
13
Operating system
Win98
Win2k
Winxp
Printers
HP 4100
HP 4200
14
Types of Tests
Unit
Component
Integration
15
16
17
Regression testing
New
We
18
Testing tools
19
JUnit
JUnit
Unit
20
JUnit..
JUnit
21
22
23
24
Fixtures
25
26
In
27
28
Test suites
In
29
assertX methods
assertSame(Objectexpected, Objectactual)
assertNotSame(Objectexpected, Objectactual)
assertNull(Objectobject)
Unit testing with JUnit
30
assertX methods
assertNotNull(Objectobject)
fail()
31
32
JUnit
framework
Unit testing with JUnit
33
34
Dont
35
36
37
38
TestCase lifecycle
1.
2.
3.
4.
setUp
testXXX()
tearDown()
Repeats 1 through 3 for each testXXX
method
39
Test Suites
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import example.SimpleTest;
import example.HtmlDocumentTest;
Demo
40
1.
2.
3.
4.
5.
6.
41
Why JUnit
42
This ignores:
Programs
43
44
45
point:
org.eclipse.ui.views
Class extends ViewPart
Create widgets in the view by instantiating
the classes of those widgets.
Only a StyledText is needed!
46
handleCursorPositionChanged
In your Editor Class.
Override handleCursorPositionChanged
method to implement the update action, and
checking if cursor select a strategy or xpath.
47
48
Implement your
IDocumentPartitioner
org.eclipse.jface.text.IDocumentPartitioner
49
StyledText
org.eclipse.swt.custom.StyledText
SWT
widget
append(String string)
setStyleRanges(StyleRange[])
StyleRange specifies various styles for
some parts of the text
50
Be sure to use:
edu.neu.ccs.demeter.aplib.cd.ClassGraph
ClassGraph.fromString(Strings)
Construct Traversal
Traversal.getEdgeSets()
Traversal.getNodeSets()
Tricky part: Create ClassGraph from source files
51