serenity-bdd / serenity-core

Serenity BDD is a test automation library designed to make writing automated acceptance tests easier, and more fun.
http://serenity-bdd.info
Other
724 stars 518 forks source link

Validations with the Ensure class do not work #3511

Open Moncada25 opened 3 months ago

Moncada25 commented 3 months ago

What happened?

When I perform validations using the Ensure class it seems that everything is ok when it is not.

image

What did you expect to happen?

The test should fail because those validations are not true. This is how it works in version 4.0.30, I tried the latest version 4.2.0 and the error continues.

image

Serenity BDD version

4.2.0

JDK version

21

Execution environment

Serenity Core 4.2.0 Java 21 Mac OS 14.6 JUnit 5 serenity-ensure:4.2.0

How to reproduce the bug.

import net.serenitybdd.screenplay.annotations.Subject
import net.serenitybdd.screenplay.Actor
import net.serenitybdd.screenplay.Question
import net.serenitybdd.screenplay.ensure.that

open class Test : Question<Boolean> {

    companion object {
        fun ensure() : Test {
            return Test()
        }
    }

    @Subject("test ensure")
    override fun answeredBy(actor: Actor) : Boolean {

        actor.attemptsTo(
            that(200).isEqualTo(201),
            that("Hello").isEqualTo("Hola"),
            that(true).isFalse()
        )

        return true
    }
}

How can we make it happen?

Add it to the Serenity BDD backlog and wait for a volunteer to pick it up

wakaleo commented 3 months ago

I would need to check, but generally a Question is a read-only operation, it is not designed to have assertions, just to read information. The assertions are generally built with the results returned by the question objects.