Comments (4)
thanks for getting back with the answer reference, might be useful for someone else. If there would be a failure in package while running go test .
then you would get detailed error, see bellow.
from godog.
Hi, depends on what exactly are you seeing, for example godog itself has a test suite integrated in TestMain with a progress
format. So when you run it:
Note, you do not see the exact scenarios printed since it is a progress format. If you change it to pretty then you will get all details.
func TestMain(m *testing.M) {
status := RunWithOptions("godog", func(s *Suite) {
SuiteContext(s)
}, Options{
Format: "pretty",
Paths: []string{"features/load.feature:22"}, // only one scenario for this example
})
if st := m.Run(); st > status {
status = st
}
os.Exit(status)
}
That is the intended behavior. If you are seeing different things then give me more context about your environment..
Additionally, you can leverage -v option which go test is using and change the formatter based on that:
func TestMain(m *testing.M) {
format := "progress"
for _, arg := range os.Args[1:] {
if arg == "-test.v=true" { // go test transforms -v option
format = "pretty"
break
}
}
status := RunWithOptions("godog", func(s *Suite) {
SuiteContext(s)
}, Options{
Format: format,
Paths: []string{"features/load.feature:22"},
})
if st := m.Run(); st > status {
status = st
}
os.Exit(status)
}
And then instead of progress if -v
option is used, you would get pretty printed features and detailed go test
command output.
from godog.
Thanks for the prompt feedback, very helpful!
Indeed my setup was using the format progress
, and I'm getting all the desired output when using pretty
.
I also just noticed that I was a bit imprecise:
I'm actually using go test $(glide novendor)
to run the test suite without running tests that might be included in vendored packages in the subfolder vendor/
. In my case, the project is very simple, so glide novendor
just returns .
- and running go test .
gives me just
ok gitlab.knf.local/ngs/gpp 0.015s [no tests to run]
The no tests to run is due to the fact that I only have features, and just have a TestMain
that runs those features. But even when I add a dummy test, I still have the same output behavior: Just one line when I call go test .
Running go test
gives me all the desired output. Running go test -v .
also solves the problem, i.e. I get all the output I need without running tests I don't want to run.
Was just wondering if anybody had an explanation for the difference in output behavior of go test
when called with a directory, and when called on its own.
As this is actually a question about go test
, I'm gonna go ahead and close the issue.
from godog.
Turns out that this is normal behavior - go test .
tests the package found in .
and testing packages prints out a summary for each package, which in the case of one package results in a one-liner... got this answer on Stackoverflow.
from godog.
Related Issues (20)
- Support for Go 1.20
- runAfterScenarioHooks invoke twice when step failed that is not the last step HOT 4
- Enhancement to allow to skip a test from the code HOT 8
- Background Outline HOT 2
- Setting option `Concurrency = 2` fails when running the Example HOT 1
- click on run tests but tests are not running HOT 1
- Please update the concurrency paragraph in the docs to clarify if scenario outlines run in parallel or only the scenarios HOT 1
- Is this feature file in godog/_examples/godogs running sequencially ? HOT 2
- Why Getting total scenarios as 6 while I am having total 5 scenarios HOT 3
- Skipping a test by returning `godog.ErrSkip` does not work? HOT 4
- print error stack when panic
- step function support return a nil Context with error HOT 1
- Conflict between global flags set by godog.BindCommandLineFlags and spf13/cobra HOT 1
- HELP: I want to know the index of a scenario in a scenario outline in the before scenario hook.
- Can't navigate to step definition from Gherkin step
- Unexpected step line values in cucumber report generated by Godog for scenario outlines
- ReadMe add step `go get ...` see provided patch to fix it
- Tag Filtering Expressions HOT 2
- Calculated step duration is wrong HOT 3
- Support for attachments / embeddings as per Cucumber and Behave HOT 9
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from godog.