how to run playframework FunctionalTest through Eclipse? - java

and the second question:
is it possible to run them all in a bunch through Eclipse?

One approach could be, Install 'antify' module and run 'play antify' on your application. It will create a build.xml for your app (which would import the needed targets from application-build.xml file) and run 'auto-test' from eclipse.

FunctionalTest and UnitTest extend BaseTest, which is annotated with the PlayJunit4TestRunner, so you should find that you can just run tests as you would with any other test (i.e. Run As > Junit Test). You'll see the Play environment being initialised on the console before the tests actually run.
One problem I've found is that running a whole package of Play tests in Eclipse is buggy, so I tend to just run one at a time in Eclipse and then use Play's own testrunner to verify the whole suite.

Related

How to enable processfork for unit tests in Gradle Android plugin

I have configured unit testing for AndroidStudio as described on the Android documentation (http://tools.android.com/tech-docs/unit-testing-support).
I would like to run every test method in its own JVM, so all static properties in my project are set back to their default values.
I couldn't find anything about this in the documentation and I'm afraid this is not possible yet.
I'm running my tests from the command line (gradlew --daemon test) as I didn't get the testrunner in Android Studio to work.
Does anyone know how to fork every testmethod in its own jvm process, so they run 'standalone'? Please let me know if this is possible or if there are alternative ways to run every testmethod in it's own process using gradle.
Thats easy. In your test task set
forkEvery 1
That will cause a new jvm to be forked for every single test.

Where is Junit's Tools-> create unit test in NB 7.3.1

I have recently installed NB 7.3.1, and installed the JUnit plugin. In the old days, JUnit was bundled with NetBeans. I used it all that time.
I want to use it now, but I can't find any command, button, tool, etc to cause Netbeans to create the shell unit tests for me.
What am I doing wrong? How do I find it?
Thx
Make sure you have a test folder. Go to your project properties, and under Sources, in Test Package Folders, make sure you have at least one folder where you want to put your test sources.
If the button is still greyed out after that, you can go to File > New File > Unit Tests > JUnit Test. If it gives you an error message, it may help you solve the problem.

Adding Spock tests to Java project in Intellij

I have an existing Java project set up in Intellij 12 and am attempting to add some Groovy classes to it. I've started with attempting to add a simple Spock class for testing purposes, but when I right-click on the class it does not give me an option to run it.
I've taken a look at my Intellij configuration and it pulls in groovy correctly. Further, I can write a Groovy script that uses a Groovy class and that runs without problems so it appears that Groovy is wired in. Is there something else I need to configure to specifically run Spock tests?
Easiest way to get spock and all dependencies is add library from maven.
Then, you should place your test in a folder, marked as test folder, if you want to allow batch processing of them.
If you place your script in folder, not marked as test, or source folder, you will be unable to run it.
If you can't see run button, it looks like Idea cannot recognise file as runnable, it isn't under source/test root, or it's extension is invalid.
You can add Spock plugin by:
Downloading the jar
In IDEA File->Settings->Plugins->Install from disk. Choose the jar.
I was having the same issue and ended up here. I found that I had forgotten to extend spock.lang.Specification. As soon as I did, the Run option showed up.
Just posting in case it helps any other Spock novices like myself.

Is it possible to run Eclipse application and Junit plug-in test simultaneously?

I have an eclipse application, where in i can create projects and perform some operations. I have written a test cases using Junit for some functions. To run these test functions, i am doing Right click on test class and Run as Junit Plug-in test and it is working properly. I am unable to do both the things at the same time. What i need is to run my eclipse application and Junit plug-in test simultaneously without human intervention. Junit plug-in test has to be done at run time. If there is a way to do that, then please suggest me the solution.
When you run it as Junit plugin test, then it already launches your eclipse plugins (and application), so there is absolutely no need to try to launch an additional application.
What probably confuses you, is that the test run and the "normal" manual run use two different workspaces. So if you try to access some files in your test which you created during normal operation, they will not exist. But you should never rely on such things, instead you have to create the necessary artifacts in the test setup method.

JUnit Tests - Is a call to JUnitCore.main() necessary?

Good afternoon,
I am running some JUnit tests on my application using ant. In doing so I am following the instructions in the step-by-step Spring-MVC tutorial. [*]
The instructions never mention a call to org.junit.runner.JUnitCore.main() in running a test. My question is, is it necessary to call org.junit.runner.JUnitCore.main to run a test if you are running the tests through command-line ant (as opposed to an IDE)? Or is ant smart enough to locate all the methods in a TestCase subclass and run all of them without an explicit call to JUnitCore.main()?
[*] http://static.springsource.org/docs/Spring-MVC-step-by-step/part3.html
Thanks,
ktm
Ant knows what to do. As long as you're using the right ant-task for that (like jUnit task: http://ant.apache.org/manual/Tasks/junit.html).

Categories

Resources