Is it possible to use maven only for running selenium plugin? - java

Our pom.xml currently contains both the build settings, as well as execution of selenium using selenium-maven-plugin.
I would like to split it in to two pom files, one for the build and unit tests and the second one for executing selenium tests. (This way I could first build the project in Hudson, and after successful build execute Selenium tests using another project).
Is it possible to configure maven to only execute the selenium-maven-plugin?

The answer is yes. Put your functional (selenium) tests in a dedicated module with a dependency on the webapp.

Related

Executing SoapUI tests in parallel by Maven

Does anybody knows if it's possible to execute SoapUI tests in parallel by Maven? I have a lot of soap tests in my project, it would be great to run them in parallel on Jenkins.
In your project turn on parallel test execution. Official documentation is available.
In your Maven, configure the soapui-maven-plugin. Official documentation is available. Same configuration is for Maven 3 as well.
Yes it is possible to run SoapUI tests in parallel by Maven. You need to have the Maven 2 or above version of plugin to able to run SoapUI tests in parallel with Maven.
Please add the Maven repository to your project or Settings XML file before doing you parallel execution.

What is the process with Maven project to compile and test the code?

I have maven project imported in my eclipse. Now I need to start making changes to it and test it with the integration test (out of App server). Currently, the integration test is run out of server using openEJB container.
My basic question is, what is the regular process to compile, build and test with Maven?
mvn install
Maven -> Update Project.
Run my test from command line
Is it how it is done? I am specifically interested in knowing mvn install commands.
So should I do all three steps before I can test it?
Example: I just wanted to print something and see what is the output. For this I guess I need to do all these steps?
The openEJB container needs classes so it can load them.
There is a wonderful Maven quick-reference sheet at http://maven.apache.org/guides/MavenQuickReferenceCard.pdf
First, you should be aware that unit tests and integration tests are separate and are run from separate plugins and at separate parts of the maven lifecycles. Unit tests are run with surefire and integration tests are run with failsafe.
You want to run integration tests and the failsafe documentation says:
NOTE: when running integration tests, you should invoke maven with the (shorter to type too)
mvn verify
rather than trying to invoke the integration-test phase directly...
This is the best way to run integration tests directly in maven. It will run all the preceding steps necessary (eg: compile) in order to run the integration tests. It won't waste time doing an install because install happens immediately after verify.
But if you're running the tests locally, it may be a better idea to run your integration tests directly in your IDE. That will give you a much faster feedback loop.
If it is Eclipse project the most reasonable thing is to do everything not from command line but from Eclipse. Assuming you have m2e plugin installed, go to your_project->run as->Maven test and run it.
You dont need neither install nor package phase to run Maven tests, package will create a jar which is not needed for tests, install will copy this jar to local repo which is also useless. When Maven run tests it uses compiled classes from target dir and ignores project's jar if even it exists.
Yes, mvn isntall is the most popular option. It compiles, packages and tests your project.

How to run unit tests in multi-module maven setup if i put the tests in a separate module?

i have created a multi-module maven project and i am trying to write and execute some tests on specific modules. I am trying to put all test-code into a separate module, but i am wondering if this is the correct way and if so how to i setup the maven build/test cycle so mvn install will use these tests?
According to the Maven Standard Directory Layout test classes belong to the directory src/test/java and required resources to src/test/resources. On the long term it will make your life easier by following the rules, especially when you work on many different projects (where you sometimes can not define alternative structures). In this setup the test cases are automatically invoked by mvn install or mvn test.
You find more informations about the surefire-plugin (responsible for executing the tests) here.

Structuring Selenium RC within a two-war project?

I have a project which needs to deploy multiple wars on a tomcat instance. My first thought for structuring selenium is to create a downstream jenkins build that runs selenium tests against some fixed selenium server, which is pushed with new wars when any of the two war projects build.
Within the jenkins ecosystem, what's the best way to run through a series of selenium tests with the selenium test runner on a remote machine? Given lack of resources, it might be easiest if the selenium test runner exists on the selenium test server.
Jenkins can be configured to build multiple projects at once. What you could do is have a super build poll SCM for all projects, push them to the functional (selenium) test server, then run selenium tests from some main project or an independent project on its own, using whatever runner method you prefer.
Track another repository url
and
Add Build Step
will be your two most used tools here.

How to get Hudson to show complete selenium report?

Our Hudson installation shows a very spartan version of the Selenium report:
Selenium Report Result
numTestPasses 2
numTestFailures 0
I've understood that it should be possible to view full reports via Hudson, and also track development of the tests. But how?
We configured Hudson to run Selenium through an Ant task. Then we added a post-build action to "Publish JUnit test result report." With this setup we can see each failed test name along with how long each test took and the ability to drill down into all the tests to see specifics.
You may be able to just add that post build action to your project using the Selenium plugin.
Not sure if this fits in your environment: I'm running selenium-rc via JUnit (and phpunit) test cases using ant in a Hudson freestyle Project.
Hudson collects and publishes JUnit and via xUnit Plugin various other test results in an optional post build step.
Maybe you just need to find out where the build process stores the actual xml report and instruct hudson to publish it?
I run Selenium tests in Hudson using this plugin. It runs my Selenium tests and publishes detailed test reports. Very easy to configure, maybe not perfect if you have a lot of test suites to execute.
We use the SeleniumHQ plugin. The results are saved in the workspace (this is done in the project config by using "Publish Selenium Report"). You can save the build reports by using "Archive the artifacts" in project config.
We have written the Selenium tests as normal JUnit tests, which gets executed with the rest of the tests, so the reports are embeded i the junit test report generated by hudson.

Categories