Run Test Suite in Play 1.2.4 - junit

I am unable to run JUnit test suites in 1.2.4 since the command play test-only is not available. Please respond to the same in case there can be a fix for it without upgrading to higher versions of Play.

You can run your tests using the command:
play test
More information can be found here: http://www.playframework.com/documentation/1.2.4/test

Run your app in test mode:
play test
Then open the following URL:
http://localhost:9000/#tests
You'll be able to all, or individual, test classes to run. Unfortunately there's no way to run an individual test.

IDE:
If you are using an ide like eclipse you can run your junit tests from within the ide.
Command Line:
There are also the following two options for the command line:
Option 1:
play test
This runs the app in test mode. You can then run all tests via a browser interface available at:
http://localhost:9000/#tests (or your custom port if you changed it)
Option 2:
play auto-test
Runs the tests automatically without opening the browser.

Try using testOnly as the command, instead of test-only.

Related

2 variants for JUnit execution: TestRunner & JUnitCore

There seem to be two approaches for invoking JUnit tests from the OS command shell:
java junit.textui.TestRunner <class-name>
and
java org.junit.runner.JUnitCore <class-name>
When do we use one versus the other?
Also, are there other ways to invoke Junit tests from the OS command shell?
JUnitCore is an entry point of JUnit - so if you want to run a test programmatically or of from some non-java script, I think, its the way to go for JUnit 4.
TestRunner is something a very old junit 3.x
Notice, that nowadays JUnit 5 is the latest available major release and it has yet another way to run the tests.
The question about different ways of running the tests from command line has been already answered Here so I can't add much to this.
However, I can comment on:
Also, are there other ways to invoke Junit tests from the OS command shell?
Nowadays in regular projects people do not run tests like this, instead they use one of build tools (Maven, Gradle for example) that among other things take care of tests.
So for example if you use maven, you can run mvn test and it will compile everything you need, including source code of tests, will take care about all test dependencies and will run all the tests with the help of build-in surefire plugin.
If you don't want to compile anything (assuming that all the code has been already compiled and all is set, you can use mvn surefire:test)
These build tools are also integrated with CI tools (like Jenkins, etc.) So this is considered to be a solved problem.
So unless you're doing something really different (like writing the IDE UI that should run test selected by user on demand or something) there is no really need to run tests with the options you've mentioned.

Running unit tests with Codeception in Yii2 project

Trying to setup remote Codeception Unit Tests in PhpStorm in a Yii2 project.
Using SSH I can log into the server go to the root directory of my Yii2 project and run :
> vendor/bin/codecept run unit
and the tests run.
I'm trying run these remote tests via PhpStorm, I've setup a Remote PHP CLI interpreter and I'm pointing to the Codeception library in my Yii2 project folder:
/var/www/vhosts/mydomain.com/httpdocs/yii2/vendor/bin/codecept
Test Runner points to:
/var/www/vhosts/mydomain.com/httpdocs/yii2/codeception.yml
Trying to run the tests the following command is executed:
> ssh://user#mydomain.com:22/opt/plesk/php/5.6/bin/php /root/.phpstorm_helpers/phpunit.php --no-configuration /var/www/vhosts/mydomain.com/httpdocs/yii2/tests
The process fails at it complains that it cannot find PHPUnit:
Process finished with exit code 1
Cannot find PHPUnit in include path (.:/opt/plesk/php/5.6/share/pear)
How do I get PhpStorm to look for PHPUnit in the yii2/vendor folder? Can I just tell PhpStorm to run a different command instead of this phpstorm_helpers? It seems that the documentation is out of date and the screenshots JetBrains provides are from a different version of PhpStorm, I'm running PhpStorm 2017.3
So after a LOT of digging, the issue was with the Run/Debug Configuration. Despite adding Codeception to the Test Frameworks section, clicking the run button still tried to execute a pure PHPUnit test.
To switch to run the test as Codeception, look at the top toolbar above the file tabs:
There you will be able to define various options:
Now under run you'll have additional options:
Choose the blue Codeception icon to run the test using Codeception instead of PHPUnit

How would I run integration tests from vivet/googleApi?

I am trying to work out how I would integrate this shared library from GitHub into my code, since it is a shared class library, for starters I just want to run the integration tests, but I cannot work out how go get the test runner to run them.
I created a console application in my main project and a reference to the GoogleMapsApiTest in the console but I am not sure how to call the tests from there to run them.
GoogleAPIClassLibrary
I had to download the gui test runner and build it from GitHub. Link to project
now I can at least run the tests, I am still not sure how to use the library but that should help at least see how it is supposed to work.
I was able to run the unit tests by downloading the NUnit source code at the link in my post and then browsing to the output dll of the class project, to load the tests apparently the gui-test runner is no longer available for download, so hopefully that will help someone else out if they run into a need for running tests in NUnit.

Chrome Automation Extension has crashed when trying to run protractor test

I am gaining experience with Protractor and am using the example test to see how it works. The test is located in xampp/htdocs/my-dev/test-automation-playground/poc-basic-integration-flow/node_modules/protractor/
In there we have a conf.js and an example_spec.js. To run the test, we enter the protractor folder using git bash, and type protractor conf.js.
When I try to run the example test provided by Protractor, my browser opens and I get the following error: Chrome Automation Extension has crashed.... See below:
And this is what it looks like in the browser:
I've looking into Chrome extensions and there is no such extension there. What could be causing this issue?
I simply start Git Bash without admin rights and I am not getting this error anymore. Also changing browser to Firefox in config resolves this issue most of the time.

Intellij 13.0.2 JUnit test do not run in Debug

Intellij 13.0.2 JUnit test do not run in Debug
I have created several JUnit tests that run fine in Intellij, but when I try to Debug the same test, the files build and the test is not executed. I look in the event log and all it says is All Files are up to date. It does run NMake, but nothing more.
I don't know if this is related, but the View | Tool WIndows | Debug is disabled.
What do I need to do to Debug JUnit tests?
Thanks
Select Run --> Run Configurations... from the IntelliJ window
Select JUnit on the left side.
On the right side there is a "Before Launch:" section for configuring the behavior before launching JUnit tests.
See also the help page for this.