I have my junit tests for my spring api project in src/test/java
. For testing the controllers, I have created a package com.example.controller
, inside which I have my karate feature file sample.feature:
Feature: sample
Scenario: Test Create
Given path '/test'
Given url 'https://localhost:8443'
When method GET
Then status 200
Below is my Test class:
package com.example.controller;
import com.intuit.karate.junit5.Karate;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
public class ControllerTest {
@Karate.Test
Karate testSample() {
return Karate.run("sample").relativeTo(getClass());
}
}
For the mentioned setup, I am getting the following error:
org.opentest4j.AssertionFailedError: http call failed after 105 milliseconds for url: https://localhost:8443/test
For execution, I am using mvn clean test -Dtest=ControllerTest
I have karate-core:1.0.1
and karate-junit5:1.0.1
in my pom.xml, along with junit exclusions to the karate package. I want to run the karate feature file while my application is running, similar to how other junits are executed.
Anything which I might be missing / incorrectly configured in such scenario?
Reference link from Karate Project.