question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

karate.options --tags not honored for junit5 parallel runner and errors in other setups

See original GitHub issue

Hello, raising this as requested in https://github.com/intuit/karate/issues/1061

Went through the quickstart guide, added @fast tag to one scenario and renamed ExamplesTest to ExamplesRunner, also introduced ExamplesRunnerParallel, which I hope is the correct setup for the junit5 parallel setup. By the way, I want to use the ExamplesRunnerParallel way, as I want to have the cucumber json created and also have parallel execution.

The code used to produce these results is at: https://github.com/KostasKgr/karate-issues

mvn clean test  -Dkarate.options="--tags @fast" -Dtest=ExamplesRunner
[INFO] Running examples.ExamplesRunner
09:41:50.868 [main] INFO  com.intuit.karate.RunnerOptions - found system property 'karate.options': "--tags @fast"
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.247 s <<< FAILURE! - in examples.ExamplesRunner
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.247 s <<< FAILURE! - in examples.ExamplesRunner
testAll  Time elapsed: 0.246 s  <<< ERROR!

java.nio.file.InvalidPathException: Illegal char <"> at index 9: examples/"--tags.feature
[INFO] 

Using a junit 5 parallel runner does not seem to use the provided options, as both scenarios are run and not only the @fast one

mvn clean test  -Dkarate.options="--tags @fast" -Dtest=ExamplesParallelRunner
feature: classpath:examples/users/users.feature
report: target\surefire-reports\examples.users.users.json
scenarios:  2 | passed:  2 | failed:  0 | time: 1,7175
---------------------------------------------------------
Karate version: 0.9.5
======================================================
elapsed:   2,61 | threads:    1 | thread time: 1,72 
features:     1 | ignored:    0 | efficiency: 0,66
scenarios:    2 | passed:     2 | failed: 0
======================================================

Using 0.9.6.RC2 results in both cases having an error, e.g.:

mvn clean test  -Dkarate.options="--tags @fast" -Dtest=ExamplesParallelRunner
[INFO] Running examples.ExamplesParallelRunner
09:51:29.268 [main] INFO  com.intuit.karate.RunnerOptions - found system property 'karate.options': "--tags @fast"
[ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.248 s <<< FAILURE! - in examples.ExamplesParallelRunner
Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.248 s <<< FAILURE! - in examples.ExamplesParallelRunner
testAll  Time elapsed: 0.244 s  <<< ERROR!

java.nio.file.InvalidPathException: Illegal char <"> at index 0: "--tags
	at examples.ExamplesParallelRunner.testAll(ExamplesParallelRunner.java:13)

Setup was:

  • idea.version2019.3
  • mvn 3.6.1
  • OS name: “windows 10”, version: “10.0”, arch: “amd64”, family: “windows”
  • Java version: 11.0.4, vendor: JetBrains s.r.o, runtime: C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 193.4697.15\jbr (this is what mvn --version reports, not sure what is actually used when running mvn test)
  • Default locale: en_US, platform encoding: UTF-8

Kind regards

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ptrthomascommented, Jun 23, 2020

@KostasKgr good point. don’t get me started on the differences in powershell 😛 I will update the docs now

0reactions
KostasKgrcommented, Jun 23, 2020

Thank you @ptrthomas ! This helped me narrow down and find the issue!

I was running mvn from the Execute maven goal button of intellij. It seems intellij tries to do something smart and ends up passing the " (or ') in the value.

The following worked both in bash and in the intellij execute maven goal button:

mvn clean test  "-Dkarate.options=--tags @fast" -Dtest=ExamplesParallelRunner

It might also solve it for windows, as i was running it inside of intellij there as well.

Not sure if it is worth putting it as such in the documentation, instead of the format with the quotes after the equals (="--tags..."), but leaving it here in case anyone else has the same problem in the future

Cheers!

Read more comments on GitHub >

github_iconTop Results From Across the Web

karate.options --tags not honored for junit5 parallel runner and ...
options --tags not honored for junit5 parallel runner and errors in other setups #1186. Closed. KostasKgr opened this issue on Jun ...
Read more >
Using multiple tags to run in karate options - Stack Overflow
For running tests using tags with multiple conditions, we need to use logic conditions in tags. AND: To run every feature that has...
Read more >
Step-4: Runners and Tags, Parallel Runners, Cucumber ...
Karate provides the parallel execution, and you don't need to do any other setup other than creating one parallel runner. Usually, it is...
Read more >
Karate | Test Automation Made Simple.
Run, JUnit 5 | Command Line | IDE Support | Tags / Grouping | Parallel ... are your tests working fine via the...
Read more >
karate | Junit5 - runner | Parallel Runner | Tags Part 3 - YouTube
How to Use Junit5 to create a parallel runner for running Karate test... ... Other Videos: Karate – API Perf-Testing Made Simple.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found