We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am using SerenityBDD with JUnit 5. I need my whole test class to fail when one of my @Test methods fails. My test looks like:
@Test
package com.xxx; import com.xxx.frp.steps.*; import com.xxx.frp.steps.configuration.TestConfiguration; import lombok.extern.slf4j.Slf4j; import net.serenitybdd.annotations.*; import net.serenitybdd.junit.spring.integration.SpringIntegrationMethodRule; import net.serenitybdd.junit5.SerenityJUnit5Extension; import org.junit.Assert; import org.junit.Rule; import org.junit.jupiter.api.*; import org.junit.jupiter.api.extension.ExtendWith; import org.junit.rules.TestWatcher; import org.junit.runner.Description; import org.openqa.selenium.WebDriver; import org.springframework.retry.annotation.EnableRetry; import org.springframework.test.context.ContextConfiguration; import static com.xxx.xx.utils.Utils.waitForNSeconds; @Slf4j @ExtendWith(SerenityJUnit5Extension.class) @ContextConfiguration(classes = TestConfiguration.class) @EnableRetry @TestMethodOrder(MethodOrderer.MethodName.class) public class UJTest { @Rule public SpringIntegrationMethodRule springIntegrationMethodRule = new SpringIntegrationMethodRule(); public static Boolean previousTestPassed = true; @Rule public TestWatcher watchman = new TestWatcher() { @Override protected void failed(Throwable e, Description description) { LOG.info(description.toString()); previousTestPassed = false; } }; @Managed(clearCookies = ClearCookiesPolicy.Never) public WebDriver webdriver; @Steps public LoginSteps loginSteps; @Test @Tags({@Tag("newe2eLargea"), @Tag("b"), @Tag("c")}) @Title("HierarchyUploadAndLogin:") public void UserJourneyPart1_HierarchyUploadAndLogin() throws Exception { loginSteps.loginAsGroupManager(); } @Test @Tags({@Tag("newe2eLargea"), @Tag("b"), @Tag("c")}) @Title("two") public void UserJourneyPart2_secondPart() throws Exception { Assumptions.assumeTrue(previousTestPassed, "Previous test failed, hence ignored"); loginSteps.loginAsGroupManager(); Assert.assertTrue(false); } @Test @Tags({@Tag("newe2eLargea"), @Tag("b"), @Tag("c")}) @Title("three") public void UserJourneyPart3_thirdPart() throws Exception { Assumptions.assumeTrue(previousTestPassed, "Previous test failed, hence ignored"); loginSteps.loginAsGroupManager(); } }
But even though my second test fails, JUnit executes the third one. Is there anyway I could achieve that in JUnit 5?
The text was updated successfully, but these errors were encountered:
Partially, yes. We call the feature "scenario tests", and there's an open issue with some existing extension that gets you there, most of the way: #48
Sorry, something went wrong.
No branches or pull requests
I am using SerenityBDD with JUnit 5. I need my whole test class to fail when one of my
@Test
methods fails. My test looks like:But even though my second test fails, JUnit executes the third one. Is there anyway I could achieve that in JUnit 5?
The text was updated successfully, but these errors were encountered: