1

enter image description here

I've built a simple project structure following the documentation https://github.com/karatelabs/karate#folder-structure

runner class:

public class HealthCheckRunner {
    @Karate.Test
    Karate healthCheck(){
        return Karate.run("healthCheck").relativeTo(getClass());
    }
}

output:

java.lang.RuntimeException: not found: steps/healthcheck/healthCheck.feature

Approaches I've tried:

return Karate.run().relativeTo(getClass()); -> org.opentest4j.AssertionFailedError: no features or scenarios found: [classpath:steps/healthcheck]
return Karate.run("healthCheck"); -> org.opentest4j.AssertionFailedError: no features or scenarios found: [healthCheck]
return Karate.run("classpath:steps/healthcheck/healthCheck.feature"); -> java.lang.RuntimeException: not found: steps/healthcheck/healthCheck.feature

I've tried run from Run_Api_Test which is a runner above feature file, got the same results

I can run the feature file directly with intellij cucumber plugin. But not working with junit runner.

my POM:

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.9.0-M1</version>
        </dependency>
        <dependency>
            <groupId>com.intuit.karate</groupId>
            <artifactId>karate-junit5</artifactId>
            <version>1.2.0</version>
        </dependency>
  • my advise is don't try to create a project by hand unless you read the documentation. just use the quickstart: https://github.com/karatelabs/karate#quickstart - and re-use the structure if needed - if still stuck, follow this process: https://github.com/karatelabs/karate/wiki/How-to-Submit-an-Issue – Peter Thomas May 26 '22 at 08:23
  • I'm in a corporate environment and maybe inappropriate to fetch archetype. I've read the documentation and examples, but still got stuck with the simple structure above. – DucanoidYoung May 26 '22 at 08:46
  • cool. the only other suggestion is, use the ZIP release: https://github.com/karatelabs/karate/wiki/ZIP-Release - and also note that the JUnit support is optional, just use the `Runner` API directly and you should be up and runniing: https://stackoverflow.com/a/65578167/143475 – Peter Thomas May 26 '22 at 08:54
  • 2
    Thanks for helping, I managed to use the archetype and found I missed to config my testResources in pom.xml. – DucanoidYoung May 27 '22 at 06:05

1 Answers1

0

In your pom.xml file you should add testResources in build section as an example below:

    <build>
    <testResources>
        <testResource>
            <directory>src/test/java</directory>
            <excludes>
                <exclude>**/*.java</exclude>
            </excludes>
        </testResource>
    </testResources>
BigApp7e
  • 11
  • 1
  • 3
  • 1
    Please add code never as picture, better as text. This allows others to copy your answers more easily. – alea Jun 24 '23 at 07:27