Automation
Does Testuff have an automation API?
Yep! It allows your automation to update test results in Testuff. Automation can also be used to automatically export your data.
How does it work?
Via HTTP POST over SSL. Each company has a custom URL and a unique token for identification. Each test has a unique ID. Test results are POSTed to the relevant URL and include as parameters the token, test ID, lab name, and test result. Following the request, Testuff updates the test result accordingly.
How do I set it up?
The automation URL can be found on the Settings link at the top of the Testuff window.
To retrieve the Test IDs simply right click the relevant tests or suite that are automated and choose Show IDs.
Create your automation scripts. See examples below. Scripts need to send HTTP POSTs to the automation URL with the following parameters:
- branch_name - (Optional) the name of the branch where the test result should appear.
- lab_name - (Optional) the name of the lab where the test result should appear.
- test_id - the relevant test ID for which the result is reported.
- status - should be either passed, maybe, or failed.
- tester_name - (Optional) the name of the tester who executed the automation test.
- comment - (Optional) add a free text comment to the execution.
Make sure you receive an HTTP 201 response when sending the POSTs, otherwise something has gone wrong. If something has indeed gone wrong, there should be information in the HTTP response what's the trouble.
As usual, feel free to contact us if you have any issues or questions.
What happens to the tests when creating a new branch?
When copying a branch we keep the test IDs for automation
If you want to run the tests in the new branch, just change the branch_name parameter in the scrips.
Are there any limitations?
Unfortunately yes. At the moment we don't support reporting automation results for lab names that are in unicode. Please contact us if this is essential for you.
Also, if there are several labs with the same name, and you report automation results to one of these labs, Testuff will only update the results to one of them, probably the latest one. Please make sure to keep lab names different from each other.
How do I look up tests by their IDs?
Just enter the ID in the search box on the top right and press enter.
What if my script fails and I want to clear previous results?
You can use a special parameter: empty_lab = "True". It deletes all old runs inside the lab the automation script is running against. Make sure not to use it by accident, or old test results might disappear!
What about some code examples?
Python
import urllibfields = {
"lab_name" : "sanity",
"test_id" : "abcdefghijklmnop",
"status" : "failed",
"tester_name" : "john",
"comment" : "comment text"
}
result = urllib.urlopen("https://service.testuff.com/abcdef/automation?token=01234567890abcdefghijkl", urllib.urlencode(fields))
print result.read()
PERL
Please install the Crypt::SSLeay module beforehand.
use HTTP::Request::Common qw(POST);
use LWP::UserAgent;
my $req = POST 'https://service.testuff.com/abcdef/automation?token=01234567890abcdefghijkl',
[
lab_name => 'sanity',
test_id => 'abcdefghijklmnop',
status => 'failed',
tester_name => 'john',
comment => 'comment text'
];
$ua = LWP::UserAgent->new;
print $ua->request($req)->as_string;
VBA
' Make sure all parameters are urlencoded, e.g. using URLEncode function from http://www.freevbcode.com/ShowCode.asp?ID=5137Set objHTTP = CreateObject("MSXML2.XMLHTTP")
URL = "https://service.testuff.com/abcdef/automation?token=01234567890abcdefghijkl"
objHTTP.Open "POST", URL, False
objHTTP.send ("lab_name=sanity&test_id=6757232347e9b8a5&status=passed&tester_name=John&comment=blabla")
Ruby
require 'net/http'require 'net/https'
# Replace host name with values from Testuff API settings screen
http = Net::HTTP.new('service.testuff.com', 443)
http.use_ssl = true
# Replace company_id and token with values from
# Testuff API settings screen
path = '/company_id/automation?token=token'
data = \ 'lab_name=sanity&test_id=6757232347e9b8a5&status=passed&tester_name=John&comment=blabla'
resp, data = http.post(path, data)
# Output response code to the screen (we should get 201)
puts 'Code = ' + resp.code
puts 'Message = ' + resp.message
<< Time Management | Help index | Automation Tools >>
