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

Importing the TestRail API into IntelliJ


#1

Hello all,

I’m currently trying to set up some TestRail customisation with Selenium. To create the Selenium scripts I’ve set up IntelliJ to use the Selenium webdriver, and then using JUnit @Test cases within that. So what I want is to pass the results from each of the @Test cases into TestRail.

However, I’m new to IntelliJ and I’m struggling to work out how to integrate with TestRail, I’ve read the API Binding information on http://docs.gurock.com/testrail-api2/bindings-java but I can’t work out how to import that into IntelliJ.

Is anyone able to help please?


#2

Hello Mark,

Thanks for your posting. We don’t have experience with IntelliJ ourselves but the binding has just a couple of regular .java files so they should be easy to add to your project. I believe you would just need to copy the .java files to your existing project (directory).

Cheers,
Tobias


#3

Hello Tobias,

Thank you for your help, I’ve been able to resolve this perfectly.

Many thanks

Mark


#4

That’s great to hear, Mark, happy to help :slight_smile:

Cheers,
Tobias


#5

Hi Mark,

Can you please tell me, how you manage to fix the TestRail API integration with IntejjIJ ?

Thanks,

Anna


#6

Did you try what was suggested in the second post?


#7

Yes, but with no luck .

This is the testrail code part

@Then("^I will automatically update the result of test case with (.*)$")
public void iWillAutomaticallyUpdateTheResultOfTestCaseWithStatusId(final int status) throws Throwable {

    APIClient client = new APIClient(clientAPI);
    client.setUser(user);
    client.setPassword(psw);
    Map data = new HashMap();
    data.put(status, 3);
    data.put("comment", "Test 1 ");
    JSONObject r = (JSONObject) client.sendPost("add_result/3287", data);

and I’ve got this error
java.net.UnknownHostException: testrail.server_name.com


#8

According to the error it does not know what the host is for Test Rail.

From the link in the first post:

image

The API needs to know where to find the Test Rail host.


#9

I have :
@Before
public void setUp() {
String prop= System.getProperty(“Path”);
properties = new Properties();
try {
properties.load(new FileInputStream(prop));
clientAPI = properties.get(“TestRailAPI”).toString();
} catch (IOException e) {
throw new RuntimeException("Properties file not found: " +prop);
}
} ,

where the test rail host is added in a properties file : http://testrail.server_name.com/testrail/