Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Info

The examples provided in this page are used to explain how to write the fixture for the SetupInterpreter.

7. Advanced

Do With - Table, Bullet List or Number List example

Image Added supports the expression of rules in table format, bullet list format or number list format. The following examples are equivalent and will yield the same results when executed.

It is important to note that the table and bullet list examples are not executable since the import com.greenpepper.samples.fixture.bank and do with bank rules cannot be specified twice in the same page. Even though it is possible to change between the two methods in the same page, you must keep in mind that the tests are executed in the same system under development. So it is not necessary to re-specify the same rule in the page.

Table

import
com.greenpepper.samples.application.bank
do withbank
opencheckingaccount12345-67890under the name ofSpongebob Squarepants
checkthat balance of account12345-67890is$0.00
deposit$100.00in account12345-67890
checkthat balance of account12345-67890is$100.00

Bullet List

  • import
  • com.greenpepper.samples.application.bank

 

  • do with bank
  • open checking account 12345-67890 under the name of Spongebob _Squarepants
  • deposit $100.00 in account 12345-67890
  • check that balance of account 12345-67890 is $100.00

Number List

  • import
  • com.greenpepper.samples.application.bank

 

  1. do with bank
  2. open checking account 12345-67890 under the name of Spongebob _Squarepants
  3. deposit $100.00 in account 12345-67890
  4. check that balance of account 12345-67890 is $100.00

Object-Graph Navigation Language (OGNL)

Image Added has an extension to supports OGNL expressions. Here are some examples, using the Calculator system:

< , <= , > , >= , and , orImage Added supports these simple mathematical expressions. Use the question mark to specify the position of the value returned by the system. For example, if the expected value should be greater than 15, you will write "? > 15" in the cell.
+ , - , / , *Image Added performs simple operations as a resulting expression. To specify you want to evaluate those operations prior to the comparison, insert an equal sign at the beginning of the operation (ex: =4+1-3).
rule forcalculator
xysum?product?quotient?
628123
7070error
405090? > 100 
4-5? <= 0-20? <= 0
33? < 1 or ? > 4? >= 9 and ? < 12"1"
42=4+2-0=2*4=4/2

To use this extension, you need to specify the fixture factory as com.greenpepper.extensions.ognl.OgnlSupport and add the greenpepper-extensions-ognl-x.x.jar and ognl-x.x.x.jar (that can be found here http://www.greenpeppersoftware.com/nexus/content/groups/public/) to the classpath of the SUT.

Information Tag

Information tags

When a document is executable, Image Added will try to interprete all the supported forms of the document body.
This brings some issues when we need to insert information as Tables or Bullet lists, for example.

To avoid undesired interpretation of forms, we can use the Information tags.
This tag will force Image Added to skip all forms between the Begin Info and End Info tags.

Here is an example:

Begin Info
This tableshouldn't beinterpreted
  • This bullet list
  • shouldn't be
  • interpreted either
End Info

We won't see any coloration of the above table or bullet list after execution of this document.

Image Added will restart the interpretation of the document from from this point.

Rule forCalculator
xysum?
123
Info
titleUseful Information

If the End Info tag is omitted all the body content of the document after the Begin Info tag, will be skipped.

Commented forms

Comment tag

We can decide for some reason that a test shouldn't be executed. Instead of deleting the test from the document, we can comment it. This will force Image Added to skip the test.

The test should be preceded by the tag Comment.

Here are some examples:

Test using the bullet list form.

  • Comment
  • My bulletlist test to skip

Test using the Table form.

Comment
My tableto skip

We won't see any coloration of the above table or bullet list after execution of this document.

Image Added will restart the interpretation of the document from from this point.

Rule forCalculator
xysum?
123