Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

Integration of TestRail from within TestComplete


#1

Hi There,

I’m trying to get the results from my automated tests in TestComplete (Smartbear) transferred to TestRail.

Although there is an API, i’m getting stuck, cause the TestComplete Tool does only understand pls files.

I tried the following script:

Sub TRCom()

  Dim o
  Set o = CreateObject("MSXML2.XMLHTTP")
  o.open "GET","https://site.testrail.net/index.php?/api/v2/get_case/6",False,"user","password"
  o.setRequestHeader "Content-Type", "application/json" 
  o.send
  log.message(o.status)
  
End sub

But I’m running into a 401 error. I’m pretty sure that user and password are ok.

Is there any other way addressing TestRail via VBScript?

Thanks in advance!


#2

I got it talking with this version: now up to next challenge: reading the json…

Sub TRCom2()

Dim o, TCuser, TCpassword, TClogin, TCpassphrase

TCuser = "user"
TCpassword = "password"
TClogin = TCuser&":"&TCpassword
TCpassphrase = "Basic " & Base64Encode(TClogin)

Set o = CreateObject("MSXML2.XMLHTTP")
o.open "GET","https://site.testrail.net/index.php?/api/v2/get_case/1", False
o.setRequestHeader "Content-Type", "application/json" 
o.setRequestHeader "Authorization", TCpassphrase
o.send
Log.Message(o.status)

End sub

The Base64Encode and Decode can be found here: http://stackoverflow.com/a/506992


#3

Hi Dominic,

Thanks for your posting and sharing this, that’s appreciated. VBS is quite old so there’s no official JSON support I believe but the following topic looks good as a starting point:

http://stackoverflow.com/questions/12153925/decode-encode-json-with-vbscript

Cheers,
Tobias