Skip to content

Failure tests behaviour  #96

@martiwi

Description

@martiwi

Let's say I have the following test class:

@RunWith(JunitSuiteRunner.class)
public class StackSpec {{

        Stack<Integer> stack = new Stack<>();
        List<Integer> list = new ArrayList<>();

        describe("a stack", it -> {

                it.isSetupWith(stack::clear);
                it.isConcludedWith(stack::clear);

                // First test executed
                it.should("be not empty when created", expect -> {
                         stack.add(1);
                        expect.that(stack).isEmpty(); // Will fails
                });

                // Second test but never executed
                it.should("be empty when created", expect -> {
                        expect.that(stack).isEmpty();
                });

        }

        describe("a list", it -> {

                it.isSetupWith(list::clear);
                it.isConcludedWith(list::clear);

                // Third test but never executed
                it.should("be empty when created", expect -> {
                        expect.that(list).isEmpty();
                });

        }
}}

If one test fails, all others won't be executed from the Test class. Is there a way to prevent this to happen and still continue others tests ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions