[![Try to run from ruby mine]I was not able to rerun failed automated test scenarios by using yml file example default: --no-source --color cucumber -f rerun --out rerun.txt
Try the Runner Options. Steps: Open Feature file > Run menu > Edit Configuration > Cucumber > Add/Edit existing > Update Runner Options.
Related
I have a Travis CI project which builds an iOS app then starts Appium and runs tests with Appium/Mocha.
The problem is that even though the Mocha tests fail and throw exception, the shell script which runs them via Gulp still exits with 0 and the build is deemed passing.
How can I make the build break/fail when the Mocha tests fail?
Here is how I managed to make this work:
Instead of running the Mocha tests via Gulp, run them directly from the shell script
Save the output to mocha.log besides displaying on stdout
./node_modules/.bin/mocha --reporter spec "appium/hybrid/*uat.js" 2>&1 | tee mocha.log
Check mocha.log for the string " failing" and exit with 1 if found
.
if grep -q " failing" mocha.log; then
exit 1
fi
The exit 1 will make the Travis build fail.
I'm using Codeception and I want to do Selenium tests.
Obviously, I need Selenium server running and I can spin it up with:
java -jar ./path/to/selenium/binary
However, I've used another testing framework in past which allowed me to specify this path in config file. Then, whenever I did something like codecept run, the framework automatically started selenium server and also shutted it down after all tests were completed.
Can I do this with Codeception? I tried to put exec() in _bootstrap file but it didn't work..
I'm using phantomjs - headless alternative to selenium. This extension starts phantomjs automatically with codecept run. Also phantomjs is faster than selenium.
You can write your own extension for running selenium - have a look at this file.
I start my tests with a bash script and then start and stop selenium via screen:
#!/usr/bin/env bash
# Start selenium in detached screen
screen -d -m -S "selenium" java -Dwebdriver.chrome.driver=./path/to/chromedriver -jar ./path/to/selenium/binary || true
./vendor/bin/codecept run -c codeception.yml --fail-fast --coverage --steps --coverage-html --html || error=true
# quit selenium
screen -S selenium -X quit || true
This might not fit the use-case but I can execute my code in my bash on Windows and Ubuntu as well as via my jenkins build process.
The go test command covers *_test.go files in only one dir.
I want to go test the whole project, which means the test should cover all *_test.go files in the dir ./ and every children tree dir under the dir ./.
What's the command to do this?
This should run all tests in current directory and all of its subdirectories:
$ go test ./...
This should run all tests for given specific directories:
$ go test ./tests/... ./unit-tests/... ./my-packages/...
This should run all tests with import path prefixed with foo/:
$ go test foo/...
This should run all tests import path prefixed with foo:
$ go test foo...
This should run all tests in your $GOPATH:
$ go test ...
From Go 1.9 onwards, use
go test ./...
In Go 1.6 through 1.8, the ./... matched also the vendor directory. To skip vendored packages, you'd use
go test $(go list ./... | grep -v /vendor/)
Sources: https://github.com/golang/go/issues/11659, https://github.com/golang/go/issues/14417, https://github.com/go-lang-plugin-org/go-lang-idea-plugin/issues/2366, #nickgrim's comment.
Folder Structure
ProjectName/folderName1/file_test.go
ProjectName/folderName2/file1_test.go
ProjectName/folderName3/file2_test.go
go test command Command
ProjectName$ go test -v ./...
ProjectName$ go test ./...
ProjectName$ go test -cover ./...
Coverage Report for the Entire Project
ok ProjectName/folderName1 10%
ok ProjectName/folerName2 90%
ok ProjectName/folerName2 85%
I finally figured out how to output failing tests to a rerun.text
cucumber -p headless --format rerun --out rerun.txt 'path of feature files'
We get the output file of rerun.txt but when we try to do
cucumber -p headless rerun.txt it gets a lexing error because gherkin can't take this input. How do we run the file in cucumber? We tried also just running:
cucumber -p headless --format rerun --out rerun.txt
with no path listed, but it will just run all the feature files. The rerun.txt does contain our failing features.
From the cucumber help text (cucumber -h):
Use --format rerun --out features.txt to write out failing
features. You can rerun them with cucumber #rerun.txt.
So you'd probably want to use:
cucumber -p headless #rerun.txt
In Ant we have the provision to send the Build details to a log file by specifying the log file as a param while invoking the Ant build like ant -l $BUILDLOG
Do we have a similar functionality in Maven ?
I added > mvn_build_log.txt to the end of my command to output the mvn build output.
Not in maven 2. But it was added in maven 3 (currently in alpha) in the same form. e.g. mvn -l $BUILDLOG.