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.
Related
I am trying to run my simple login scenario in NetBeans (UI Test) using selenium and Java.
Used BDD Framework and trying to run Junit (Runner) class, but not able to see even run as Junit option in NetBeans.
Excellent if you can help with this.
Regards,
Rajesh Bathula
I am in a project environment where Apache Ant is used exclusively to build, test, and deploy production application. I do not have control or influence over this, and it will not change. (ie. I cannot just switch to SBT for this application.)
I have inherited a Scala 2.9.3 application that I am upgrading to Scala 2.12.4. I'm also adding SBT and IDE (Intelli-J) support for LOCAL development, build, testing purposes.
I have everything working building, testing, running locally using ANT, SBT, and the IDE. I'm using scalatest 2.12.3 for most unit tests. But I've run into a problem trying to integrate the Akka Test Kit : https://doc.akka.io/docs/akka/2.5/testing.html
I am unable to create an Ant taskdef for running the tests.
How do I run unit tests against Akka Actors using Ant?
I can provide source code, as needed.
But I don't know how that will help, so please be specific if you want/need to see something.
Thanks!
I would have added some JUnit tests to an Eclipse project that test functionality on the server to an Eclipse web project.
I can run the web application from inside Eclipse on an external Tomcat server (Run As | Run on Server) and then run the JUnit tests also from inside Eclipse while the first is still up.
I understand that is should be possible to fully automate both steps as one by making use of a Jetty (instead of Tomcat) server that runs inside Eclipse and that could be booted e.g. in #BeforeClass (or earlier).
Does Eclipse support this kind of unit testing out-of-the-box. I am currently using Eclipse Java EE IDE for Web Developers (Version: Kepler Service Release 2).
Eclipse (and any other IDE for that matter) doesn't stop you from doing anything in unit tests. It doesn't really support much, either, which is the core of your problem: Eclipse won't start a server for your unit tests. The same is true for all other IDEs that I know of.
Instead, you need to read up on how to embed Jetty in a Java application (= your unit tests) so the first test can start the server. Use a lazy init pattern for this:
private static JettyManager jetty;
#Before public void startServer() {
if( null == jetty ) {
jetty = new JettyManager();
jetty.start();
}
}
You can use a JVM shutdown hook to cleanly stop the server.
I use the same pattern to create the database which should be used during the tests to make sure it's clean. For this, I embed an H2 database.
If you want more automation, look at Maven. It can run integration tests (including deploying the WAR before starting the tests). See http://www.benoitschweblin.com/2013/03/run-jetty-in-maven-life-cycle.html
With the Maven Cargo plugin, you can deploy to almost every J2EE container.
Or use Jenkins: http://programmaticponderings.wordpress.com/2013/11/13/building-a-deployment-pipeline-using-git-maven-jenkins-and-glassfish-part-2-of-2/
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.
I use Spring Roo to generate getters/setters.
When I update my class under test and then run JUnit tests from Eclipse IDE (STS), it does't see changes I have made.
For example:
java.lang.NoSuchMethodError: com.example.web.forms.UserRegistrationForm_Roo_JavaBean.ajc$interMethodDispatch1$com_datefitting_web_forms_UserRegistrationForm_Roo_JavaBean$com_example_web_forms_UserRegistrationForm$setName(Lcom/datefitting/web/forms/UserRegistrationForm;Ljava/lang/String;)V`
After running roo>perform tests everything runs fine even in IDE. In project settings there is AspectJ builder.
How to run JUnit tests of #RooJavaBean annotated class in IDE, without invoking mvn test or roo>perform tests?
Is the Roo shell open in STS while you are running? In order for your aspects to be recreated based on changes to the target types, the Roo shell must be running in the IDE. If it is running on the command line (from outside the IDE), STS will not be made aware that changes have been made to aspects and it will not be picked up in your project.