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

Test continues after failing to find element #150

Open
IoanaRusYnap opened this issue Apr 30, 2021 · 1 comment
Open

Test continues after failing to find element #150

IoanaRusYnap opened this issue Apr 30, 2021 · 1 comment

Comments

@IoanaRusYnap
Copy link

Hi,

I recently joined a project that uses your framework and came across the following issue.
When I have tests that are using Scenario and Steps structure, test is not failing when it does not find an element. I added below a code snap of how a dummy test method looks:
Screenshot 2021-04-30 at 12 09 15

In the above example, if I run the method and the .exists check returns false, the test continues to check if element is .hittable as well. Snap of logs below:
Screenshot 2021-04-30 at 11 50 51

If I don't use a step in the scenario, just add the code in Given outside of the step, it works properly.

I looked for what could cause this and found that if I comment out lines 85-86 from TABTestCase.swift, the example works as expected.

Can you tell me if this behaviour happened for other projects or if there is a solution? Or can we fix it?

Thanks!

@msaurikc
Copy link

Hi! I was literally just running some tests to confirm this behaviour.
I started a standard iOS project on xcode without modifying anything, I added TABTestKit pod and created a dummy scenario, similar to what @IoanaRusYnap shows.
I have the same issue. Test execution continues regardless of any failure. There can be multiple failures in a single scenario

This will continue executing past function stepFails that only has XCTFail with a message

    func test_example() {
        Scenario("Using steps") {
            Given(I: see(Label(id: "Hello, world!")))
            When(the: stepFails())
            Then(I: doNotSee(Label(id: "Hello, world!")))
            And(the: otherStepFailsToo())
        }
    }

If written like this, it fails and stops the execution as expected.

    func test_example_no_steps() {
        Scenario("without using steps") {
            see(Label(id: "Hello, world!"))
            stepFails()
            doNotSee(Label(id: "Hello, world!"))
            otherStepFailsToo()
        }
    }

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

2 participants