Welcome to the community! Register below to add topics and replies.

Please or Register to create posts and topics.

Flag / Goto action


We added a "flag" to any action which allows to run a "fast-forward" to a particular action.

Using the function


the test execution automatically skip all actions until the flag is found using the Javascript function.

Make sure to click the checkbox "Run on IDE" in the Javascript dialog. 

The flag setting can be found in the "Description" tag and directly in the action list. 

Switch using multiple Ifs

Before, we would combine if-conditions to create switch-like statements. Consider the conditional plug-test case below, where groups are used to drive the conditional logic. 

Here we use groups and the exit condition "Break Group" to emulate the Javascript statement

if ($parameter.product == beer && ...){ 
  // Call Add Prduct with format
if ($parameter.product == coffee && ...){ 
  // Call Add Coffee
if ($parameter.product == merchandise && ...){ 
  // Call Add Prduct without format

Groups can be very powerful to drive this kind of logic and is often a very good choice for basic tests. 

The Switch statement

As you can see, it's not quite  as short as the Javascript switch statement

switch($parameter.product) {
  case "merchandise":
    // Call Add product without Format
  case "coffee":
    // Call Add coffee
    // Call Add product with format

If we study this expression in more detail, it's actually more like a classical goto-statement, where instead of going to any code row, you skip forward until a condition is met. This keeps dangerous side-effects of Goto-like functionality low, as you are only moving forward in the code. We therefore decided to implement this in Boozang. 

Flag / Goto action

Consider the same example as below, when we need to Plug different test cases based on the value of a variable.

We can now use flag and the goto-function to implement the same logic, but shorter. Start by removing all the groups and instead adding "flags" to all the Plug-test cases accordingly

We can now create a single Javascript expression to handle the logic

switch ($parameter.product.toLowerCase()){
  case "coffee":
  case "merchandise":
  case "other":

Note Remember to select the checkbox "Execute on IDE" to make this work.

Using the flag in condition

We also added the flag as an "Exit condition." Note: It will only work when setting "Continue to next action". 


Now we have recreated the logic with much less code.

Remember, as you don't want to execute plug-test cases below a list of plugs, it's important that you break out of the test using exit conditions.


A word of caution: Using "goto flag" can be very powerful, but might make some tests harder to read. Make sure to use with caution, and try and maintain good test structure. Goto flag is not meant to replace good code modularity and code grouping.







Nice article and feature Mats!

Maybe you can add a screenshot of where the "Execute on IDE" checkbox is and more details on what it does?

I will write a separate entry on it. The main idea is

  • Default: Execute Javascript in the application window
  • Execute on IDE: Execute the function in the IDE Javascript window

Sometimes, this is not crucial, but in some cases it makes a big difference. I will make a longer forum post on this topic.

Create your account for free!

Prefer a demo instead?