Before reading this article recommend you to read this help page describing how to use Automation with PractiTest.
PractiTest’s xBot helps you schedule and run the tests via the xBot client – here’s how:
- You define your automated tests in PractiTest Test Library. Each automated test has it’s client_id (optional), the address of the the script to run, and the location of the result file(s) to upload upon the completion of the run. Note, that xBot can run executable file formats.
- Run the xBot – see xBot configuration below.
- In order to run your tests, you create Test Sets as you would normally do with any test in PractiTest. You should then define the Planned Execution Time for each Test Set.
- The xBot is design to silently contact the PractiTest server once a minute, asking for the next available script to run. As soon as there is a test to be run, the PractiTest server sends it to the xBot ogether with the path to the script and to the relevant result files. The Xbot will run the Test on the machine and upload the results back to the PractiTest server.
Automated Tests Parameters
- A manual test becomes an automated test by checking the ‘Is Automated’ checkbox.
- The field Client refers to the unique id for the xBot client machine that should run the test (as defined in the configuration of the xBot below). If the test can run on ANY CLIENT this field should be left empty.
- The Script Path is the path from the xBot client machine to the automated test itself (for example a path to a script written in Selenium). Make sure all machines can access this address.
- The Results Path is the path from the xBot client machine to the automated test result file(s). It can be the path to a single file or to a directory. At the end of the script execution the XBot will upload files from this path to the PractiTest server.
- Number of results files to upload – this tells the xBot how many files to upload from the Results Path. If the number is 3, the xBot will upload the latest 3 files to be updated or created in this directory. If the Results Path is a file, the number here is irrelevant.
- To run Automated Test Scripts you should create a Test Set and add the relevant test instances for the automated test (more on TestSets and Runs)
- The test(s) will be executed based on the Planned Execution time as defined on the Test Set.
Defining the Test results for your scripts
The xBot will send report to the PractiTest server the results of your automated tests based on the following convention:
- A Passed Test should result with 0 (zero).
- A Failed Test is everything but 0.
In addition the xBot will send the results file(s) to PractiTest server
- Each of the uploaded files will be saved as an attachment of the automation run.
- The xBot will upload the latest defined number of files in the specified directory, or a specific file.
The xBot for Automation is a Java client that works (like Practitest) on all Windows, Mac and Linux machines.
- Make sure you have JRE/JDK 1.7 installed
- Download the jar to some folder, this is the download link – https://s3.amazonaws.com/pt_public/xbot-all.jar
- Double-click the jar (or run “java -jar xbot-all.jar” if you prefer command line)
- Left-click on the PractiTest icon at the top of the screen, and click Preferences
- Set the Client ID, and the API Token. The Client ID should be any number starting with 1. For example if you have only one machine that should run xBot, put 1 within the Client ID. If you don’t know your API tokens, contact your account administrator.
- In order to retrieve API Token go to the Account settings, General, API Tokens. The additional information about API tokens you can find here
- Press update, and you can look at the log → it tells each time the xBot is communicating with PractiTest server.
Or make use of PractiTest’s Automation API – Initialize your automated tests (via cron, scheduler, scripts, etc.), and at the end of the test you call PractiTest’s API functions to update your results. Click here find out more about how to update PractiTest via our API.
Configure xBot to launch automatically
As part of our xBot feature improvements, you can set now your xBot to run as you launch your machine.
Instructions to configure(on Windows):
- Create a folder, for instance "C:\xBot", and put the xbot-all.jar there. After initial configuration, a new file "xbot.properties" will appear in that folder.
- Create a shortcut to "C:\xBot\xbot-all.jar" in windows startup folder (see here for instructions how to find that folder [TLDR: navigate to the startup folder in start menu, right click and choose open])
- Configuration should be preserved (and "xbot.properties" file will be in "C:\xBot" folder).