I have to test a web app using Selenium test cases/test suites that will run through Maven. I am new to it all. Can anyone outline the simple basic steps to run my first test successfully? I have everything installed (Eclipse, Maven, Selenium). Thanks.
Might help to see an active example and working integration between jUnit, eclipse, Maven and Selenium.
You can download a working project here
or you can check it out from GitHub from here.
If you read the readme on that project, it states that you can run the tests individually by right clicking the method names, and clicking Run As->jUnit tests or you can run the class suite.
Related
Using the junit runner, is it possible to run geb-spock test like a normal spock tests?
It seems that a stock eclipse installation can't do it and couldn't find any eclipse plugin to add the functionality.
I'm trying this using eclipse-oxygen latest.
To run Geb-Spock tests like a normal Spock test. (I am thinking you mean without initializing a browser.) Just extends Specification instead of extends GebSpec. Spock uses jUnit as the default test runner. So a Eclipse plugin for jUnit should work with Spock.
I have a Junit test suite which depends on around 30 JARs. The Junit source code is on GitHub and I want to trigger the test suite from Jenkins. I can do this by using GitHub plugin. I.e. using Fressstyle project and then selecting source code management as GitHub.
Now my Junit itself depends on around 30 JARs. These are not present on GitHub. So cannot use sub-module option. They reside on our application server.
My question is:- How do I refer these when Junit runs? Should I upload all of these 30 JARs to GitHub (seems incorrect). Is there a way? Thank you.
Use a tool for building your software that handles the dependency management. E.g. Ant with Ivy, Maven or Gradle. Otherwise you have to reinvent the wheel.
I'm trying to run the JHipster application via my Eclipse Juno, using jdk 1.7.
The app seems to be loading properly (no console errors), but when i'm trying to reach the server with the client side (or via Postman, by sending a request to the REST servlets in port 8080), it's not responding.
However, when i'm running "mvn spring-boot:run" in the command shell, the server is loaded successfully and is responding to the exact same requests. Also, I managed to run the same command via eclipse with some maven configuration but it seems to be running only the target files (jars) and not the source code. I still haven't been able to run the source code of this app using eclipse in order to properly debug it.
Any suggestions?
Thanks!
So the answer is quite trivial, but since I spent several hours to reach it, it might save some time for others-
Download & install STS IDE.
Import the project as existing Maven project.
Run/Debug the project.
I tried to run it via Eclipse the whole time (wasn't familiar with STS to be honest) and this probably needs some extra configuration (another comment with explanations on eclipse configuration will be much appreciated). Once you work with STS, it's easy.
You should not need STS, just Eclipse with the J2EE stuff.
I've imported the sample jhipster in Eclipse (without STS) as a Maven project and everything was OK, after installing the maven dependencies.
To run the project, run as an application and search for the Application (com.mycompany.myapp.Application)
This app works for me: https://github.com/jhipster/jhipster-sample-app. It is stuck on Boot RC5 which probably means it's a bit old. Maybe Julien can comment on that (or update it)?
I have, a few JMeter scripts, which make HTTP calls to test my own web service, written in Spring. I would like the JMeter scripts to be automatically executed for every build and test if the build is good. So, as suggested at:- http://ribblescode.wordpress.com/2012/04/16/how-to-run-jmeter-tests-with-maven/ I have set up my Maven .pom files of my Spring web service project to have the Jmeter plugin stuff defined. And, I have added my JMeter scripts to src/test/JMeter. Now, I use Eclipse as my IDE and when I have my project already running on Tomcat from within Eclipse (Run As-> Run on Server) and then do Run As->Maven Install on my project with this setup, it executes the JMeter scripts and works as intended.
However, if my web service is not already running on Tomcat, the Maven build fails as the JMeter is not able to successfully make the HTTP calls.
Now, my problem is that this setup means the JMeter script is actually making calls to the old build which is already running and not on the new build which was generated when I clicked on Run As-> Maven Install at that point in time.
So, given this scenario how do I have it so that, when I make some code change, and then do a new build using Maven, it first deploys it and then runs the JMeter script on this new build?
Maven is not intended to test the Tomcat running in your Eclipse. Jmeter is an integration test tool, so all you have to do is to haang the appropriate plugins on the appropriate maven lifecycle phases. You actions needed:
pre-integration-test phase steps
download and unzip Tomcat
deploy your packaged webapp
start tomcat
integration-test phase step
Download and unzip Jmeter (for example with maven-dependency-plugin)
run jmeter tests
post-integration-test phase
stop tomcat
Thats all you need. One tool to use could be the Cargo Maven Plugin, which helps you in deployment, start and stop.
An example is here http://www.alexecollins.com/content/jmeter-integration-test-template-pom/
If you are interested, it is also possible to collect coverage info for your JMeter tests: http://docs.codehaus.org/display/SONAR/Code+Coverage+by+Integration+Tests+for+Java+Project
I am using Apache Wicket as my web application framework in Eclipse.
Currently I have eCobertura as an eclipse plugin installed.
But it needs a main() method to run. I do not have one.
So how can I run code coverage within a web application?
Regards...
Or you can try out EclEmma, it is available in the Eclipse Marketplace and is really easy to use. It gives you a right click option on your project, package or file: "Coverage -> JUnit test".
I use it with Wicket and you don't need any running server or such to run the tests.