1

I have 2000 repos in my bitbucket which is segregated on 10 projects. Each repo has code which is written in IBM Integration bus/ACE. Means it is not Java application. This will expose a API. We plan to use Karate framework as our continuous testing in Jenkins pipeline.

So I have created one Java project with Runner Java class for POC. This worked!

Public class TestRunner {
     @Karate.Test
     Karate testFullPath(){
         return Karate.run("classpath:mypackage/path/sometest.feature");
         //return Karate.run("file:D:\\some\\path\\sometest.feature");
     }
}

With the plan of keeping this Karate framework Java project in separate repo. Maintaining all the feature files of 2000 in another separate repo for feature file maintainability.

When I try to pass the feature file from external drive like

return Karate.run("file:D:\\some\\path\\sometest.feature"); 

it fails with error message saying "java.nio.file.InvalidPathExceptino: IIlegal char <:> at index 4: file:D:\some\path\sometest.feature" ...

Is it possible to call the feature files which is reside outside of Java project ? Please help me on this.

EDIT : I have tried below 2 options to fix the problem.

  1. I tried to use the Runner by using below snippet. This also returns exacts same error.

@Test
public void testSelected() {
  List < String > tags = Arrays.asList("~@skipme");
  List < String > features = Arrays.asList("file:D:\\some\\path\\sometest.feature");
  String karateOutputPath = "target/surefire-reports";
  Results results = Runner.path(features)
    .tags(tags)
    .outputCucumberJson(true)
    .reportDir(karateOutputPath).parallel(5);
  DemoTestParallel.generateReport(karateOutputPath);
  assertTrue(results.getErrorMessages(), results.getFailCount() == 0);
}
  1. Explored and found the karate netty standalone jar file. Even when I run the jar file using java -jar karate-1.2.0.RC2.jar demoAPI.feature. I am getting error as "Exception in thread main java.lang.NoClassDefFoundError: org/sl4j/LoggerFactory ..."
Simbu
  • 766
  • 1
  • 12
  • 37
  • please see linked answer. also please note that you should use the `Runner` API for running tests in CI (not the JUnit support classes): https://stackoverflow.com/a/65578167/143475 – Peter Thomas Apr 15 '22 at 16:33
  • Thanks for such a quick reply. After exploring, I have used the snippet from this link which is also throws exact same error. Am I missing something. Please help me @PeterThomas - https://github.com/karatelabs/karate/blob/develop/karate-demo/src/test/java/demo/DemoTestSelected.java – Simbu Apr 15 '22 at 18:27
  • I'm sorry I don't understand at all. if you want support, follow this process: https://github.com/karatelabs/karate/wiki/How-to-Submit-an-Issue – Peter Thomas Apr 15 '22 at 18:58
  • Explored the given link and struck with even standalone jar file. Please help me. – Simbu Apr 15 '22 at 19:48
  • sorry I have nothing more to add – Peter Thomas Apr 15 '22 at 19:52
  • Thanks Thomas for your contribution. I have opened the issue in Git for the same. – Simbu Apr 16 '22 at 05:40

0 Answers0