How to run java class as a JUnit test through command line - java

So I am making an eclipse project with cucumber and selenium in order to automate execution of some test cases.I have a runner class,which can be executed as a Junit test and lead to execution of all feature files consecutively.
My question is can I execute this runner class through windows 7 cmd.
The idea is to make a script(cron job/scheduled task) who can trigger tests execution at given time.

Follow this to see how you can schedule it:
http://www.digitalcitizen.life/how-create-task-basic-task-wizard. Not pasting the contents of this article since it contains a lot of images.
In the scheduler, go to the directory, and run mvn test -Dtest=com.package.ClassName

Related

Running TestNG unit test in Eclipse ignores latest changes

I have a maven-based Java project, which contains many unit tests. These unit tests take a long time to execute, so I'm trying to execute only a specific test class via the TestNG Eclipse plugin.
Running the test the first time works as expected, but if I make any changes to the test class and try to re-run it, I get the same result as the previous run. Basically, my changes to the test class are ignored and the test is executed using a previously compiled test class.
The project had several unrelated errors (visible under the Problems view). Once those errors were resolved, the test class was automatically compiled and changes were picked up in subsequent executions of the unit tests.

How can i add junit test for a java program using python for continuous integration in jenkins

Hello everyone I am a grader for a programming language class and i am trying to use jenkins continuous integration for running some junit tests on their code that is pushed to github.
I was able to get all the committed jobs to the jenkins, but can i run a python file in order to push a testing class to their code and then build their projects an get an xml report about their program test...??
Jenkins allows you to run any external command so you can just call your Python script afterwards

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.

how to run playframework FunctionalTest through Eclipse?

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.

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