How to pass a value to a test during its execution.

Q7, 3.09.2013 by Ulyana Skorokhodova View Comments

In case when it is required to pass some values to Q7 test in command line, it is possible to do it like this:

  1. In AUT VM arguments pass desired parameters as Java properties, i.e. add arguments like this: -DpropertyName=propertyValue
  2. Use ECL command substitute-variables (which uses org.eclipse.core.variables plugin) to get a property value like this:
    log [substitute-variables "${system_property:propertyName}"] //writes prop val to AUT workspace log
With newly released Q7 1.3.6, which add supports for variables and user-defined procedures, this becomes even more convenient:
  1. Create ECL context which consist of only one command, declaring global variables:
    global [val prop1 [substitute-variables "${system_property:prop1}"]]
           [val prop2 [substitute-variables "${system_property:prop2}"]]
           [val prop3 [substitute-variables "${system_property:prop3}"]]
  2. Add this ECL context to project’s default contexts in Project Settings
  3. Access anywhere in ECL these properties using $-syntax:
    concat $prop1 $prop2 $prop3 | show-alert
Please let us know if your AUT does not include org.eclipse.core.variables plugin and hence command ‘substitute-variables’ command fails. In this case we’ll provide a custom ECL command to get Java property value.

blog comments powered by Disqus

Functional and UI Testing for Eclipse-based Applications

Test automation solution, handcrafted for Eclipse. Modern and easy to learn IDE.

Product Health Analytics and Support Automation Platform

End-user and product analytics solution that gives you rich insights into your application health & performance.

Eclipse-based IDE for the Fantom Programming Language

Full-featured Integrated Development Environment for emerging Fantom programming language.