1

Background:

I'd like to build an http API service to get my specific cases called. So, I need to write a controller method to call feature files.

Issue I can call the feature successfully within the src/test/java folder.

However, it throws an exception "not found: com/example/springboot/e2e/from-java.feature", when I write the same code under src/test/java folder.

code under src/test/java folder, it works

@Test
    public void testCallingClasspathFeatureFromJava() {
        Map<String, Object> args = new HashMap();
        args.put("name", "World");
        Map<String, Object> result = Runner.runFeature("classpath:com/example/springboot/e2e/from-java.feature",args,true);
        assertEquals("Hello World", result.get("greeting"));
    }

code under src/test/main folder, it failed exception: "not found com/example/springboot/e2e/from-java.feature" **

public class FeatureCaseRunner {
    public static void main(String[] args) {
        Map<String, Object> params = new HashMap();
        params.put("name", "World");
        Map<String, Object> result = Runner.runFeature("classpath:com/example/springboot/e2e/from-java.feature",params,true);
        assertEquals("Hello World", result.get("greeting"));
    }
}
Bitlin Chen
  • 179
  • 8
  • this is not something we directly support. it depends a lot on how good you are at Java and getting things to work from a web-app embedding karate. if the linked question does not help, please assume that karate does not support this. you are welcome to contribute code of course - as it is an open-source project – Peter Thomas Feb 26 '21 at 04:11

0 Answers0