Can we run karate tests on GraalVM JDK? - spring-boot

I have a REST API running on Springboot 3 and I test it using the karate framework.
As native is a new feature of springboot 3 I tried to run the API on GraalVM.
My app can run but when it comes to running tests I get this error :
java.lang.IllegalArgumentException: Could not find option with name js.ecmascript-version.
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotEngineException.illegalArgument(PolyglotEngineException.java:131)
at org.graalvm.truffle/com.oracle.truffle.polyglot.OptionValuesImpl.failNotFound(OptionValuesImpl.java:274)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotEngineImpl.parseOptions(PolyglotEngineImpl.java:736)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotEngineImpl.<init>(PolyglotEngineImpl.java:313)
at org.graalvm.truffle/com.oracle.truffle.polyglot.PolyglotImpl.buildEngine(PolyglotImpl.java:288)
at org.graalvm.sdk/org.graalvm.polyglot.Engine$Builder.build(Engine.java:625)
I use GraalVM 22.3.0 and karate-junit5 1.1.0 (I also tried more recent versions but it does not work).
Is there a compatibility problem between the Karate framework and the graalVM since the karate core already uses graaljs dependencies ?
Thank you in advance

Yes, can you first try 1.4.0.RC3 and refer this thread - or comment there also with your findings: https://github.com/karatelabs/karate/issues/2148
But if you want to use the GraalVM instead of a normal JVM, I don't think that's supported. But a PR is welcome.

Related

Jmeter cant read custom JAR depedencies

I wrote a Maven application that I want to use in my Jmeter BeanShell script.
The Maven application is using Google Guice 4.2.2 for dependecy injection and it is calling an API at the end (Code needs to perform some other operations before calling the API and that's why I am not using the JMeter Plugin). I am creating the uber JAR (Fat JAR) with maven-shade-plugin. When I run the Jar from the command line the application run successfully!
However, When I load the JAR in my Jmeter test plan and call my application main method in the Jmeter BeanShell I am getting the following error:
java.lang.NoSuchMethodError: com.google.common.base.Preconditions.checkArgument(ZLjava/lang/String;Ljava/lang/Object;)V
at com.google.inject.Key.ensureRetainedAtRuntime(Key.java:341) ~[load-testing.jar:?]
.
.
.
Now lots of other threads mentioned that this can be because of older Google Guava version (20.x older) but from the dependency tree I see the Guava version is 25.1-android and I can run my JAR successfully from the command line!!
Also, I list the classes in the Uber JAR by running jar -tf command and I can see that the com.google.common.base.Preconditions class is there.
I would appreciate it if someone can shed some light on this matter and help me to resolve this?
It seems that your fat-jar contains multiple versions of Guava (which may be caused by the shade-plugin).
Make sure to lock it to single version by using Mavens dependency management in each maven module. (https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Dependency_Management)
The Beanshell itself might be a problem, since JMeter 3.1 it's recommended to use JSR223 Test Elements and Groovy language for scripting, the reasons are in:
Groovy is more "modern" language which supports all modern Java features while with Beanshell you're stuck at Java 1.5 language level (no lambdas, no generics, no multi-catch etc.)
Groovy performance is much better comparing to Beanshell cause Grooovy engine implements Compilable interface and is capable of caching compiled scripts providing performance very close to native Java code
Groovy provides a lot of enhancements on top of standard Java SDK
Check out Apache Groovy - Why and How You Should Use It article for more details.
I have finally cofirmed my comment. The problem was my JAR Guava version was conflicting with Jmeter Guava version (which is 17.0) and Jmeter for some reason is picking up its own Guava version, after downgrading Guice version to 3.0 which does not depend on guava, I successfully ran my JAR through Jmeter.
There is still a mystery on why Jmeter is overriding my JAR Guava version with its own. I will create a ticket with Jmeter in order to find more about this mystery but this change solved my problem

Cannot kotlinc-native compile restful service with Spring

Quick Question: Is it possible to convert a Kotlin + Spring restful web service to a linux native application?
It works properly when run on the JVM, but I get compilation errors when I try to build it using kotlinc-native for linux.
I cannot find any definitive statement about whether I am trying to do something that is unsupported. Am I trying to swim upstream, here?
Thank you for your comments and help!
Mike
Here are some details...
Ubuntu 18.04
Latest versions of stable dependencies
You can not link a jvm library with kotlin-native. You must have a C library to be able to link it or convert the java code to kotlin.
If what you need is a embedded server executable you could check the ktor project.
The project have some client native examples and a embedded native http2-push.

While running the sample test using Bobcat AEM BDD framework , Steps are skipping and browser is also not launching

While running the sample test using Bobcat AEM BDD framework to test author instance of AEM , Steps are skipping and browser is also not launching.
I have included glue in runner and also added required dependency.
I have taken refrence from this site : https://github.com/Cognifide/bobcat-archetype-aem-bdd
Maven : 3.5.2
JDK - 1.8
Also have changed instance and webdriver properties as per instruction given
I am new to Bobcat AEM BDD. Kindly help.
Please find Console Screenshot when I run the test : 1
Regards,
Kaveri

Can we use Karate and Rest-Assured in the same project (with gradle)?

Can we use Karate on a project where we already used Rest-Assured for API tests and Cucumber with java for mobile and web apps. We use gradle.
If yes, how we can manage our folders? Where we have to put our Karate runner class? When I run it, it returns
"14:53:55.230 [main] DEBUG com.intuit.karate.cucumber.CucumberRunner - init test class: class runners.karateTest.TestRunner
No features found at [classpath:features/users/User.feature]
Process finished with exit code 0
Empty test suite."
Yes you can.
Refer to the documentation, it has instructions from Gradle and how to call Karate via a Java API if really needed.
Also see: https://stackoverflow.com/a/65628686/143475

how to register plugins to java registery

How we can register any kind of plugin or java libs to java registry. I want to execute my application in Apache service mix and facing issue of unsupported image type. I have been using TwelveMonkeys libs but still facing same issue. As per Twelvemonkeys guidelines it is said that this TwelveMonkeys plugins are discovered automatically at run time, but its not the case when deploying project into service mix.
Any help would be great and thankful..

Resources