Help Index

Selenium Website

Watch Tutorial

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.

Selenium Integration

There are several ways to integrate Selenium with Testuff. Our own preferred method is to export the Selenium script into Python or Perl, and then use the code on our automation help page to update Testuff.

In addition, if you need to integrate Testuff directly from the IDE, or export HTML scripts, we created a Selenium user extension for Testuff, which allows you to update Testuff with Selenium commands.

To use it:

  1. Download the Testuff Selenium User Extension.
  2. Extract call_testuff.js on your computer from the zip file.
  3. Load it into the IDE. Go to the Selenium options screen and then browse for the call_testuff.js file you saved. Make sure to load it as Selenium Core Extension
  4. Close the IDE and open it again.
  5. You should now have a number of additional commands, for example, resetTestuffParameters, addTestuffParameter, etc.

To update Testuff directly from your Selenium script, you will need to provide the correct API URL, test ID, etc. Make sure to read our automation help page before you start. Use the following commands in order:

  1. resetTestuffParameters()
  2. addTestuffParameter(lab_name,YOUR_LAB_NAME)
  3. addTestuffParameter(test_id,YOUR_TEST_ID)
  4. addTestuffParameter(status,”passed”)
  5. addTestuffParameter(comment,”your comment text”)
  6. callTestuff(YOUR_API_URL, TESTUFF_LOGIN:PASSWORD)

Sample: Java Selenium-RC

package com.example.tests;

import com.thoughtworks.selenium.Selenium;
import com.thoughtworks.selenium.SeleneseTestCase;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.regex.Pattern;

public class TestAutomation extends SeleneseTestCase {
	@Before
	public void setUp() throws Exception {
		WebDriver driver = new FirefoxDriver();
		String baseUrl = "http:\\www.google.com";
		selenium = new WebDriverBackedSelenium(driver, baseUrl);
	}

	@Test
	public void test1() throws Exception {
	       selenium.resetTestuffParameters();
               String url = "https://serviceX.testuff.com/api/v0/run/"; // replace with your data center (from settings->api)
               String loginandpassword = "testuff_login:password";
	       selenium.addTestuffParameter("test_id", "abcdefghijk"); // replace test ID with correct value from Testuff
	       selenium.addTestuffParameter("status", "passed");
	       selenium.callTestuff(url, loginandpassword);
	       selenium.waitForPageToLoad("30000");
	}

	@After
	public void tearDown() throws Exception {
		selenium.stop();
	}
}

Help Index