Ask a Question

Integration TestRail and TestComplete

SOLVED
Sundaytwins
Occasional Contributor

Integration TestRail and TestComplete

Hi, Is there anyone who has succesfully integrated the TestRail API into TestComplete?

 

I'm working with the VBScripts in TestComplete, but was not yet able to report my results back to TestRail using the TestRail API.

 

In fact, I'm not even getting close to getting the TestRail API working in my scripts.

 

Thanks in advance!

20 REPLIES 20
Marsha_R
Community Hero

Here's an older discussion that might be helpful

 

https://community.smartbear.com/t5/General-Discussions/TestComplete-integration-with-TestRail/td-p/9...


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
Sundaytwins
Occasional Contributor

Hi Marsha, 

 

Thanks for your reply. I already checked out that message post.

It did not bring any light into the problem 😉

 

 

Marsha_R
Community Hero

Okay, can you show us some of your code?   What happens when you try the integration?


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
Sundaytwins
Occasional Contributor

Hi Marsha,

 

This is the piece of code i tried to start with:

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

The response is:

HTTP/1.1 401 Unauthorized
Content-Type: application/json; charset=utf-8
Date: Thu, 16 Jun 2016 06:45:46 GMT
Server: Apache
Set-Cookie: tr_rememberme=deleted; expires=Thu, 01-Jan-1970 00:00:01 GMT; Max-Age=0
Content-Length: 87
Connection: keep-alive

{"error":"Authentication failed: invalid or missing user\/password or session cookie."}

I'm pretty sure the user/password is ok 😉

 

Thanks for helping!

Okay @TanyaYatskovska who is the TestRail expert?   Smiley Very Happy


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
HKosova
SmartBear Alumni (Retired)

I'm not a TestRails expert, but try passing the login/password in the Authorization header:

 

Dim o, user, password

user = "user" password = "password"
Set o = Sys.OleObject("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", "Basic " & Base64Encode(user & ":" & password) o.send Log.Message(o.status)

The code of the Base64Encode function is in this post on Stack Overflow.

 

UPD: fixed typos in the example


Helen Kosova
SmartBear Documentation Team Lead
________________________
Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️
Sundaytwins
Occasional Contributor

Hi Helen, 

 

The code snippet you sent is giving an VBScript error on 

 

Base64Encode(user + ":" password)

The base64Encode is expecting another type of variable.... (types don't match)

 

Thanks for helping!

 

 

Sundaytwins
Occasional Contributor

Hi Helen, 

 

You brought me on the right track. He doesn't understand the "+", he needs a "&"

 

I got this working: 

 

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

Thanks for your help. Now next step: getting things to read the JSON and POST stuf to TestRail....

I have log message as 200. Success. But the application is not opened. Please let me know how to proceed after that

With Regards
Vallalarasu Pandiyan
https://www.linkedin.com/in/vallalarasupandiyan/
cancel
Showing results for 
Search instead for 
Did you mean: