3. Getting started with Vitaq AI¶
3.1. How to create a Vitaq AI Test Activity to auto-generate tests¶
Please use this flow diagram to guide you through getting started with Vitaq AI to auto-generate tests with Appium, Selenium or any Software under Test.

3.2. Vitaq AI Docker container¶
Vitaq is delivered as a docker container with the following configuration.

Vitaq can be run in three different configurations.
3.3. Vitaq AI powered by Scriptworks¶

This configuration requires the scriptworks-vitaq-client to be running. This JS client is pre-installed into the container and can be found by opening a Terminal and typing ls. The scriptworks_vitaq_client forms the bridge between the Scriptworks website, the running Vitaq test activity and the system under test. It finds the system under test using the IP address and port number specified in the “Selenium or Appium Server” section of Scriptworks run settings. The Vitaq AI test Automation user interface allows users to graphically capture test activity diagrams (models of your test space), define activity variables (parameterised test data) and set properties on the actions. When the user hits the run button the test activity is executed as Python code. The Python code communicates with the Scriptworks-Vitaq client using the IP address and port number specified in the Vitaq Preferences in the Scriptworks section (Scriptworks Host/ Scriptworks Port)
This also requires the scriptworks-client to be running (see www.scriptworks.io for installation onto your host machine and user instructions). This is the regular Scriptworks client which enables the Scriptworks Inspector tool to help create selectors and local Scriptworks runs.
In this configuration you can use Scriptworks visual coding for Test Action Scripts and/or JavaScript and/or Python.
Note
Don’t forget the specific “desired capabilities” need to be specified in the Scriptworks run-settings. In each case there needs to be a driver/webdriver for each target e.g. for Chrome, the set-up is all pre-configured in the Vitaq docker container.
Warning
If you are having issues getting your Scriptworks visual functions to run in Vitaq AI please follow this advice. When Functions created in Scriptworks do not get executed in Vitaq AI, you should follow the following debug process. Find the FunctionsCode.js file in the directory that you are running your scriptworks-vitaq-client.js from. The FunctionsCode.js contains all of the JavaScript code pulled from Scriptworks. Load this into your IDE and check it for syntax errors. If a Function in this code has a syntax error, it will not be executed on Node by Vitaq.
3.4. Vitaq AI with JavaScript¶

This configuration requires the vitaq-client client to be running. This JS client is pre-installed into the container and can be found by opening a Terminal and typing ls. The vitaq-client forms the bridge between the JavaScript Test Action scripts in the running Vitaq test activity and the system under test. It finds the system under test (Selenium or Appium server) using the IP address and port number specified in Driver Address setting of the vitaq-client (explained in Running the vitaq-client for JavaScript). For configuration help run client in a terminal using ./vitaq_client.js –help run settings.
In this configuration users can code their Test Action Scripts in either JavaScript or Python. Providing the possibility to use JavaScript for Selenium or Appium code and Python for golden reference oracles to check against.
3.5. Vitaq AI with Python¶

This configuration does not require any client to be running. The Test Actions are coded using Python. The Vitaq AI Test Automation User interface allows users to graphically capture test activity diagrams (model of your test space), define activity variables (data parameters) and set properties on the actions. When the user hits the run button, the test activity is executed as Python code auto-generating tests into the software under test (in Selenium or Appium for web & app testing).
3.6. Running Vitaq from the Docker container¶
If you have not installed your Vitaq docker container on your desktop or cloud instance please follow the ‘Running Vitaq in a docker container’ installation instructions.
Once the container has started, the desktop can be acessed using the URL 127.0.0.1:6080 from your browser. Going to this URL in a new tab will make sure the desktop fills the tab in your browser. We recommend that your turn off your favourites bar, to give you more screen space for Vitaq AI.
To start Vitaq, go to the start menu and in the programming tools menu choose Vitaq Test Automation.

