Ashu
Ashu

Reputation: 107

karate.callSingle getting call twice for two tests

I am trying to integrate karate in my project for integration testing. I was trying to use karate.callSingle() to fetch authorization headers.

I have two tests

    @Test
    void test1() {
        Results results = Runner.path("classpath:integrationTests/test1.feature").parallel(2);
        assertEquals(0, results.getFailCount(), results.getErrorMessages());

    }

    @Test
    void test2 {
        Results results = Runner.path("classpath:integrationTests/test2.feature").parallel(1);
        assertEquals(0, results.getFailCount(), results.getErrorMessages());

    }

Now the test1.feature has two scenarios and test2.feature has one scenario. The tests are running fine just that in the logs I see karate.callSingle is executed twice...for both tests. Is this the expected behaviour?

Upvotes: 1

Views: 188

Answers (1)

Peter Thomas
Peter Thomas

Reputation: 58058

Yes thats the expected behavior. karate.callSingle() is scoped to a single instance of a Runner.

Upvotes: 1

Related Questions