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

[Question] How stop test? #136

Open
A11oW opened this issue Jul 18, 2018 · 3 comments
Open

[Question] How stop test? #136

A11oW opened this issue Jul 18, 2018 · 3 comments

Comments

@A11oW
Copy link

A11oW commented Jul 18, 2018

How I can stop queue of tests in spec if one of test is fail?

        describe("some spec", () -> {
            it("First test", () -> {});
            it("Second test", () -> { // something broken });
            it("Third test", () -> {});
        });

if second test will is broken, third test will not run.

@GuyPaddock
Copy link
Contributor

GuyPaddock commented Jul 18, 2018

@A11oW Usually, in test suites, you don't want to stop on the first failure because you want to know all of the tests that are failing.

However, if you're asking because you temporarily want to be able to run one specific test in isolation, try changing it to fit. This is referred to as "focused it". You can also use fdescribe to focus in on a specific describe block, fcontext to focus in on a specific context block, etc. If there are multiple that start with f then only those tests run.

More here:
https://github.com/greghaskins/spectrum/blob/1.2.0/docs/FocusingAndIgnoring.md

Does that address your question?

@A11oW
Copy link
Author

A11oW commented Jul 26, 2018

@GuyPaddock Thanks for answer. Unfortunately my test have many steps, for example:

describe("Test of some kind of business case", ()-> {
  context("authorize", () -> {
    it("input login and password", () -> {})
  });

  context("Go to form 1", () -> {
    it("Fill form", () -> {});
    it("Check form", () -> {});
    it("submit form", () -> {});
  });

  context("Go to form 2", () -> { ... });
  ...
});

I can't check form 2 without step of "authorize" and "Go to form 1", and if form 1 is fail, test of "Go to form 2" meaningless and I would like stop all next test's.

@greghaskins
Copy link
Owner

@A11oW The Gherkin DSL (given/when/then) may be helpful for your use-case. Each sub-step inside a scenario only runs if the previous step has succeeded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants