Open abdallah-rashwan opened 5 months ago
Same issue here, with Quarkus 3.11.2
.
A small Maven reproducer might help.
Ok, so that's what I found.I don't expect any real answer : I'm just writting my search :)
Here's the project holding a small demo: https://github.com/jamailun/karate-quarkus.
It will work on Quarkus 3.8.2
: the demo feature will run properly.
3.8.3+
From the version 3.8.3 (and commit #39442) sdk-graal has been excluded.
So when launching the test, we obtain a :
java.lang.NoClassDefFoundError: org/graalvm/polyglot/Value
sdk-graal
(you can skip this one)By adding the graal-sdk (and decommenting the block on line 69 of my demo), you'll have a new exception:
ServiceConfiguration org.graalvm.polyglot.impl.AbstractPolyglotImpl: com.oracle.truffle.polyglot.PolyglotImpl not a subtype
.
Same for previous versions.
I discovered that from 23.1.0
onward, developpers should import Graal SDK differently.
By recommenting the previous block and importing only the org.graalvm.polyglot.polyglot:24.0.1
(decomment block line 77 on my pom.xml) now everything will compile... but the tests won't be found. Even with debug mode, Karate just doesn't find the .feature
anymore.
FooUnitTests.testAllUnitTests no features or scenarios found: [classpath:org/jamailun]
And now I don't really know where to look. We'd like to keep our karate tests (we do have a lot of them) so any help would be gladly received.
Bump ?
Hello, same issue here, with Quarkus 3.13.2.
Bump again.
@jamailun You should use the new version of karate-junit5
, they changed the group-id to io.karatelabs
, see the new version: Release note of Karate-JUnit5 1.5.0
@Lmbwilly I've checked it with latest release of Quarkus. Now, we don't have errors but Karate cannot find any tests.
I've updated my reproducer.
Just to insist : the tests do work well with Quarkus 3.8.2 and Karate 1.4.1.
@jamailun I've checked your reproducer and I only changed the call of the runner to return Karate.run("classpath:org/jamailun/00.hello-world.feature");
and then it worked.
And I know with 3.8.2 all worked fine, I had the same problem as you.
@Lmbwilly You did ? Didn't you also add to add the -Dpolyglotimpl.DisableVersionChecks=true
argument ? I don't know why, but with this setup, the dependency:tree
shows :
...
[INFO] \- io.karatelabs:karate-junit5:jar:1.5.0:test
[INFO] +- io.karatelabs:karate-core:jar:1.5.0:test
[INFO] | +- org.graalvm.js:js-scriptengine:jar:24.0.0:test
[INFO] | | \- org.graalvm.polyglot:polyglot:jar:24.0.0:test
[INFO] | | \- org.graalvm.sdk:collections:jar:24.0.0:test
[INFO] | +- org.graalvm.js:js-language:jar:23.1.2:test
[INFO] | | +- org.graalvm.regex:regex:jar:23.1.2:test
[INFO] | | +- org.graalvm.truffle:truffle-api:jar:23.1.2:test
[INFO] | | \- org.graalvm.shadowed:icu4j:jar:23.1.2:test
...
So Truffle and Polyglot do not have the same verion in karate 1.5.0 🤔 It's not that bad, but I still find it sad to be obligated of using a specific environment variable. And without it, Truffle will refuse to execute the Karate test.
#relativeTo()
For anyone looking for a way to make the Karate#relativeTo(Class<?>)
work again, this is an equivalent I've made using Reflections 0.9.9-RC1 :
// Put this somewhere
public static String[] allFeaturesRelativeTo(Class<?> clazz) {
Reflections reflections = new Reflections(clazz.getPackageName(), new ResourcesScanner());
return reflections.getResources(Pattern.compile(".*\\.feature")).stream()
.map(r -> "classpath:" + r)
.toArray(String[]::new);
}
// So the test method can be :
@Karate.Test
Karate testAllUnitTests() {
return Karate.run(allFeaturesRelativeTo(getClass()))
.tags("@foo");
}
Describe the bug
Using Karate for int testing, getting the below error when trying to run tests using `
java.lang.NoClassDefFoundError: org/graalvm/polyglot/Value at com.intuit.karate.core.Variable.<init>(Variable.java:72) at com.intuit.karate.core.Variable.<clinit>(Variable.java:66) at com.intuit.karate.core.Config.<init>(Config.java:94) at com.intuit.karate.core.ScenarioCall.getParentConfig(ScenarioCall.java:67) at com.intuit.karate.core.ScenarioRuntime.<init>(ScenarioRuntime.java:74) at com.intuit.karate.core.ScenarioIterator.tryAdvance(ScenarioIterator.java:162) at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.lambda$initPartialTraversalState$0(StreamSpliterators.java:292) at java.base/java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.fillBuffer(StreamSpliterators.java:206) at java.base/java.util.stream.StreamSpliterators$AbstractWrappingSpliterator.doAdvance(StreamSpliterators.java:161) at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.tryAdvance(StreamSpliterators.java:298) at java.base/java.util.Spliterators$1Adapter.hasNext(Spliterators.java:681) at com.intuit.karate.junit5.FeatureNode.hasNext(FeatureNode.java:63) at com.intuit.karate.junit5.Karate.iterator(Karate.java:65) at java.base/java.lang.Iterable.spliterator(Iterable.java:101) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511) at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
I managed to overcome this by adding
graal-sdk 22.3.3
manually to be compatible with Truffle.found this `
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
com.intuit.karate karate-junit5-1.4.1
Output of
uname -a
orver
No response
Output of
java -version
No response
Quarkus version or git rev
No response
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
No response