The Artima Developer Community
Artima SuiteRunner | Why | Getting Started | Tutorial | Get Help | Discuss | Print | Email | First Page | Previous | Next
Sponsored Link

Drive Your Unit Tests with Custom Scripts
How to Customize Suite Execution by Overriding execute
by Bill Venners
March 10, 2003

Page 1 of 11  >>

Advertisement

Summary
This tutorial shows you how to customize a Suite subclass so that it executes tests by interpreting a script written in a custom test language.

In the Artima SuiteRunner API, an org.suiterunner.Suite (Suite) represents a conceptual suite, or collection, of tests. A Suite is responsible for executing the tests it contains. To ask a Suite to execute its tests, you invoke its execute method. Class Suite provides a default implementation of execute that discovers test methods via reflection, invokes the test methods, and invokes execute on each of its sub-Suites.

The most common way to create a suite of tests with Artima SuiteRunner is to subclass Suite, define test methods, and/or add sub-Suites. (See Resources). When execute is invoked on such a Suite subclass, the execute implementation inherited from superclass Suite will ensure the test methods are invoked and sub-Suite's executed.

In Artima SuiteRunner's API contracts, "test" is used abstractly. A test method is one kind of test, but not the only kind. Executing test methods, as performed by Suite's implementation of execute, is one way to execute tests -- but not the only way. To execute tests in a different way, Suite subclasses can override execute. When execute is invoked on such a Suite subclass, its own execute implementation can execute tests in a custom way.

This article shows an example of a Suite subclass whose execute method:

Page 1 of 11  >>

Artima SuiteRunner | Why | Getting Started | Tutorial | Get Help | Discuss | Print | Email | First Page | Previous | Next

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2014 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us