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

What should be url value for the paramter in TestRailService class constuctor?


#1

hi,
I am trying to integrate testrail in my automation framework.
I have got url , username, password from testrail team.
I am using the following code

String username="xyz@sapient.com";
String password="fdhfksdjdflskfljskfbjckljkf";

String projectName=”CATS PROJECT2”;
URL url= new URL("https://vatsal.testrail.net/index.php");

TestRailService testRailService =null;
       testRailService =new TestRailService(url,username,password);

Project project = testRailService.getProjectByName(projectName);  // last line

When I try to run the code
I get this error in last line

Exception in thread “main” java.lang.IllegalArgumentException: Illegal character(s) in message header value: Basic dmt1bWFyMTM5QHNhcGllbnQuY29tOnNFUm9vdEZxNVhxUWlXeEZNV2dN

the url is am giving is the one i got from testrail during the time of registration.

I think i am giving wrong url parameter , can you please suggest me what should be url parameter for testrailservice class ??


#2

Hi Vatsal,

Thank you for your post. I believe you may have submitted a support ticket for this as well. Is this correct?


#3

yes , i have submitted support ticket but I didn’t get the proper answer for that , so i Updated the same here.
Plz help me out


#4

Hi Vatsal,

Thanks for your reply! When specifying your TestRail address, you wouldn’t include the ‘index.php’, and you can just use the base address (e.g. “https://vatsal.testrail.net/”). We also have a basic Java binding that you can use to access TestRail’s API, and you can learn more about this on our website here:

http://docs.gurock.com/testrail-api2/bindings-java

Hope this helps!

Regards,
Marco


#5

hey I already tried with “https://vatsal.testrail.net/”, but it is not accepting it. giving the same exception , as I mentioned before. Plz provide some other solution to achieve the same.
I found that there is one more way like-
TestRailService testRailService =new TestRailService(clientId, username, password);
But I don’t understand what is clientid,
how can I get the clientId ??


How to get clientId in testrail?
#6

I tried with that too , but that did not work.
There is one other way like
TestRailService testRailService =new TestRailService(clientId, username, password);
How to find the clientid?


#7

Hi Vatsal,

Thank you for the update. Could you please take a screenshot of your project so we can see that you have imported the TestRail JAVA binding correctly? The usage of this is pretty straight forward.

import com.gurock.testrail.APIClient;
import com.gurock.testrail.APIException;
import java.util.Map;
import java.util.HashMap;
import org.json.simple.JSONObject;
public class Program
{
public static void main(String[] args) throws Exception
{
APIClient client = new APIClient(“http:///testrail/”);
client.setUser("…");
client.setPassword("…");
}
}

This is the example we provide along with the binding. Keep in mind that there is a dependency on JSON.simple that needs to be added as well:

https://code.google.com/p/json-simple/