5. Creating Test Actions¶
The expense bill splitting web App has three main user screens for creating a new account, adding participants, dealing with expenses and calculating a balance. We abstract the tests we want to perform on these screens into Vitaq Test Actions. On each of these screens there are functions that perform a save, settings or a delete, so we will also need Test Actions for these.
The first test action we will define is one to create a New_Account.
To add a Vitaq Test Action, click on the New Action button on the banner menu, you will notice it will now have a grey background to denote it is selected and your cursor will change to a cross. Having this mechanism allows multiple actions to be created one after another whilst in the test action creation mode.
The default language for your Test Action Script will be set by your selection in preferences, which by default is Scriptworks.
Click inside the test activity canvas to create a new test action at the point that you click. Fill in the New Test Action name field and select the colour you want. we have used dark blue. Being able to select the colour for a test action, enables users to differentiate test actions or groups of actions from others. The default colour for a test actions is dark green, once a colour for a test action is selected this will remain selected until a different colour is chosen. To change the name of a Test Action, select the Action Properties tab and then select the test action you wish to edit.
To change the scripting language for your Test Action Script select your required language in the test action properties tab.
To use Scriptworks visual scripts you need to have selected use Scriptworks integration in the Edit -> preferences tab.
Do the same for Add_Participant, My_Accounts, Add_an_Expense, Settings, Delete, Save and Balance
5.3. Setting Call Limits on test actions¶
To control how many times a Test Action is called in a Test Activity run, we can use the Call Limit property on the Test Action. For example, say we want our Test Activity to create one new account and add up to five new Participants in one Test Activity run. To do this we need to set Call Limit properties on the New_Account Test Action to be 1 and Add_Participant to be 5. Start by selecting the New_Account Test Action by clicking on it. You will notice the New_Account Test Action highlights (see below), click on the Action Properties tab to see what default properties New_Account has. To change the Call Limit property, click in its edit field and change the default value (200) to 1. Do the same for the Add_Participant Test Action changing its Call Limit to 5. It is important to understand that this is a Call Limit not a target, so once the limit is met that action will no longer be called by the Test Activity. Whenever you highlight a Test Action its properties will be displayed in the Action Properties tab. We have set small call limits so that test runs do not take too long and we can easily investigate the results. If you do not want to have a call limit set on the Test Action, so that the Vitaq Test Activity will continue to call it as a next allowable action during a run, then set the call limit to 0. The test action will then not display any call limit in the test activity.
When you set the call Limit on the Test Action property, you will see the new Call Limit displayed on the Test Action in the Test Activity pane. If you set it to 0, then a limit is not displayed.
5.4. Disabling Test Actions¶
There may be certain Test Actions which you currently do not want to ‘enter’ in your Test Activity. Maybe because they stop the test flow prematurely or they are not important at this stage in your Test Activity development. This can be handled in Vitaq by disabling this Test Action.
To demonstrate this, we will disable Delete. By default, all Test Actions are enabled when instantiated into a Test Activity. We disable it in the Action Properties tab. Click on the Delete Test Action in the Test Activity window and then click on Action Properties. Click on the Enabled check box to remove the tick.
Do this for all the Test Actions except New_Account and Add_Participant, as shown below. You will notice the No Entry sign in the top left of the Test Actions that are disabled. This means that the Test Activity cannot enter these Test Actions when running a test. To start building out the Test Activity it is good practice to work on a few Test Actions at a time by disabling the ones you do not yet need. We will now work on the flow between the New_Account Test Action and the Add_Participant Test Action.
5.5. Global Actions¶
To reduce the amount of Test Activity connections needed when you have many actions ‘inter-connected’ we have created a special type of Test Action called a Global. These are especially useful when in every app screen you have a button, such as Add_to_basket or in a mobile App you want the next allowable test action (for every action) to be a Rotate Screen to Landscape.
You can change an existing action or define a new action to be global by editing the Action Properties for that Action and clicking the Global tick box as shown below. (This is a bill splitting Test Activity for mobile app test version of our tutorial).
Here we have created a New Action called Rotate_landscape, defined it is as Global and set its probability to 50%. Vitaq now has a 50% probability of selecting this Global Action as an allowable Test Action from any of the test actions in the test activity.
There are three different types of Global action. The default as shown above is Return. Which defines a global action that will return to the test action that it came from. Perfect for Screen rotations in a mobile app, so that you rotate the screen and then return to the end of the test action script that it came from and continue with the user journey. Note that the return to global action should only be used in cases where the global action does not affect the state of the app in a way that would mean that following actions would not be able to execute e.g. by causing the app to return to the log in page.
End type Global Actions are perfect for Quit type operations where you want many actions in the test activity to be able to quit the app. Here the bill splitting app can be quit from any screen apart from the New_Account screen, so we exclude that action from the Global. So the test activity cannot choose Quit as a next allowable test action from the New_Account action.
The third type of global action is a Connected action. This is useful where you want a global action to be the next allowable action from any of the Test Activity actions, but you want the global connected action to only have certain actions as allowable next actions. For example where you have a shopping basket icon on all screens, but once selected it will take you to the checkout_basket test action. Global ‘connected’ type actions can only have arrows drawn from them to other actions. You cannot draw arrows to a ‘connected’ type global action.
Whenever you have arrow connections to a global action, from a previous test activity ‘normal’ actions that are changed to globals you will notice that the arrows are then greyed out. Which means they are disabled from the test activity as shown with the Cancel global action below. They can be re-instated if you change the test action to a non-global.
5.6. Continue on Error¶
When the Test Action Script errors, Vitaq AI will by default start its Test Activity seed run again from the green starting Action with a new seed.
If you want to change the default behaviour of Vitaq AI to continue onto the next allowable Test Action selections, then you need to use the Action Property ‘Continue on Error’ for the specific test Action in question (as shown below).