Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return exit code 0 when no features are found, or no found features match the tags filter #567

Merged
merged 4 commits into from
Aug 4, 2013

Conversation

brasmusson
Copy link
Contributor

This PR is created in response to the following discussion on the mailing list:
[JVM] Exception thrown when no tags are found (https://groups.google.com/forum/#!topic/cukes/wZo0FTQJrVA).

Return exit code 0 when no features are found, or if no found features match the tags filter used. Print the same message, that is used in the currently thrown CucumberException when this occurs, as information before the summary printout.

Jenkins will mark a job as failed even though the exit code was 0, if the JUnit report file contains no testcase elements (http://jenkins.361315.n4.nabble.com/Jenkins-fails-if-there-are-no-testcases-td3899185.html). Therefore add a dummy testcase element to the JUnit report, when no features are found, or no found features match the tags filter used.

Return exit code 0 when no features are found, or if no found features
match the tags filter used. Print the same message, that is used in the
currently thrown CucumberException when this occurs, as information
before the summary printout.
Jenkins will mark a job as failed even though the exit code was 0, if
the JUnit report file contains no testcase elements. Therefore add a
dummy testcase element to the JUnit report, when no features are found,
or no found features match the tags filter used.
@dkowis
Copy link
Member

dkowis commented Aug 2, 2013

I don't think this is the proper solution for this. If there are no tests, or it can't find anything it should be a "failure" because you didn't actually test anything. It probably shouldn't barf an exception, but it shouldn't exit cleanly. That's my $0.02.

Using the "--wip" option will invert this (IIRC), so if no tests are found it'll exit 0

@@ -103,7 +103,7 @@ public StepDefinitionMatch stepDefinitionMatch(String uri, Step step, I18n i18n)
@Override
public void writeStepdefsJson(List<String> featurePaths, URL dotCucumber) throws IOException {
if (dotCucumber != null) {
List<CucumberFeature> features = load(new FileResourceLoader(), featurePaths, NO_FILTERS);
List<CucumberFeature> features = load(new FileResourceLoader(), featurePaths, NO_FILTERS, null);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is that null for?
Can you just overload the method?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right, overloading is better.

@brasmusson
Copy link
Contributor Author

@dkowis On the other hand, Cucumber-Ruby treat it like a success and return exit code 0 in this case. And as far as I know is the "--wip" option not implemented in Cucumber-JVM.

@dkowis
Copy link
Member

dkowis commented Aug 2, 2013

Ah, I am indeed mistaken. I could've sworn it used to work that way... Very well, this is probably the proper way to do it then. I withdraw my previous objections.

brasmusson and others added 2 commits August 2, 2013 20:05
Overload CucumberFeature.load to avoid passing null and the need for
null check. Improve the log message when no feature path is given at
the command line.
@ffbit
Copy link
Contributor

ffbit commented Aug 3, 2013

@brasmusson Could you, please, merge in your branch code from my branch with the same name?
I added an example project with no features at all and some readme notes.
Thanks.

P.S.
I couldn't Google how to do this without additional PL.

@ffbit
Copy link
Contributor

ffbit commented Aug 3, 2013

@brasmusson Here is a little manual how to do what I'm asking for:

git remote add ffbit https://github.com/ffbit/cucumber-jvm.git
git checkout succeed-on-no-features
git pull ffbit succeed-on-no-features
git pull origin succeed-on-no-features

Thanks

@aslakhellesoy
Copy link
Contributor

LGTM!

@brasmusson
Copy link
Contributor Author

@ffbit I reckon that for you to be able to yourself add commit to my pull request, you would need push access to my forked Cucumber-JVM repository. Of course there is always the possibility that you create a PL from your succeed-on-no-features branch to the succeed-on-no-features branch on my forked repository, when that PL is merged, then the commit should be added to this PL. But it seems easier if a fetch the code from your branch and add it to this PL. I'll do that right now ...

brasmusson added a commit to brasmusson/cucumber-jvm that referenced this pull request Aug 4, 2013
Merge pull request cucumber#567 Return exit code 0 when no features are found,
or no found features match the tags filter. Update the History.md.
brasmusson added a commit to brasmusson/cucumber-jvm that referenced this pull request Aug 4, 2013
Merge pull request cucumber#567 Return exit code 0 when no features are found,
or no found features match the tags filter. Update the History.md.
brasmusson added a commit that referenced this pull request Aug 4, 2013
Merge pull request #567 Return exit code 0 when no features are found,
or no found features match the tags filter. Update the History.md.
@brasmusson brasmusson merged commit 96a5c15 into cucumber:master Aug 4, 2013
@brasmusson brasmusson deleted the succeed-on-no-features branch August 4, 2013 17:08
@kutzi
Copy link
Contributor

kutzi commented Mar 2, 2018

This is already really old, but:
could we at least have the part, where a lot of 'dummy' test results are created, made configurable?
IMO it's not the responsibility of cucumber-jvm to add workarounds, when your Jenkins job configuration is wrong.

@kutzi
Copy link
Contributor

kutzi commented Mar 2, 2018

Currently, my Jenkins builds are overflowing with these 'dummy' results which is really annoying.

@lock
Copy link

lock bot commented Mar 3, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Mar 3, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants