Help Index

Watir Website

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. Your Testuff login details are used for identification. Each test has a unique ID. Test results are POSTed to the relevant API URL and include – as parameters – the test ID, lab name, and test result. Following the request, Testuff updates the test result accordingly. Read more about the automation URL on the automation page.

Watir integration know-how

Pre Requisites:

  1. Latest Version of Ruby Should be Installed (Check here if not).
  2. Watir Should be Configured (If not Refer to Watir website).
  3. Testuff Login ID , Password and API Information.

Sample: Watir

require 'watir'
ie = Watir::IE.new
ie.goto("http://google.com")
ie.text_field(:name, "q").flash
ie.text_field(:name, "q").set("Testuff")
ie.button(:name, "btnG").click
 
require 'net/http'
require 'net/https'
# Replace host name with values from Testuff API settings screen
http = Net::HTTP.new('serviceX.testuff.com',443)
http.use_ssl = true
# Use this Statement to Avoid SSL Certificate Error 
http.verify_mode = OpenSSL::SSL::VERIFY_NONE 
# Testuff API url
path = '/api/v0/run/'

req = Net::HTTP::Post.new(path)
# Replace email and password with your account details
req.basic_auth 'your_testuff_login_email', 'password'

# replace test ID with correct value from Testuff
# edit the parameters below to fit with your data and format
req.add_field 'Content-Type', 'application/json'
data = '{"test_id": "abcdefghijklmnop", "status": "passed"}'
req.body = data
resp, data = http.request(req)
# Output response code to the screen (we should get 201)
puts 'Code = ' + resp.code
puts 'Message = ' + resp.message
puts 'resource uri = ' + resp['location']

Help Index