Run integration tests in a specific directory with gradle command - java

I have gradle project with below structure
ParentDirectory
component1
component2
testsuites
unittest
When I run command ./gradlew test
It ran all tests under unittest not integration tests
I have some integration tests like aTest, bTest etc in testsuites directory, when I run below command it does something like (Configure project...) but I guess its not running integration junit tests as it doesn't show test details
./gradlew clean test --tests com.x.y.aTest
Here com.x.y is package location to aTest, what is seen on import in aTest class.
Please let me know how can I run single integration test class & multiple integration tests with gradle command in terminal?

Related

Unit test fails on build from Intellij but passes from terminal

I have a big java project. Using maven to automate the build and manage dependencies and JUnit for the unit testing.
When i'm running mvn clean install from Intellij the build fails because of one unit test that fails.
The test succeeds when ran manually.
Also, executing mvn clean install from the terminal succeeds. (all tests pass)
I'm not sure where to look for the problem here.
Thanks!

Compile Cucumber JUnit based runner classes

I've built a cucumber framework and using JUnit for creating Runner Classes. When I load & run N number of feature files, my runner class is executing all the scenarios & tests as expected.
But here I would like load tests alone in Eclipse JUnit explorer by compiling the tests and pick selective tests from there and run from Eclipse JUnit explorer.
Currently I could see that after running the tests only Eclipse JUnit explorer is populated with tests and from there I'm able to pick and run certain tests. But is there an option to compile and load tests in Eclipse JUnit explorer?

Android gradle: how to run separately integration and unit tests?

Currently I have standard structure of project:
src
|---androidTest
|-------------------|---java
|----------------------------|---robotium
|----------------------------|---unit
|---main
|---------|---AndroidManifest.xml
|---------|---java
|---------|---res
According to documentation
I've placed unit and integration tests under androidTest folder.
Since instrumentation tests need lot of time, I placed it inside robotium folder(I use Robotium).
Inside unti - jUnit tests respectively.
To run all tests I invoke ./gradlew connectedCheck - it's taking lot of time.
How to to run integration (inside robotium folder) tests and unit tests separately?
I want to run these tests using gradle - it's for CI server.
For example I want to run integration tests every night and unit tests - every hour..
Thanks!
According to the documentation JUnit tests should be places under - src/test/java and then you'll be able to switch between test sources by changing Test Artifact when selecting Build variants as shown:
(source: android.com)

How can I view integration tests in the Netbeans Test Results?

My development environment is Netbeans 7.4 and Maven 3.0.5 (bundled with Netbeans). I'm using JUnit 4.11 to build unit (class names ending with Test) and integration tests (class names ending with IT). I'm running unit tests and excluding integration tests with the "-DskipITs" Maven option. I have a custom action which runs just the integration tests with the failsafe plugin. Both execute successfully. However, I only see the results in the "Test Results" window when running the unit tests. How can I get the integration tests to show in the "Test Results" window? With the integration tests, I'm only seeing the output in the console.
The maven-failsafe-plugin only executes in integration-test and verify (and of course the help) goal while the maven-surefire-plugin runs during test goal.
NetBeans Test Results window only shows the tests that were executed using the 'test' goal.
My solution for this situation is to categorize my integration tests into
testintegration - just lightweight ITs, I run them with surefire (to see them in Test Results window)
testheavy - those that will require me to bootstrap something I run with the fail-safe plugin
I hope you have the option of doing something close to that.

How to run Maven unit test (testng) on Eclipse?

I have a Maven project and I have included some unit tests. I can run those unit tests from command line using
mvn test -Dtest=AppTest
It will run the unit test (AppTest class) without any problems. But if I tried to run the test on Eclipse as JUnitTest, I got an error saying
"No Tests found with test runner 'JUnit 3'"
I know the test (AppTest) is not a JUnit test but I didn't see "maven" option if I right clicked on the test class.
Do you know how I could run the tests on Eclipse?
If those are testng tests, then you can download the eclipse plugin for TestNG and right click and run them as test class. Testng plugin here
If you want to run the command line way of maven, you would need the maven plugin for eclipse from here
Then you can right click your project and you should see an option of Run As -> Maven Test. You would need to set relevant arguments in the surefire plugin of pom or use run configuration to specify parameters like you did in -Dtest
I would suggest the testng plugin which would be simpler to just select the class and run the class or a single case or a package even.

Categories

Resources