NoraUI - How to skip a scenario test? - noraui

I'm looking for a tag like "ignore" to skip a scenario test in NoraUI.
I tried this but it is not working :
#ignore
Scenario: 1 - Renvoi d’un rejet de mouvement Reflex

You not need add all run scenario tags in --tags of Maven command
sample:
-Dcucumber.options="--tags #hello,#bye,#Tag5,#tag10"
You can run all scenarios without some scenarios:
--tags ~#todo --tags ~#wip
full official notice here
Be careful, in NoraUi 3.x.x use io.cucumber => syntax change:
-Dcucumber.options="--tags '#hello or #bye or #Tag5 or #tag10'"

Related

Can't be enable to #ignore annotation for the features

Karate has #ignore annotation for the features.
https://github.com/intuit/karate#data-driven-features
I try to #ignore annotation, but it is not enable and the feature runs.
(use karate 0.9.2)
How can I use #ignore annotation for the features?
#ignore
Feature: API test
Background:
* url 'http://localhost:8089'
Scenario: Get all rentacycles
Given path '/rentacycles'
When method get
Then status 200
And assert response.size() === 5
There is no "special" annotation (actually there is just one which is #parallel=false)
So you can freely use any name for the annotation.
What is important is when you run your tests, you have to mention which annotation to use. See the documentation: https://github.com/intuit/karate#tags
Maybe this example will be clear: first.feature
To run tests with a tag:
mvn test -Dkarate.options="--tags #smoke"
And what you are asking is to NOT run:
mvn test -Dkarate.options="--tags ~#smoke"
Normally this is set on the JUnit runner like this example:
#KarateOptions(tags = "~#ignore")

How to add profile variable in Karate

Currently I am using the following command to run my feature file:
mvn test -Dcucumber.options="--plugin html:target/cucumber-html --tags #dogs" -Dtest=TestParallel.java -Dkarate.env=Pets
But I wish to add another variable while calling running the command. Something like this:
mvn test -Dcucumber.options="--plugin html:target/cucumber-html --tags #dogs" -Dtest=TestParallel.java -Dkarate.env=Pets -Dname=Charlie
How can I do that?
You can pass extra dynamic parameters using a combination of Java system-properties and reading karate.properties
mvn test -Dtest=TestParallel.java -Dkarate.env=pets -Dmy.name=foo
And then in karate-config.js
var myName = karate.properties['my.name'];
Or even in any feature file:
* def myName = karate.properties['my.name']
Kindly do note that -Dcucumber.options="--plugin html:target/cucumber-html" does not have any effect in Karate and will be deprecated in the future.

gradle test: how to run one method?

How to run just one method of a test case for debugging with Gradle? I have tried:
gradle test -tests example.TestFoo#testMethod1 --debug-jvm
but it ends up with following error:
No tests found for given includes: example.TestFoo#testMethod1
The test TestFoo class has testMethod1(), testMethod2(), etc.
Use . instead # in your tests filter expression to point to a method name:
gradle test --tests example.TestFoo.testMethod1 --debug-jvm
You can find more examples on filtering tests in 48.14.3. Test filtering documentation section.

How to append behat results to one html file

Scenario:
1) I run php bin/behat features/1.feature > result.html
2) I then run php bin/behat features/2.feature > result.html
3) I should see the results of both 1.feature and 2.feature in results.html
How can I get this done ? does behat have a option for appending ?
maybe php bin/behat features/1.feature --append > results.html ?
You can use profiles in behat.yml and indicate which features to run per profile.
So instead of running behat several times, once for each .feature, you just run it once and obtain one html file instead of several.
Example: the following config has 2 profiles, one for login scenarios and one for booking scenarios.
It also filters out scenarios tagged #wip.
It outputs data on the command line ('pretty') and in an html file ('html'):
#behat.yml
default:
filters:
tags: "~#wip"
formatter:
name: pretty,html
parameters:
output_path: null,behat_report.html
login:
paths:
features: features/login
bootstrap: %behat.paths.features%/bootstrap
booking:
paths:
features: features/booking
bootstrap: %behat.paths.features%/bootstrap
You can then run the profile you want:
behat --profile login
which will run all the .feature files inside the features/login/ directory

run single integration test with gradle

I'm trying to run a single integration tests using gradle's -Dtest.single flag. I have added another source set, src/integrationTest and put the tests in there. I have an integration test task
task integrationTests(type: Test) {
dependsOn 'assemble', 'integrationTestClasses'
testClassesDir = sourceSets.integrationTest.output.classesDir
classpath = sourceSets.integrationTest.runtimeClasspath
}
This runs fine, but if I try to run a single test it tells me it cannot find a matching test. I don't want to have to run every integration test each time I am writing a new one. Is there a way to do this?
Since Gradle 1.10 you can write:
//select specific test method
gradle test --tests org.gradle.SomeTest.someFeature
//select specific test class
gradle test --tests org.gradle.SomeTest
//select all tests from package
gradle test --tests org.gradle.internal*
//select all ui test methods from integration tests by naming convention
gradle test --tests *IntegTest*ui*
//selecting tests from different test tasks
gradle test --tests *UiTest integTest --tests *WebTest*ui
Read more here
http://www.gradle.org/docs/1.10/release-notes#executing-specific-tests-from-the-command-line
The correct syntax is:
gradle testTaskName -DtestTaskName.single=...
In this case:
gradle integrationTest -DintegrationTest.single=...
Just incase anyone is coming here looking for answers. This has been removed in gradle 5.0. Look for test.single in https://docs.gradle.org/current/userguide/upgrading_version_4.html
If you still wish to use a command line option in this style you should be able to use the --tests commandline param. See https://docs.gradle.org/current/userguide/java_testing.html#simple_name_pattern
$ ./gradlew integrationTest --tests=MyTest