Quickstart, karate-archetype. Getting an error when running UsersRunner.java using Karate Runner

Viewed 199

In the default karate-archetype and using Karate Runner on VSCode in Windows. I was getting an error when running UsersRunner.java

java.lang.RuntimeException: not found: examples/users/c:\karatedemo\myproject\src\test\java\examples\users\users.feature

with

class UsersRunner {

@Karate.Test
Karate testUsers() {
    return Karate.run("users").relativeTo(getClass());
}    

However, I resolved it by using return Karate.run("classpath:examples") instead. Why is that? It may be pretty basic, but I'm quite new to this so thanks for the help in advance...

1 Answers

It can be a bug, or that the @Karate.Test annotation is designed for Java IDE-s and not really VS Code, which can directly run feature files without a JUnit runner.

As you already figured out, you can change the UsersRunner code:

return Karate.run("classpath:examples/users.feature");
Related