Running gauge tests from jar file - getgauge

I am new to gauge testing tool .I have a maven project that consists of specs and step implementations. Mvn package phase does generate a jar file with all the required classes. However I cant figure out how i can run the gauge specs using a Main class in java, such that i can just run the jar file to run the tests. Is this possible?

Unfortunately no, Gauge binary must be installed and available to execute the specs.
As the Gauge binary is not written in java it cannot be bundled in a jar file and invoked from a Main class.
If you'd like to automatically download and use Gauge in a CI/CD environment, try something like https://github.com/maven-download-plugin/maven-download-plugin to download gauge into a convenient location as part of your mvn build itself.
More info about this here

There is a way to do this. You have to package maven and gauge inside the project directory and include them in the jar. In the main method, unzip all files, then run a shell script to export maven and gauge in the project directory to $PATH, then execute mvn gauge:execute as usual. It's a bit of a hack as it extracts everything to the directory in which the jar is located, but it works on RHEL 7 and I haven't managed to find a cleaner method.

Related

Set Glue Code to External Libraries in Cucumber

We have multiple testing repos, and some of the scenarios depend on the steps already created in a separate repo, so I'm trying to build the JAR file and include it in the external libraries of the other repo. Then I define my gluecode in the IntelliJ runner with two separate lines:
com.edge.automation
C:\Users\MY_NAME\.m2\repository\com\reissue-automation\2.0.3-SNAPSHOT\reissue-automation-2.0.3-SNAPSHOT-tests.jar!\com.reissue.automation.stepdefinitions
IntelliJ is able to recognize the Gherkin sentence, but when I run it, it is throwing this exception:
eissueautomationstepdefinitions'
at io.cucumber.core.options.CucumberPropertiesParser.parseAll(CucumberPropertiesParser.java:156)
at io.cucumber.core.options.CucumberPropertiesParser.parse(CucumberPropertiesParser.java:88)
at io.cucumber.core.cli.Main.run(Main.java:48)
at io.cucumber.core.cli.Main.main(Main.java:33)
Does anybody know what this error means or if it's possible to include glue code from external libraries?
I ended up running the following command to copy my dependencies into the target folder which added it to the classpath.
mvn install dependency:copy-dependencies -DskipTests
Then it picked up the glue no problem.
com.edge.automation
com.reissue.automation.stepdefinitions
If anyone has a better solution feel free to post.
May you add the detailed steps on how you accomplish it?
I tried running
mvn install dependency:copy-dependencies -DskipTests
And then running my maven command for running the test cases and not luck.
If you can add your folder structure and how you put it in the glue code of cucumber runner will be appreciated.
Also cucumber version might help.
Thanks

Build binary to generate configuration with Cabal

I need to build an executable to test the environment and generate configuration for the following steps of building process. How can I tell Cabal to build such an executable during the configuration stage and not to install it as a part of the distribution?
Modern cabal now has a setup-depends field that lets you specify custom dependencies to your setup script (see: http://cabal.readthedocs.io/en/latest/developing-packages.html?highlight=setup-depends#custom-setup-scripts)
As such, your setup script can now use whatever libraries you want to import.

Jboss Fuse and Cobertura

I have my application which runs in Jboss Fuse on Linux. I deploy my artifacts as jar files under the /deploy directory. I was planning to make use of Cobertura to get code coverage report after executing my jmeter tests. I instrumented my jars and placed under /deploy. I ran my jmeter tests.
Now I am unable to find the location where .ser file will be present.
I tried searching inside fuse directory.
Can anyone help me in getting Cobertura working with Jboss Fuse?
For most versions of Cobertura, you can add:
-Dnet.sourceforge.cobertura.datafile=<filename>.ser
to the JBoss/JVM startup parameters (e.g. run.conf) to specify explicitly the file where you want the report to be created.
Also, you need to make sure the cobertura.jar itself is present in the classpath if you haven't done so yet.

Adding Jar dependency in gradle custom plugin

Assuming all my Gradle plugin user going to have a MYAPP_HOME sys variable set in there system
in MYAPP_HOME page i have a jar at $MYAPP_HOME/lib/mylib.jar
i am writing my own plugin....
I can find the MYAPP_HOME variable is set and fine the jar exists..
How can i add this jar dependency in my custom gradle plugin... ? when user runs my plugin say compileMyplugin my custom gradle plugin need to set the $MYAPP_HOME/lib/mylib.jar jar as compiler dependent
How to do this any one help me ?
The plugin just needs to do:
project.dependencies {
compile project.files("${System.getenv("MYAPP_HOME")}/lib/mylib.jar"))
}
PS: In general, I wouldn't recommend relying on an environment variable and the availability of a Jar on the local file system. Instead, I'd publish the Jar to an artifact repository or put it under source control.

Would JRebel work with this project setup?

we have a project where we use Maven to deploy to Tomcat on mvn clean install. I'm fairly new to Java development and finding it difficult to continually wait for install to complete to view changes. I use IntelliJ and I think the class files are only created during mvn install in the target directory.
Is it possible to use JRebel so when I save a file in IntelliJ the compiled class updates Tomcat immediately like they show on the JRebel video?
Thanks
IntelliJ saves the file automatically for you. All you need to do is to recompile the changed classes and these will be picked up by JRebel, given you have included rebel.xml configuration file into the deployed archive.

Resources