...
As you may have gathered from the name, "silUnit" was inspired by JUnit, the testing suite for Java. Just as found in JUnit, silUnit makes use of annotations to lets the silUnit suite know which routines functions are intended as tests or features such as running routines functions before each tests. Below is a brief description of each supported annotation and what they do.
...
This basic annotation lets the silUnit Suite know that the routine function that follows is intended as a test. For example:
|
/** BEFORE **/ -
...
Function to Be Run Once
This annotation tells the silUnit Suite that the routine function is to be run once before the rest of the tests. This is useful if you would like to set up one scenario before testing routines functions in a series. For example:
|
/** AFTER **/ -
...
Function to Be Run Once After a Series of Tests
The "AFTER" annotation tells the silUnit Suite to run the routine function after the tests have been completed. This is useful to change the value tested to its original state. Let's say, for example, that we would like to do some testing on a custom field, but would like for that value to return to its original state. We could first use the "BEFORE" annotation to set up the test, then the "AFTER" annotation to set the value back to the original. In the example below, imagine we have a custom field called "textField" and we would like to set the value of textField, test that the transaction was successful, then revert the value of textField to its original state.
|
/** BEFOREEACH **/ -
...
Function to Be Run Once Before Every Test
The "BEFOREEACH" annotation tells the silUnit Suite to run the following routine function once before each test. Let's say we wanted to reset the value of a custom field before every test. The code would look something like:
|
/** AFTEREACH **/ -
...
Function to Be Run Once After Every Test
The "AFTEREACH" annotation tells the silUnit Suite to run the following routine function once after every test. This is useful for cleanup after every test.
...