Skip to content

Tag: karate

Karate ReferenceError: package is not defined

I’m using java codes in karate feature file, refering github demo: I noticed that the feature file is in src/test/java, which defined as classpath in pom.xml. Meanwhile the util class is in src/main/java. In my project I use similar structure Following code is in the feature file with Class Reference: But I got an exception below: Is it a classpath

Karate: runners class with JUnit5

sorry for the naive question: What are the references to “sample” and “tags” in the example documentation that explains the configuration of tests with Junit5? Are these features? Thanks Answer Yes, it tries to be more concise instead of sample.feature etc. Refer the docs:

How to run Karate tests using maven with dynamic tags

I want to execute Karate tests using maven and pass the tags dynamically to the execution. I’m using junit4 and i tried both of the approaches – parallel and simple with @RunWith annotation. @RunWith Using this approach I’m able to pass the tags to the execution dynamically, but if the karate test fails the maven build is still successful. Parallel

How to access Karate config parameters in JUnit tests?

Is there a way to access the config parameters from karate-config.js within JUnit tests? Example: karate-config.js Answer But why !? There are multiple ways, but first – maybe you are over-engineering things and note that it is possible to read a *.properties file in Karate: properties.feature You can also create a feature file with a single, empty Scenario –

Karate karate-config.js not a js function

I’m trying use karate for e2e tests and have started with a minimal setup. I want to create some config items in karate-config.js for use in the tests but karate is reporting that file is not a js function and hence the test fails trying to get the config: This is my karate-config.js: This is my insurer.feature test: This is