Running integration tests remotely with maven - maven

How can I run integration tests on an environment other than the one I'm building (running maven) from? I suppose I should use the failsafe plugin, but how would it find the artifact remotely, run the tests and return results?
Specifically: I want to run my tests on a controlled environment, a docker container, regardless of building from the build server or a dev machine.

Related

How to build Quarkus container based on profile with Gradle?

8.1
I'm able to build my container image with Jib running: ./gradlew clean build -Dquarkus.container-image.build=true
And then I can run it with docker run
The container built is running using the production profile.
I have a separate dev/staging container environment, where I can actually deploy and obviously the configs for passwords and domains are different.
Is there a way to specify the profile during the container build, so for example when it runs it uses the dev profile configurations?
This did the trick:
./gradlew clean build -Dquarkus.container-image.build=true -Dquarkus.profile=dev

Scoping out maven plugin execution depending on environments

I am using the ready-api-maven plugin for executing simple SOAP requests on my codebase which is deployed to a local JBoss server before the execution of the tests.
I am trying to figure out how to "scope out" the steps to deploy to a local JBoss server and run these tests when the build is executing on Jenkins. These tests are meant only for executing on a local system.
I'm quite new to maven and would really appreciate the help. Thank you
You can define it by using profiles. ex. you can specify two profiles: local and ci, in local profile you can specify to run the tests but in ci you can skip them.

Nightwatch integration with Maven

is it possible to include running tests with Nightwatch as part of a Maven build for Java applications? Currently my app completes the build and deploy and then a separate script is fired to run the Nightwatch tests. It would be a big win to wrap the multiple steps up into a single one.
I am using frontend-maven-plugin to run npm commands from maven.

How to test a web application with jUnit/selenium from Jenkins that is deployed outside maven (in this very Jenkins)

I have to test a webapp, that is build with maven from Jenkins as CI. The Jenkins instance deploys the webapp via script as 'post build step' to a test enviroment. After the deployment some integration tests should be fired and the results should go back to the jenkins instance.
I can't let maven itself deploy the webapp and utilize surefire/failsafe, because I am not allowed to do so.
I already have a little java app, that uses Selenium WebDriver to perform JUnit tests. I could run this app as 'post build step' like this:
java -cp /usr/share/java/junit.jar junit.textui.TestRunner [test class name]
but I have no ideas how to include dependecies (probably somehow like this: Selenium Scripts on the command line) and how to get the results back to Jenkins.

How Do I Properly Deploy With An Integration Test Project?

My projects are structured as:
root
common
client
server
test
server and client depend on common. test is a project that contains integration tests and these tests depend on client common and server.
If I add all of these as modules to root, then when I execute mvn deploy on root it will deploy the jars, and then run the integration tests. I only want to hit the deploy phase if my integration tests run successfully.
Is this possible with Maven?
You shouldn't run mvn deploy directly but use the release plugin instead. You have to run
mvn release:prepare release:perform
for doing and deplying a relase. See also this blog post about deploying snapshots.

Resources