Concordion > Commands >

Expressions

Concordion uses expressions to reference fields and call methods of the corresponding test fixture and to set specification variables.

In order to keep your specifications simple and maintainable, Concordion deliberately restricts the expression format that is allowed when instrumenting specifications. Complexity should be moved into the fixture code, and then evolved into a DSL, where it is easier to maintain. The idea is to have the fixture do all the work of fetching and munging the data and then return exactly the data that the spec needs, which helps to decouple the spec from the implementation.

The following expressions are available within Concordion commands:

Examples

Evaluation expressions

  1. myProp
  2. myMethod()
  3. myMethod(#var1)
  4. myMethod(#var1, #var2)
  5. #var
  6. #var.myProp
  7. #var.myProp.myProp
  8. #var = myProp
  9. #var = myMethod()
  10. #var = myMethod(#var1)
  11. #var = myMethod(#var1, #var2)
  12. #var ? 's1' : 's2'
  13. myProp ? 's1' : 's2'
  14. myMethod() ? 's1' : 's2'
  15. myMethod(#var1) ? 's1' : 's2'
  16. myMethod(#var1, #var2) ? 's1' : 's2'
  17. #var.myProp
  18. #var.myMethod()
  19. #var.myMethod(#var1)
  20. #var.myMethod(#var1, #var2)

Set expressions

However, if you really want to remove this restriction you can apply the annotation @FullOGNL to your fixture class to allow complex expressions. This would allow you to do things like pass property values of Java beans into methods , or use constant values in concordion:execute commands.

Further Details