Unable to run tests through commandline [duplicate] - karate

We have a multi module project with the following structure
module 1
module 2
module e2e
parent pom
The module e2e contains our karate features (into the src/test/java/features folder)
We couldn't figure out how to run the karate tests using the "mvn test".
It always runs 0 tests, instead there are some feature files.
We have tried running "mvn test" from the root of the project, as well as from inside the e2e module
We have other maven projects (not multi module) and it works as expected.
Does it necessary to make some configuration action to do it?
Thanks a lot.

mvn test behind the scenes just looks for JUnit tests, it is that simple. Check that your JUnit class names end with Test - and that the maven tweak for the recommended directory structure is in place: https://github.com/intuit/karate/issues/724
Otherwise unless you follow this process, it is difficult for anyone to help you: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

Related

No tests run in maven project with karate module

We have a multi module project with the following structure
module 1
module 2
module e2e
parent pom
The module e2e contains our karate features (into the src/test/java/features folder)
We couldn't figure out how to run the karate tests using the "mvn test".
It always runs 0 tests, instead there are some feature files.
We have tried running "mvn test" from the root of the project, as well as from inside the e2e module
We have other maven projects (not multi module) and it works as expected.
Does it necessary to make some configuration action to do it?
Thanks a lot.
mvn test behind the scenes just looks for JUnit tests, it is that simple. Check that your JUnit class names end with Test - and that the maven tweak for the recommended directory structure is in place: https://github.com/intuit/karate/issues/724
Otherwise unless you follow this process, it is difficult for anyone to help you: https://github.com/intuit/karate/wiki/How-to-Submit-an-Issue

How to target specific Cucumber runner classes or feature files within Jenkins?

Is it possible to target specific runner classes or feature files within Jenkins?
Let's say for example I have the following files.
Runner classes:
RunnerClass1.java
RunnerClass1.java
Feature Files:
Login.feature
SignUp.feature
Is there a way to trigger specific runner classes or feature files within the Jenkins UI, I know you can use specific plugins such as: 'Parameterised / String Parameters', has anyone else found a solution to target specific tests from Jenkins?
thanks for your help
You can tag your test cases and maven will be able to run them by these tags.
For example, When I have Login cases with #Login tags and I want to run them with Maven, I am using the following terminal script :
mvn clean test -Dcucumber.options="--tags #Login"

Add unit test paths to Codeception

I have started to create unit tests for small components and added them to a Tests subdirectory within the component directory - so everything is together. No functional or acceptance tests are needed for these simple small components.
But I have not found out how to tell Codeception to run all tests in a directory - I am looking for a similar method like in the PHPUnit config file, where I can just tell PHPUnit to go through all PHP files in a directory (<directory>src/*/*/*/Tests</directory> in PHPUnit XML config).
Also, there does not seem to be a reference for possible configuration options in Codeception - so it is really hard to find more advanced configuration options such as these. Or have I missed something?
http://codeception.com/docs/08-Customization#One-Runner-for-Multiple-Applications
In your case it would be:
include:
- src/*/*/*
But you will have to create a codeception.yml and at least one test suite for each component.
Look at https://github.com/Codeception/symfony-demo/blob/2.2/codeception.yml and https://github.com/Codeception/symfony-demo/tree/2.2/src/AppBundle for an example.

IntelliJ 14 Gradle task in Test Runner

Upgraded to IntelliJ 14.0.1 One of the big new features I was looking for:
"If you run tests via a Gradle task, the IDE offers you the standard Test Runner instead of the console output." (Source: https://www.jetbrains.com/idea/whatsnew/#buildTools)
I right click on the Gradle Task to run our Integration Tests:
However, I see the results of the test still going to console output, not to the Test Runner:
Has anyone been able to get this new feature in IntelliJ IDEA 14 to work?
Thank you in advance,
Philip
Looks like IntelliJ looks for a task named "test" rather than a task of type Test.
https://github.com/JetBrains/intellij-community/blob/master/plugins/gradle/src/org/jetbrains/plugins/gradle/execution/test/runner/GradleTestsExecutionConsoleManager.java#L191
Rename the test task to unitTest and then create a wrapper that runs both:
// Rename test to unitTest
tasks.test.name = "unitTest"
// Wrap and run both
task test(dependsOn:['unitTest', 'integrationTest'])
If you only want to run integration tests, just overwrite it:
task test(overwrite: true, dependsOn: ['integrationTest'])
This allows me to run the integration tests in the test runner successfully (at least it works in IDEA 15 EAP but it should work in 14 as well I would think).
I still get this in IntelliJ 2017.1, but specifically when running tests in the gradle buildSrc directory. After digging a while, it turns out that the Gradle API doesn’t expose the test tasks in the special buildSrc directory to Intellij, so IntelliJ doesn’t recognize it as a test.
Workaround: Open another IntellIJ project for the buildSrc directory directory instead of trying to run tests cleanly inside the root project.

Run Integration test in toplevel pom

I have a project with 3 modules.I used maven as the build tool.I have Integration test module
Proj/mod1/pom.xml
Proj/mod2/pom.xml
Proj/intTest/pom.xml
Proj/pom.xml
Now I want to run the integration test using top level pom.xml,Is there a way to do that??
Thanxxx
Well, if I get it right the intTest-project does your integration tests and is part of your project Proj so if you run the module build with the appropriate phase (integration-test or verify, depending on what you use) this should be it ...