Skip to content

Latest commit

 

History

History
77 lines (64 loc) · 6.3 KB

README.md

File metadata and controls

77 lines (64 loc) · 6.3 KB

Making Testing Groovy

This project looks at a simple blog application and numerous tools and techniques to test it. In that sense, the examples focus on web testing (and to some degree acceptance testing) - having said that, many of the techniques are generally applicable and can be applied to any kind of testing for any kind of application or system. The examples are mostly Groovy based but again, the ideas transfer across to some degree to other modern languages. The examples are designed to be runnable 'out-of-the-box' by cutting and pasting the code into the GroovyConsole which comes with any typical Groovy installation. Alternatively, they can be run from your favorite IDE (tested with IDEA community edition and Eclipse).

Application Under Test

The application is a simple web-based blogging system. It is a little novel in that it combines in a single Groovy file a Spring/standalone GORM/Jetty application. Just type 'groovy SimpBlog' in the appropriate directory and your application will start. Or you can fire it up in your favorite IDE.

Basic Test Automation

  • The Vanilla examples illustrate how to test the blogging application using basic low-level Groovy/Java features. No testing framework is used.
  • The HtmlUnit examples illustrate how to use HtmlUnit as the test 'driver' to test the blogging application. Various test 'runners' are illustrated: plain groovy, JUnit 3/4, TestNG and GroovyTestCase. Various enhancements are examined: a test case abstraction, a fluent test api and a testing DSL.
  • The JWebUnit examples illustrate how to use JWebUnit as the test 'driver' to test the blogging application.
  • The Watij examples illustrate how to use Watij to test the blogging application. Uses the 2010 vintage webspec-api which supports IE, Firefox/Mozilla and Safari.
  • The Geb examples illustrate how to use Geb to test the blogging application.
  • The WebTest examples illustrate how to use WebTest to test the blogging application.
  • The Selenium examples illustrate how to use Selenium Server (previously called Selenium RC or sometimes referred to as Selenium 1) to test the blogging application.
  • The WebDriver examples illustrate how to use Selenium WebDriver (sometimes referred to as Selenium 2) to test the blogging application.
  • The Tellurium examples illustrate how to use Tellurium to test the blogging application.
  • The HttpBuilder examples illustrate how to use HttpBuilder as the test 'driver' to test the blogging application. This is a fairly low-level api - it gives easy access to status codes, cookies and other low-level information if you require it.

Towards more maintainable Tests

  • The Geb, WebDriver and Tellurium examples illustrate ways to separate the concerns of user interface (or view) and logical model. This is done by writing tests in terms of a logical model and as a separate activity defining the user interface aspects corresponding to the model. One technique illustrated is the use of Page objects.

Towards more readable Tests

  • The Spock examples illustrate how to use Spock to test the blogging application.
  • The EasyB examples illustrate how to use EasyB to test the blogging application.
  • The JBehave examples illustrate how to use JBehave to test the blogging application.
  • The HtmlUnit examples illustrate some fluent api and DSL usage.
  • The Slim examples illustrate writing your tests FitNesse style in a wiki with the fixture code using Groovy. These examples also illustrate a number of FitNesse related tools including HtmlFixture, Xebium and ZiBreve.
  • The Concordion examples illustrate how to use Concordion to test the blogging application.
  • The RobotFramework examples illustrate how to use Robot Framework to test the blogging application.

Advanced Test Case/Data Selection

  • The DataDriven examples illustrate the data-driven capabilities of JUnit4 and TestNG.
  • The CombinationsAndPairs examples examine the idea of testing combinations of parameters where the combinations are automatically generated. Also looks at the idea of pairwise testing (also known as orthogonal array testing or all pairs testing).
  • The Choco examples illustrate how to use Choco to test the blogging application using conditions expressed as logic constraints.
  • The ModelJUnit examples illustrate how to use ModelJUnit to generate test cases from an 'external' model of an application/system.
  • The QuickCheck examples illustrate how to use QuickCheck to generate test cases using random and generated data values.
  • The GPars examples illustrate how to run tests in parallel

Other useful tools (optional)

  • groovy-1.8.3 This is an embedded copy of the Groovy programming language. You don't need this if you already have Groovy installed.
  • Java Required but may be already installed on your system
  • IntelliJ IDEA IDE (Community edition includes Groovy support)
  • Eclipse IDE (plus download the Groovy plugin)
  • SpringSource Tool Suite STS is SpringSource's bundled Eclipse IDE
  • Graphviz/dot open source graph visualization/diagram software.