David Noble
[email protected]
Sr. Solutions Architect, Exist Global
Testing in Java
San Gabriel Valley Java Users Group
http://www.sgvjug.org/
June 25, 2007
Goal
Motivate excellence in testing
with concepts, practices, and tools
2
Scope
requirements
quality
Testing assurance
continuous concepts,
integration
practices,
tools static code
analysis
debugging
profiling
3
Agenda
Test-Driven Development
Terminology
Tools
Application
Discussion
4
System Concept
System
Requirements
System Design
Detailed Design
Implementation
n
ti
g es
T
http://www.flickr.com/photos/h2oalchemist/342496829/
5
Demo
A Taste of TDD
Test-Driven Development
Add test
Fail
Make small change
Pass
Pass
Commit changes
7
See also: http://www.agiledata.org/essays/tdd.html
Test-Driven Development
Add test
Fail
Fix bug
Pass
Commit changes
8
Test-Driven Development
Refactor Pass Commit changes
Code
Add test
Fail
Make small change
Pass
Pass
Commit changes
9
Test-Driven Development
Small steps
Frequent check-ins
10
Test-Driven Development
Deeper than “test first”
Design for testability
11
Test-Driven Development
Unit tests as example code
Interface before implementation
Function drives form
12
Test-Driven Development
Loose coupling
Services with clear responsibilities
Mock objects
13
Taste
the
soup!
14
http://flickr.com/photos/basak/227480302/
Intent Reality
Requirements, Implementation,
Architecture, Deployment
Design
15
Intent Reality
Requirements, Implementation,
!
ap
Architecture, Deployment
G
Design
16
Intent Accountability Reality
Requirements, Testing, QA Implementation,
Architecture, Deployment
Design
17
Intent Accountability Reality
Requirements, Testing, QA Implementation,
Architecture, Deployment
ec t y
Design
h li
k!
C ea
R
18
Terminology
QA – quality assurance
Do the right things
Do things right
Ensure quality standards
19
Terminology
Test – success criteria
Is it right?
Is it done?
20
Terminology
Test plan
Test case
Test suite
Test report
Test coverage
21
Terminology
Unit test
Functional test
Integration test
System test
Acceptance test
Regression test
22
Terminology
Non-functional testing
Performance test
Load test
Soak test
23
Terminology
Continuous integration
24
Tools
Mock Objects jMock, EasyMock
Unit Tests JUnit, TestNG
Build Ant, Maven
IDE Eclipse, NetBeans
25
Tools
Web Apps Selenium, HttpUnit
JEE Servers Cactus
Databases DBUnit
26
Tools
Acceptance Selenium, FitNesse, Stiq
Performance JMeter, Eclipse TPTP
Coverage Cobertura, Emma
27
Tools
Continuous Cruise Control,
Integration Continuum,
Hudson
28
Tools
Continuous Integration Cruise Control, Continuum, Hudson
Acceptance Selenium, FitNesse, Stiq
Performance JMeter, Eclipse TPTP
Coverage Cobertura, Emma
Web Apps Selenium, HttpUnit
Unit testing
JEE Servers Cactus
Databases DBUnit
Mock Objects jMock, EasyMock
Unit Tests JUnit, TestNG
Build Ant, Maven
IDE Eclipse, NetBeans
29
Demo
Tools
Resources: SGV JUG
Web Site
http://sgvlug.net/mailman/listinfo/java-sig
Mailing List (Hosted by SGV Linux Users Group)
http://sgvlug.net/mailman/listinfo/java-sig
[email protected] 31
Resources: TDD
Articles
http://www.agiledata.org/essays/tdd.html
http://en.wikipedia.org/wiki/Test_driven_development
http://www.testdriven.com/modules/xoopsfaq/
http://www.artima.com/intv/testdriven.html
http://www.google.com/search?hl=en&q=test+driven+development (really!)
32
Resources: IDE & Build Tools
Eclipse IDE
http://www.eclipse.org/
NetBeans IDE
http://www.netbeans.org/
Ant
http://ant.apache.org/
Maven 2
http://maven.apache.org/
http://www.devzuz.com/web/guest/products/resources#BBWM
Maven & Eclipse
http://m2eclipse.codehaus.org/
Maven & Netbean
http://maven.apache.org/guides/mini/guide-ide-netbeans/guide-ide-netbeans.html
33
Resources: Unit Testing
JUnit Framework
http://junit.org/
JUnit FAQ
http://junit.sourceforge.net/doc/faq/faq.htm
JUnit with Ant
http://ant.apache.org/manual/OptionalTasks/junit.html
http://ant.apache.org/manual/OptionalTasks/junitreport.html
JUnit with Maven
http://maven.apache.org/plugins/maven-surefire-plugin/
TestNG Framework
http://testng.org/doc/
Jester – Mutation Testing
http://jester.sourceforge.net/
http://www.ibm.com/developerworks/java/library/j-jester/
34
Resources: Mock Objects
Mock Objects Blog
http://mockobjects.com/
EasyMock Library
http://easymock.org/
jMock Library
http://jmock.org/
35
Resources: Unit & Functional
XmlUnit Library
http://xmlunit.sourceforge.net/
DBUnit Library
http://dbunit.sourceforge.net/
HttpUnit Library
http://httpunit.sourceforge.net/
Cactus for JEE Server Code
http://jakarta.apache.org/cactus/
Cargo for JEE Server Code
http://cargo.codehaus.org/
36
Resources: Test Coverage
Cobertura
http://cobertura.sourceforge.net/
http://www.ibm.com/developerworks/java/library/j-cobertura/
Cobertura with Ant
http://cobertura.sourceforge.net/anttaskreference.html
Cobertura with Maven
http://mojo.codehaus.org/cobertura-maven-plugin/usage.html
Emma
http://emma.sourceforge.net/
37
Resources: Perf. & Load
JUnitPerf
http://clarkware.com/software/JUnitPerf.html
JMeter
http://jakarta.apache.org/jmeter/
Eclipse TPTP (Test & Performance Tools Platform)
http://www.eclipse.org/tptp/
Netbeans Profiler
http://profiler.netbeans.org/
38
Resources: Acceptance Tests
Selenium for Web Apps
http://www.openqa.org/selenium/
http://www.openqa.org/selenium-ide/download.action
Automating Selenium (“Remote Control”)
http://www.openqa.org/selenium-rc/
http://wiki.openqa.org/display/SRC/Selenium-RC+and+Continuous+Integration
Selenium & Maven
http://raibledesigns.com/rd/entry/selenium_plugin_for_maven
FitNesse
http://fitnesse.org/
Stiq
http://storytestiq.sourceforge.net/
39
Resources: Cont. Integration
Cruise Control
http://cruisecontrol.sourceforge.net/
Continuum
http://maven.apache.org/continuum/
Hudson
https://hudson.dev.java.net/
40
Resources: App used in Demo
Open Source Medical Record System
http://www.openmrs.org/
Prerequisites: SVN, MySQL 5, Tomcat 5
http://subclipse.tigris.org/update_1.2.x
http://mysql.org/
http://tomcat.apache.org/
SVN Repository
http://svn.openmrs.org/openmrs/branches/alpha
Installation
Edit build.properties and properties.xml to set tomcat.user/password,
or add test/test to $CATALINA_HOME/conf/tomcat-users.xml file.
Edit build.properties and/or properties.xml to set tomcat.home file.
Comment out creation of "test" MySQL user in schema if it already exists.
Default username/password is admin/test.
41
Thank you
To all who participated!