VSCode's built in runner or Code runner extension - vscode-extensions

I saw the Code runner extension but I don't what's the difference between the extension and the built in runner of VSCode. Which one should I use?
I haven't tried the extension yet. Should I try it?

Related

How to set up JetBrains IDE to run Stencil e2e tests?

We're developing a design system with Stencil. We are now writing e2e tests as described in Stencil docs.
There is shared VS Code config which allows to run the tests with Visual Studio Code, but we're using JetBrains IDEs (IntelliJ IDEA and WebStorm) and it is not obvious how to set up tests to run them with IDE interface.
Did anyone managed to set up them in JetBrains IDEs?
You can try using the Node.js run configuration with similar setup: specify the project root folder as a Working directory, path/to/node_modules/.bin/stencil as JavaScript file, add test --e2e $FilePath$ to Application parameters

Cucumber kotlin : IllegalStateException when launching test via Intellij

I am trying to launch a cucumber (written in kotlin) via intellij.
I have a step definition class described as followed :
When I launch the test from Intellij, I have this Exception on the "Given" method: java.lang.IllegalStateException: Could resolve the return type of the lambda at BusinessEventSteps.kt:19
When using "mvn clean install" from a command line, the test runs fine.
My environment:
MacOS
Coretto 11.0.11
Intellij 2021.1.1
Kotlin 1.4.10
cucumber 6.10.4
Found a workaround.
It seems that the issue has something to do with the native Intellij compiler. Editing the Run/Debug Configurations and replacing the default "Build" step by a maven goal, everything works fine.
Hope this will help others !

Run Gatling tests with karate.jar

I would like to run Gatling tests (like provided in this repo) using the all-in-one jar file of Karate. I am stuck with how to do that.
Would you be able to give me a hint on how to get started here?
Gatling is not supported using the JAR. You have to have a Maven project. Here is an example: https://github.com/ptrthomas/karate-gatling-demo

Build selenium-server-standalone executable jar

I did a patch in the HtmlUnitDriver.java file, as explained here:
Is it possible to ignore JavaScript exceptions when working with WebDriver (HtmlUnit, Ruby bindings)
I've followed the explanations on the selenium build wiki and in the readme, also the tip given here:
Building the Selenium Server Project
Still, I don't have a jar file like selenium-server-standalone-2.25.0.jar which can be run and used as a headless browser for selenium tests.
... So I'm trying to recreate the selenium-server-standalone-2.xx.jar file with my patch, and use it to run my headless tests.
Can anyone explain to me how to do this? Thanks!
The best way I found is to do:
go //java/server/src/org/openqa/selenium/remote/server:server:uber //java/client/src/org/openqa/selenium:client-combined:uber
This will create a single jar for the selenium server
Then run go release.
The resulting .jar should be found in build\dist folder of the selenium source folder. (ex. ./build/java/server/src/org/openqa/grid/selenium/selenium-standalone.jar)
See also https://github.com/SeleniumHQ/selenium/wiki/Building-WebDriver#tips.
Here is a step by step building guide for selenium standalone server. The build process of selenium projects may be not so strait forward to newbies, so I recommend this detailed guide on how to create a runnable standalone jar.
http://shengwangi.blogspot.com/2014/08/how-to-build-selenium-from-source.html
Also you can refer to the official document on build selenium.
https://code.google.com/p/selenium/wiki/BuildingWebDriver#Building_Selenium_Server

Using Jython with Maven

I have a Maven module, that depends on various other Maven dependencies by which I am accessing through my jython code.
I am now done, and I would like to compile the project as a .jar, or even just run it without compiling, but I have no clue where to start.
Does anyone have any idea how I can run some .py files that accesses some Java libraries in other packages?
Also, how can I compile it as a .jar file when all is done and good?
Thanks!
Compiling and integrating python
Use the jython-compile-maven-plugin. It allows you to deploy a standalone project that includes jython with libraries.
For demonstration of this plugin, see the demo project and its source code. It shows how to
launch a python console -- look at AbstractInitJython and InitJython on how to launch a python/jython console, how to execute python code snippets, and how to run a python script.
include python libraries -- the plugin also downloads and bundles python libraries (using easy_install) in the package phase, and adds them to the jar. The resulting jar can have all the libraries of the project, all pom dependencies and all the python libraries requested. The demo project shows this with the "nose" python library (see the pom file).
Testing python / jython code
The python-test-maven-plugin allows you to run your python tests alongside the normal junit tests. The demo project (look at the source at source code) shows the use of standard python unit tests (with nose) and BDD (behaviour testing) with the lettuce-clone freshen.
The sourceforge umbrella project is http://mavenjython.sourceforge.net/
Unlike maven-jython-plugin, they don't use the outdated jythonc compiler.
I am now done, and I would like to compile the project as a .jar,
It looks like there is a maven-jython-plugin allowing to compile jython source files to Java class files.
I've kinda figured out my answer to this. I shouldn't have tried to compile it, but instead wrap the python code with Java: http://jythonpodcast.hostjava.net/jythonbook/en/1.0/JythonAndJavaIntegration.html#using-jython-within-java-applications
The compiler portion of jython, jythonc, is deprecated as of 2.5 -- http://wiki.python.org/jython/ReplaceJythonc -- a replacement is in the works.