net.sf.jameleon.util
Class AssertLevel

java.lang.Object
  extended by net.sf.jameleon.util.AssertLevel

public class AssertLevel
extends Object

A singleton that keeps track of the assert levels accross all test cases. This is implemented by calling an "assert" method that takes an assertLevel parameter in it. If an "assert" method without that parameter is sent, this singleton will no be used to check whether the assert can happen or not. The order of test levels follows:

  1. SMOKE
  2. LEVEL1
  3. LEVEL2
  4. FUNCTION
  5. LEVEL4
  6. LEVEL5
  7. REGRESSION
  8. LEVEL7
  9. LEVEL8
  10. ACCEPTANCE
The LEVEL are used when there is a test level that is somewhere between two of the test levels with meaning. It is suggested that SMOKE, FUNCTION, REGRESSION, and ACCEPTANCE are exclusively used until a need is found for more levels.


Field Summary
static int ACCEPTANCE
          An Acceptance level test.
static int FUNCTION
          A Function level test.
protected  int greaterThanLevel
           
static int INVALID_LEVEL
          An invalid level.
protected  int lessThanLevel
           
protected  int level
           
static int LEVEL1
          A test level between a Smoke and Function.
static int LEVEL2
          A test level between a Smoke and Function.
static int LEVEL4
          A test level between a Function and Regression.
static int LEVEL5
          A test level between a Function and Regression.
static int LEVEL7
          A test level between a Regression and Acceptance.
static int LEVEL8
          A test level between a Regression and Acceptance.
protected  Set levels
           
static int NO_LEVEL
          The default setting of every level
static int REGRESSION
          A Regression level test.
static int SMOKE
          A Smoke level test.
 
Method Summary
 void addLevel(int level)
          Adds at level at which asserts with levels set to this may be executed to the list of possible levels.
 boolean assertPerformable(int assertLevel)
          Tests whether an assert should be performed at a certain level.
 void clearAll()
          Clears any assert levels that may have been set.
 int getGreaterThanLevel()
           
static AssertLevel getInstance()
           
 int getLessThanLevel()
           
 int getLevel()
           
 Set getLevels()
           
 void removeLevel(int level)
          Removes at level at which asserts with levels set to this may be executed to the list of possible levels.
 void setGreaterThanLevel(int greaterThanLevel)
          Sets the level at which asserts with set to or greater than the value this is set may be executed.
 void setLessThanLevel(int lessThanLevel)
          Sets the level at which asserts with levels set to or less than the value this is set may be executed.
 void setLevel(int level)
          Sets the level at which asserts with levels set to this may be executed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SMOKE

public static final int SMOKE
A Smoke level test. A Smoke test is usually run before QA even begins to start their testing. This tells the tester that application is in some kind of functional state. In other words, these are tests that MUST pass in order for QA to even bother further test.

See Also:
Constant Field Values

LEVEL1

public static final int LEVEL1
A test level between a Smoke and Function. Used just in case more levels are needed.

See Also:
Constant Field Values

LEVEL2

public static final int LEVEL2
A test level between a Smoke and Function. Used just in case more levels are needed.

See Also:
Constant Field Values

FUNCTION

public static final int FUNCTION
A Function level test. A Function test is usually run by QA to see if the application is mostly working correctly. Usually these kinds of tests test that a feature works as documented.

See Also:
Constant Field Values

LEVEL4

public static final int LEVEL4
A test level between a Function and Regression. Used just in case more levels are needed.

See Also:
Constant Field Values

LEVEL5

public static final int LEVEL5
A test level between a Function and Regression. Used just in case more levels are needed.

See Also:
Constant Field Values

REGRESSION

public static final int REGRESSION
A Regression level test. When a bug/feature is initially agreed upon, QA writes up tests to expose these. These are then qualify as regression tests as they are used to prove that the software isn't regressing.

See Also:
Constant Field Values

LEVEL7

public static final int LEVEL7
A test level between a Regression and Acceptance. Used just in case more levels are needed.

See Also:
Constant Field Values

LEVEL8

public static final int LEVEL8
A test level between a Regression and Acceptance. Used just in case more levels are needed.

See Also:
Constant Field Values

ACCEPTANCE

public static final int ACCEPTANCE
An Acceptance level test. Acceptance tests are usually very picky. They are the ultimate in proving that the application is ready for the best customer experience.

See Also:
Constant Field Values

INVALID_LEVEL

public static final int INVALID_LEVEL
An invalid level. Used for validation.

See Also:
Constant Field Values

NO_LEVEL

public static final int NO_LEVEL
The default setting of every level

See Also:
Constant Field Values

greaterThanLevel

protected int greaterThanLevel

lessThanLevel

protected int lessThanLevel

level

protected int level

levels

protected Set levels
Method Detail

getInstance

public static AssertLevel getInstance()
Returns:
the instance available to everyone of AssertLevel

clearAll

public void clearAll()
Clears any assert levels that may have been set.


assertPerformable

public boolean assertPerformable(int assertLevel)
Tests whether an assert should be performed at a certain level. The greaterThanlevel and lessThanLevel are actually greaterThanOrEqualTo and lessThanOrEqualTo. All possible combinations may be set and all will be checked.

Parameters:
assertLevel - - The level the assert is going to be executed against.
Returns:
true if the assert should be performed.

getGreaterThanLevel

public int getGreaterThanLevel()
Returns:
The level at which asserts with set to or greater than the value this is set may be executed.

getLessThanLevel

public int getLessThanLevel()
Returns:
The level at which asserts with levels set to or less than the value this is set may be executed.

getLevel

public int getLevel()
Returns:
The level at which asserts with levels set to this may be executed.

getLevels

public Set getLevels()
Returns:
The levels at which asserts with levels set to this may be executed.

setGreaterThanLevel

public void setGreaterThanLevel(int greaterThanLevel)
Sets the level at which asserts with set to or greater than the value this is set may be executed.

Parameters:
greaterThanLevel - - The level at which asserts with set to or greater than the value this is set may be executed.

setLessThanLevel

public void setLessThanLevel(int lessThanLevel)
Sets the level at which asserts with levels set to or less than the value this is set may be executed.

Parameters:
lessThanLevel - - The level at which asserts with levels set to or less than the value this is set may be executed.

setLevel

public void setLevel(int level)
Sets the level at which asserts with levels set to this may be executed.

Parameters:
level - - The level at which asserts with levels set to this may be executed.

addLevel

public void addLevel(int level)
Adds at level at which asserts with levels set to this may be executed to the list of possible levels.

Parameters:
level - - The level at which asserts with levels set to this may be executed.

removeLevel

public void removeLevel(int level)
Removes at level at which asserts with levels set to this may be executed to the list of possible levels.

Parameters:
level - - The level at which asserts with levels set to this may be executed.


Copyright © 2003-2008 Christian Hargraves. All Rights Reserved.