Vitaq AI will by default start with your prefered scripting language set to Scriptworks.
Note
You must start the scriptworks_vitaq_client to use Scriptworks visual based scripting in your Test Activity diagrams. You do this by opening a terminal window from the bottom left hand icon System Tool -> LXTerminal Then type ./scriptworks_vitaq_client.js and hit return
3.7. Running your first Vitaq Test Activity example with webdriver.io JavaScript code¶
Click on File -> Open in Vitaq AI. Select Home and then the examples folder. Select the VitaqAI_WebDriverIO_WebShoppingApp folder and then open one of the four folders and select the .vtq file and click the Open button at the bottom right.
These four Vitaq Test Activity examples have been created from a conventional Mocha webdriver.io JS test environment, where the JS code has been re-used in the Vitaq Test Actions and extened to create a dynamic data driven test automation capability using the power of Vitaq’s AI machine learning algorithms.
You can find the complete Mocha JS framework reference example in the Mocha_JS_WebDiverIO_WebShoppingApp folder. This can used as an reference example of how to take your current JS code from a Mocha (or Jest, jasmine or Espresso) test environment and reuse all of it into Vitaq AI. Including your page objects and assertions. A complete description of how this has been created can be found on the http://www.vitaq.online/) blog.
before running the example test Activity’s we first need to start the Vitaq HacaScript client and the Selenium server.
Open a new terminal window in the container (System Tools -> LXterminal). Run the Vitaq javaScript client by typing:
./vitaq_client.js -w webdriverio
Note
If you click tab after typing ./vit it will self complete to ./vitaq_client.js and then all you need is the -w webdriverio Also if you run a few commands in the terminal, you can get back to the pervious ones by clicking the up arrow.
Now start the Selenium server:
Open another new terminal window in the container (System Tools -> LXterminal). Run the Selenium Server by typing:
./selenium_server.sh
Don’t forget you can self complete with tab after typing ./sele
Now go back to the Vitaq AI window and click the run command in the top banner menu. It will run Vitaq for one seed.
3.8. Running the Onboarding example Test Activity for testing a shopping app with Selenium¶
Click on File -> Open in Vitaq AI. Select Home and then the examples folder. Select the onBoardingSW.vtq file and click the Open button at the bottom right.
Select Edit -> Preferences
Click Use Scriptworks Integration radio button. Then enter your Scriptworks User Name and Password (or request a login if you do not yet have a username and password for https://www.scriptworks.io/) and click on the Connect button. It will turn green if the login to Scriptworks cloud is successful as shown below.

Now click Load on the Scriptworks Project and select the Onboarding project which is one of a number or example projects available to you in Scriptworks.
You also need to select the Run Settings for Selenium in the Preferences. We have pre-installed the Chrome driver for you in the docker container, so select Chrome.
Note
The runsettingsid number is the id number of the run settings group in Scriptworks for your current Scriptworks project.
Also click ‘Use Coverage’ and ‘Use AI’ radio buttons. Which will enable the QA coverage and machine learning features in Vitaq AI to be active for this example.
Make sure you click the ‘Ok’ button at the bottom of the form to your Vitaq AI Preferences. If you have a small screen, you may find it difficult to navigate to the ok radio button. You can also use the tab to move between preference fields until you reach the ok radio button and then hit carriage return to save your preferences.
Note
Once you have Edited your preferences, these will be used each time you return to use Vitaq AI. So as long as you are using the same Test Activity, you do not need to Edit Preferences each time you start Vitaq AI. When you click on Edit -> Preferences, you will notice that the Connect button is not green. Do not be concerned. If you have the correct user Name and password set in the preferences, then Vitaq AI will connect to Scriptworks. You do not need to click on Connect again. Also do not be concerned if the Scriptworks project and/or Run Settings are not being displayed. If you have set them previously in Edit Preferences, they will be remembered and used.
Now click the run button in the top banner menu strip of Vitaq AI.
Vitaq AI will now automatically generate tests for the example shopping application using Selenium. You will see the web app being tested in the docker containers Chrome browser window. When you click on Coverage in the top banner menu of Vitaq you can see the QA coverage being displayed as Vitaq AI runs. The artificial intelligence (AI) and machine learning algorithms will guide Vitaq AI to achieve 100% QA coverage, which takes 13 passes. You will see the individual coverage results accumulated each pass and you can see the Total coverage reach 100% after about 10 minutes run time.
3.9. Changing your default scripting language¶
To select another scripting language when using Vitaq AI, you need to edit the preferences. When Vitaq AI is open, click on Edit then Preferences.
3.10. Running the vitaq-client for JavaScript¶
Open a new terminal window in the container (System Tools -> LXterminal). Interrogate the client by typing:
./vitaq_client.js --help

This client enables you to use JavaScript only test Action scripts (when you are not using Scriptworks) with either selenium webdriver or webdriver.io or Appium.
Note
Console.log messages from JavaScript test actions are reported to the client window. To help with debug of test script execution, you can put the client into debug mode with –debug or -x
Warning
Remember to start the vitaq-client before trying to run your Vitaq Test Activity.
3.11. Appium and Selenium run Settings for the vitaq_client¶
To configure the client for Appium or Selenium run Settings, you need to create a Capabilities.json file. Here is a Appium android example:
If you do not specify any capabililities.json file, then Vitaq will default to Chrome for Selenium.
3.12. Using webdriver.io¶
To switch from the default Selenium webdriver to webdriver.io the vitaq_client.js has a -w option
./vitaq_client.js -w webdriverio
This will start the Vitaq javascript client with the webdriver.io driver and because we did not define a capabilities.json file using -f it will start with the default Chrome driver.