WebdriverIO + Jasmine: How to exclude a specific test file when running a suite based on that test file name - jasmine

We are on latest 8.X WebdriverIO version and latest Jasmine 4.X at this moment, using latest Node 18.X.
In my Wdio.conf.js file I have suite:
all: [ 'path/test1.js', 'path/test2.js'],
test1.js has a Describe with value "SMOKE test 1", while test2.js has "test 2".
I want to run --suite=all but exclude all files that DOESN'T contain "SMOKE" in the title, or run --suite=all but include only tests which contains "SMOKE" in the title.
Is this possible, and how? I'm having real troubles finding examples for this case. Can we use grep for this example somehow? I don't have an idea how can we do it.
Basically, the idea is to run only smoke test from some suite. We are not using Mocha and Cucumber runners which have additional tagging, so we are basically running suites all the time. I don't want to create more suites and divide tests in separate suites, we have to many test files.
I tried following the documentation, but I'm having troubles using their example:
grep -r -l --include "*.js" "myText" | wdio wdio.conf.js

Related

run multiple scenario from a feature file using maven command from specific file - cucumber

i have feature file ALLTests having couple of scenarios
Ex: TC1 , TC2 ,TC3 , TC4
I want to run only TC2 and TC4 from ALLTests through maven command , how to achive this ?
I tried "--tags #ALLTests,#TC1,#TC2" it ran all testcases from ALLTests feature file .
EDITED
See Tag Expressions
--tags '#ALLTests and not (TC2 and TC4)'
As far as Maven, take a look at cucumber tags based on maven profile
From the docs:
"
Tags are a great way to organise your features and scenarios.
They can be used for two purposes:
Running a subset of scenarios
Scoping hooks to a subset of scenarios
"
"You can tell Cucumber to only run scenarios with a particular tag" (Source: Running a subset of scenarios)
And you can use tag expressions to specify subsets of features/scenarios.

Appium test result file

I am building a CI pipeline with Bamboo and I run automated tests using Appium. I have successfully run the Appium server and test scripts but I would like to have results in for example xml file so I could pass it to Bamboo. Do you know any way to achieve this?
it might be a bit late to respond on your question, but I'm using Appium with node.js and mocha to write my tests. To create a proper xml with the results I'm doing:
mocha --recursive -R xunit test/ > test-reports.xml
(test/ is the folder containing all my test files). This is generating a proper xml. I haven't tested it with Bamboo but I assume it's capable of reading XUnit test reports.

Can we ignore scenarios in calabash Ruby feature file

I was trying to Ignore my scenarios for my Calabash Feature file (Ruby) using #ignore. But i can still run ignored scenarios. I have latest calabash version with Ruby 2.0. please suggest me other ways to ignore scenarios in calabash Ruby feature file
The easiest way is to use tags.
For example if you have 5 scenario and you want to run only 3 of it, then assign a tag to the those three scenarios which you want to run and run the script with tags.
example:
scenario 1
#run
steps
scenario 2
steps
scenario 3
steps
scenario 4
#run
steps
scenario 5
#run
steps
command: calabash-android run application.apk --tags #run
this will run your scenario 1,4 and 5
Cucumber doesn't automatically ignore tests that are labeled with #ignore, it is the same as any other tag.
When you run the tests add this (note the tilda ~)
--tags ~#ignore
and cucumber will ignore those tests.
i.e.
rake cucumber --tags ~#ignore
You can also use tags the same way to control tests you want to only run on certain environments etc.

How do I set up a Ginkgo test suite?

I have inherited a Go project that consists of a lot of common files, a library of sorts, two executables, and theoretically a test suite. The test suite is being written after the fact. But I dislike the only way I've found of setting up is rather unpalatable
I'm using Ginkgo, and this is my starting directory structure
component1/component1.go
component2/component2.go
cmd1/cmd1.go
cmd2/cmd2.go
project_suite_test.go
component1_test.go
Each cmd?.go file will be compiled into a separate executable.
What I would like is a multi-file test suite, usually one file per component. Where do I put the files so that go test will find and run all of them, without leaving them here in the root of the project?
ginkgo init and ginkgo bootstrap will set up your tests. ginkgo -r will run all your tests recursively.
Reason:
Ginkgo command will only work if you have actually bootstrap your project via ginkgo.
Options:
To use that you have to go to your test dir in terminal and run
ginkgo init : To Initialise project:
ginkgo bootstrap : This will generate new file with test suite config
ginkgo or ginkgo test : this will now be able to run tests based on your new generated file because that's what it is trying to search.
Alternatively:
If you like to keep your tests in a sub-folder, say test, then running
go test ./...
will attempt to run tests in every folder, even those that do not contain any test, thus having a ? in the subsequent report for non-test folders.
Running
go test ./.../test
instead will target only your test folders, thus having a clean report focused on your tests folders only.
you can alternatively use 'go run $(ls *.go)' to run all the files in a given folder.
Notice you have regular expression within () braces.
In-case you want to run test in different path update path as per your desired dir in the regular expression
You can use go test ./... in the root and it will go into child folders and execute the tests:
component1/component1.go
component1/component1_test.go
component2/component2.go
component2/component2_test.go
cmd1/cmd1.go
cmd1/cmd1_test.go
cmd2/cmd2.go
cmd2/cmd2_test.go

Running multiple Cucumber features in Jenkins

I've been working with Cucumber and Watir for the past few months locally to run some regression tests on our application. I have several Cucumber feature files in one repository with one step file and one environment file. Recently I have moved from running this locally to running it on Jenkins along with the cucumber-jvm reports plugin.
I set the build steps up with the following:
cucumber --format json all/features/publish.feature > result_publish.json
cucumber --format json all/features/signin.feature > result_signin.json
cucumber --format json all/features/reports.feature > result_reports.json
When there are no failures with the tests all feature files run successfully one after the other. However, if there is a failure with the first test the build will fail and the subsequent tests will not run.
Is there any way I can force all feature files to run even if one of them fails?
Put the features in the same folder and run
cucumber --format json all/features/integration -o results.json
This will create one single report with all the tests and will run all the features regarding if they fail or not

Resources