trial999
trial999

Reputation: 1716

Running gauge tests from jar file

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?

Upvotes: 1

Views: 801

Answers (2)

mbj
mbj

Reputation: 107

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.

Upvotes: 0

Zabil
Zabil

Reputation: 81

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

Upvotes: 0

Related Questions