jsystem.framework.fixture
Class Fixture

java.lang.Object
  extended byjsystem.framework.fixture.Fixture
Direct Known Subclasses:
RootFixture

public abstract class Fixture
extends Object

What is a fixture? A fixture represents a state of the Software/System you are testing. Let’s say you are testing a web application. One fixture (and obviously the basic) can be your machine without anything install on it, you can define it as your root fixture. A second fixture can be the machine install with the application you are testing. Additional fixture can be your application configured with some data. To define a fixture 2 things should be defined: setup - the way to get to the fixture and teardown - the way from the fixture to it parent state. In our model the fixture are arranged in tree. Every fixture can set it parent fixture. Why do you need fixtures? Every test, especially functional/system test, have a fixture. In some of the cases the fixture is very complicated. A not so good solution to the problem will be to enter the fixture setting to the test itself. Fixture management gives better alternative.


Field Summary
static Reporter report
          Use it to log positive events from your test.
static int SETUP_DIRECTION
           
static Sut sut
          Use it to get information about the setup/system you are testing.
 SystemObjectManager system
          Use it to access the interfaces of your tested system.
static int TEARDOWN_DIRECTION
           
static int TEARDOWN_FAIL_DIRECTION
           
 
Constructor Summary
Fixture()
           
 
Method Summary
 void failTearDown()
          failTearDown will be invoke if a test that failed defined a fixture to fail to.
 String getName()
          Get the fixture name (the default is the class name)..
 Class getParentFixture()
          Get the parent fixture class.
 void run(int direction)
           
 void setName(String name)
          Set fixture name.
 void setParentFixture(Class parentFixture)
          Set the parent fixture class.
abstract  void setUp()
          The fixture setup method, should include all the operations, that will take you from the parent fixture to the current fixture.
abstract  void tearDown()
          The fixture tearDown method, should include all the operations, that will take you from the current fixture back to the parent fixture.
 String toString()
          The fixture name without the package (used for presentation).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SETUP_DIRECTION

public static final int SETUP_DIRECTION
See Also:
Constant Field Values

TEARDOWN_DIRECTION

public static final int TEARDOWN_DIRECTION
See Also:
Constant Field Values

TEARDOWN_FAIL_DIRECTION

public static final int TEARDOWN_FAIL_DIRECTION
See Also:
Constant Field Values

report

public static Reporter report
Use it to log positive events from your test.


sut

public static Sut sut
Use it to get information about the setup/system you are testing.


system

public SystemObjectManager system
Use it to access the interfaces of your tested system.

Constructor Detail

Fixture

public Fixture()
Method Detail

setUp

public abstract void setUp()
                    throws Exception
The fixture setup method, should include all the operations, that will take you from the parent fixture to the current fixture.

Throws:
Exception

tearDown

public abstract void tearDown()
                       throws Exception
The fixture tearDown method, should include all the operations, that will take you from the current fixture back to the parent fixture.

Throws:
Exception

failTearDown

public void failTearDown()
                  throws Exception
failTearDown will be invoke if a test that failed defined a fixture to fail to. Then all the down navigation will be done using the failTearDown path. this method is optional and if not defined the tearDown will be called.

Throws:
Exception

run

public void run(int direction)
         throws Throwable
Throws:
Throwable

getParentFixture

public Class getParentFixture()
Get the parent fixture class.

Returns:
Parent fixture class.

setParentFixture

public void setParentFixture(Class parentFixture)
Set the parent fixture class.

Parameters:
parentFixture - Parent fixture class.

getName

public String getName()
Get the fixture name (the default is the class name)..

Returns:
Fixture name.

setName

public void setName(String name)
Set fixture name.

Parameters:
name - Fixture name.

toString

public String toString()
The fixture name without the package (used for presentation).

Returns:
Fixture name.