Blog

Introducing verifications

New and Noteworthy, Q7, 6.09.2013 by Ivan Inozemtsev View Comments

In my opinion, a good functional test can be represented like this:

just-test

Therefore, a test case takes an system under test in some well-defined state, performs some actions, which transfer a system into another state, and then verifies that the final state is correct.

Thus, in a test case we need to specify the following:

  • Initial state
  • Actions to perform
  • Expected final state
Read more…

Procedures and variables

New and Noteworthy, Q7, 3.09.2013 by Ivan Inozemtsev View Comments

While automated recording in Q7 works well, a lot of advanced users prefer to write ECL scripts manually, as it allows to create more flexible and maintainable test cases. In new version of Q7 we have significantly improved the expressive power of ECL by introducing user-defined variables (via let blocks) and user-defined procedures (via proc commands). Before going into details, here’s a simple example – suppose we are testing Java editor and would like to hover a ruler on a currently selected line. Here’s how it can be done without using variables in a plain old ECL:

  get-editor "Program.java" | get-left-ruler |
      get-ruler-column AnnotationColumn | hover-ruler 
        [get-editor "Program.java" | get-text-viewer | 
         get-property "caretPosition.line" -raw]

This is not so much easy to write, and, what is more impotant, not so easy to understand. Now take a look how the same actions can be expressed using variables:

  with [get-editor "Program.java"] {
    let [val currentLine 
           [get-text-viewer | get-property "caretPosition.line" -raw]]
        [val rulerColumn 
            [get-left-ruler | get-ruler-column AnnotationColumn]] {
        $rulerColumn | hover-ruler $currentLine
    }
  }

And if we need to do this operation multiple times in different scripts, we can rewrite it to a procedure:

Read more…

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.

Q7 1.3.6 Released.

Press Releases, Q7, 3.09.2013 by Ulyana Skorokhodova View Comments

Variables and Functions.

User-defined procedures are available in 1.3.6 which allows to create a reusable blocks of code and make you tests more laconic and easy-maintaining. In addition to a Parameter Context where you define global variables, now you can declare your immutable variables, pass its value as an argument and write your own procedures. Content assist is available in ECL editors making its usage quite convenient.
See Procedures and Variables post for more info.
 

Verifications.

Now you can verify the result of the test by adding  verifications.  Verifications are executed at the end of the test and verifies the whole widget state – no need to add its properties one by one (as if you add an assertion). Text verifications allow you to verify Text or Styled text.  Time verification checks that test execution time doesn’t exceed a defined value. This is just a beginning, more verification types are coming, such as: Tree, Table and Error Log verifications. Further plans include context menu verifications and screenshot verifications (for custom canvas-based controls like some charting). Verification usage post will be ready soon.  

Table items capturing improvement.

Now Q7 can get/select table items by column name which prevents -index appearing in a test code and makes test more stable. So, imagine there is a table with a checkboxes in a first column. So clicking a 2nd row checkbox recorded the following code before:
select "" -index 1 | check
Now if there is no text in a first column, we take the first column with non-empty text and use it for a selection:
select NewAssociatedTask -column Description
get-cell 1 0 | check
The first option was guaranteed to be failed in case we add a few new rows in a table above the selected one. The second code will pass since it takes an item by its column value.

Basic arithmetics commands.

We started from the following ones:
  • plus - returns the sum
  • minus - returns the difference
  • div - returns the result of dividing
  • mult - returns the result of multiplication
  • abs - returns the absolute value
So the code example may look like
int 5 | plus 6 | minus 21 | div 2 | abs | eq 5 | assert-true
  For a whole list of new features and fixes see 1.3.6 Release Notes.      

How to Expand/Collapse Tree item.

Q7, 21.08.2013 by Ulyana Skorokhodova View Comments

Introduction.

We always want Q7 tests to be easy-readable and laconic. That’s why we didn’t what to overweight it with “intermediate” user actions which are not followed by a resulting action (like mouse-movements or tree expanding). In the most use cases tree expanding/collapsing  are not the subject of testing so Q7 records only the result (e.g. item selection), automatically expanding a tree. But in some cases we may need to specify expand/collapse state of a tree. In Q7 we have 4 ECL commands which can be used for this purpose:
  • expand
  • expand-all
  • collapse
  • collapse-all
Read more…

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.