Search code examples
karatetestrail

How to integrate Testrail with Karate


Is it possible to integrate karate with testrail? I am using below code to call the testrail but not sure how to send the results to testrail for each scenario.

@AfterClass
    public static void after() throws Exception
    {
        APIClient client = new APIClient("http://test.com/testrail");
        client.setUser("test");
        client.setPassword("Password1");
       JSONObject c = (JSONObject) client.sendGet("/get_case/5905");
       System.out.println(c.get("title"));


    }

Solution

  • The version 0.7.0.RC4 of Karate has support for an 'after' hook.

    Refer to this example for details: hooks.feature

    So getting results from Karate is solved using karate.info. How you call TestRail is up to you.