How to Sync Your Test Automation Test Result in QA Touch
How to Sync Your Test Automation Test Result in QA Touch
You can sync your test automation result in QA Touch directly with the API end points.
QA Touch API
Before you start using our API, your first step is to obtain an api-token from your QA Touch site. Once you obtain the token, then you are ready to go.
To Obtain api-token follow the steps below Go to User->Edit profile Under General settings, Click ‘Generate API Key’ to generate the API key.
(Note: QA Touch API is a Professional and Enterprise Plan feature)
The sample code snippet to update the QA Touch project’s test run result of the test case in
JAVA OKHTTP
import java.io.*;
import okhttp3.*;
import okio.Okio.*;
public class qatouch {
public static void main(String []args) throws IOException{
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("text/plain");
RequestBody body = RequestBody.create(mediaType, "");
Request request = new Request.Builder()
.url("https://api.qatouch.com/api/v1/testRunResults/status?status=passed&project=JdWL&test_run=EX7V&run_result=k9yl9")
.method("PATCH", body)
.addHeader("api-token", ********API Token********** ")
.addHeader("domain", "****Domain***")
.build();
Response response = client.newCall(request).execute();
System.out.println(response.body().string());
}
}Add the dependency jars in your project external referenced libraries.
Dependency Jars/Libraries
-
commons-validator-1.7.jar
-
okhttp-3.0.0-RC1.jar
-
okhttp-4.10.0.jar
-
okio-1.8.0.jar
PHP CURL
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.qatouch.com/api/v1/testRunResults/add/results?status=passed&project=PROJECTID&test_run=TESTRUNID&run_result=RESULTID&run_result=RESULTID&comments=API%20Endpoint%20checking×pent=10',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => array(
'api-token: ****************API TOKEN****************************',
'domain: ******************DOMAIN********************************'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;JAVASCRIPT Fetch
var myHeaders = new Headers();
myHeaders.append("api-token", "***********API Token******************");
myHeaders.append("domain", "***********Domain******************");
var requestOptions = {
method: 'POST',
headers: myHeaders,
redirect: 'follow'
};
fetch("https://api.qatouch.com/api/v1/testRunResults/add/results?status=passed&project=PROJECTID&test_run=TESTRUNID&run_result[]=RESULTID&run_result[]=RESULTID&comments=API Endpoint checking×pent=10", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));NodeJS Request
import http.client
conn = http.client.HTTPSConnection("api.qatouch.com")
payload = ''
headers = {
'api-token': '**********API Token*********************',
'domain': '*************Domain************************'
}
conn.request("POST", "/api/v1/testRunResults/add/results?status=passed&project=PROJECTID&test_run=TESTRUNID&run_result=RESULTID&run_result=RESULTID&comments=API%20Endpoint%20checking×pent=10", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))Python HttpClient
import http.client
conn = http.client.HTTPSConnection("api.qatouch.com")
payload = ''
headers = {
'api-token': '**************API TOKEN********************',
'domain': '**************DOMAIN**************************'
}
conn.request("POST", "/api/v1/testRunResults/add/results?status=passed&project=PROJECTID&test_run=TESTRUN&run_result=RESULTID&run_result=RESULTID&comments=API%20Endpoint%20checking×pent=10", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))