The document summarizes a presentation on testing in Java given by David Noble. The presentation covered test-driven development concepts and practices, common testing terminology, popular tools for different types of testing, and resources for learning more. It included a demonstration of test-driven development using an open source medical records system. The goal was to motivate excellence in testing through concepts, practices and tools discussed.
4. Agenda
Test-Driven
Development
Terminology
Tools
Application
Discussion
4
5. System Concept
System
Requirements
System Design
Detailed Design
Implementation
Te
Te
http://www.flickr.com/photos/h2oalchemist/34249682
g
g
st
st
9/ 5
iin
n
31. 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
java-sig@sgvlug.net
31
36. 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
37. 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
41. 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
My background: Mostly C & Perl from 1990 – 1997 Mostly Java since then. Telemetry processing, mission ops, EIS @ JPL. BPM, workflow, assorted biz apps.
Goal falls within the larger context of pursuing excellence in software development.
In traditional software development, testing is usually at the end of the schedule. If development runs late, the testing often suffers.
An old man calls the waiter over to his table. "What would you like, sir?" asks the waiter. "Taste the soup," he says. "Is the soup too cold?" asks the waiter. "Taste the soup," says the old man. "Is it too salty?" asks the waiter. "Taste the soup!" says the old man. "Is there a fly in it?" asks the waiter. "Taste the soup!" the old man insists. The waiter looks down: "There's no spoon!" "Aha!" exclaims the old man.
Miriam-Webster: “ a program for the systematic monitoring and evaluation of the various aspects of a project, service, or facility to ensure that standards of quality are being met”
Test plan: document Test case: implementation of specific test. Test suite: collection of test cases. Test report: results of running the tests. Test coverage: description of how much code (and which code) was exercised by tests.
Unit test: typically at the granularity of a class. Functional test: a feature or use case. Integration test: multiple modules. System test: all the modules. Acceptance test: defined by user/customer.
Non-functional testing: the “-ilities”. Performance test: how fast. Load test: how many. Soak test: how long.
This is an alternative to “big bang integration”, otherwise known as “integration hell”.
HttpUnit is better suited to situations where you want to examine the DOM at a low level. If you're looking for convenience, and don't need to get deep into the details, look at Selenium instead.
Selenium IDE, a Firefox plugin, lets users or product managers create their own scenarios. Selenium is also useful during development, to quickly fast forward through actions to get the web application into a desired state.
The items in green aren't really a stack, just a collection of technology-specific libraries that can be useful for creating test cases.
Be sure to design Selenium tests so they can be repeatable. Either delete data when they are done, or always start from a fixed known state.