io.cucumber.java.After Java Examples

The following examples show how to use io.cucumber.java.After. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SetupAndTeardownSteps.java    From realworld-serverless-application with Apache License 2.0 6 votes vote down vote up
@After
public void afterScenario(Scenario s) {
  TestEnv.getApplications().forEach(app -> tryDeleteApplication(app.getApplicationId()));

  try {
    cognitoUserManager.cleanupCognitoUser();
  } catch (Throwable t) {
    log.warn(String.format("Failed to clean up cognito user %s", TestEnv.getUsername()), t);
  }

  Instant endedAt = Instant.now();
  long durationMillis = Duration.between(TestEnv.getScenarioStartedAt(), endedAt).toMillis();
  if (s.isFailed()) {
    log.info("Failed scenario \"{}\" at {} (Duration: {} ms)", s.getName(), endedAt, durationMillis);
    log.info("TestData: {}", TestEnv.getTestData().toString());
  } else {
    log.info("Completed scenario \"{}\" at {} (Duration: {} ms)", s.getName(), endedAt, durationMillis);
  }

  tryEmptyTestBuckets();
}
 
Example #2
Source File: SetupAndTeardownSteps.java    From realworld-serverless-application with Apache License 2.0 6 votes vote down vote up
@After
public void afterScenario(Scenario s) {
  TestEnv.getApplications().forEach(app -> tryDeleteApplication(app.getApplicationId()));

  try {
    cognitoUserManager.cleanupCognitoUser();
  } catch (Throwable t) {
    log.warn(String.format("Failed to clean up cognito user %s", TestEnv.getUsername()), t);
  }

  Instant endedAt = Instant.now();
  long durationMillis = Duration.between(TestEnv.getScenarioStartedAt(), endedAt).toMillis();
  if (s.isFailed()) {
    log.info("Failed scenario \"{}\" at {} (Duration: {} ms)", s.getName(), endedAt, durationMillis);
    log.info("TestData: {}", TestEnv.getTestData().toString());
  } else {
    log.info("Completed scenario \"{}\" at {} (Duration: {} ms)", s.getName(), endedAt, durationMillis);
  }

}
 
Example #3
Source File: AccountFeature.java    From hedera-mirror-node with Apache License 2.0 5 votes vote down vote up
@After
public void closeClients() {
    try {
        accountClient.getSdkClient().close();
    } catch (Exception ex) {
        log.warn("Error closing SDK client : {}", ex);
    }
}
 
Example #4
Source File: TestFailureHook.java    From yaks with Apache License 2.0 5 votes vote down vote up
@After(order = Integer.MAX_VALUE)
public void checkTestFailure(Scenario scenario) {
    if (scenario.isFailed()) {
        runner.run(new AbstractTestAction() {
            @Override
            public void doExecute(TestContext context) {
                context.getExceptions().add(new CitrusRuntimeException(
                        String.format("Scenario %s:%s status %s", scenario.getId(), scenario.getLine(), scenario.getStatus().toString())));
            }
        });
    }
}
 
Example #5
Source File: Hooks.java    From justtestlah with Apache License 2.0 5 votes vote down vote up
@After
public void notifyAfter(Scenario scenario) {
  for (CucumberHook hook : hooksRegister.getRegisteredHooks()) {
    hook.after(scenario);
  }
  hooksRegister.clear();
}
 
Example #6
Source File: Stepdefs.java    From testcontainers-java with MIT License 5 votes vote down vote up
@After
public void afterScenario(Scenario scenario) {
    container.afterTest(new TestDescription() {
        @Override
        public String getTestId() {
            return scenario.getId();
        }

        @Override
        public String getFilesystemFriendlyName() {
            return scenario.getName();
        }
    }, Optional.of(scenario).filter(Scenario::isFailed).map(__ -> new RuntimeException()));
}
 
Example #7
Source File: CucumberHooks.java    From NoraUi with GNU Affero General Public License v3.0 5 votes vote down vote up
@After()
public static void tearDown(Scenario scenario) {
    log.debug("tearDown {} scenario.", scenario.getName());
    log.debug("Context.getCurrentScenarioData()={}", Context.getCurrentScenarioData());
    log.debug("ExcelFactory.getNbLines()={}", Context.getDataInputProvider().getNbGherkinExample());
    printProgressBuild(scenario);
    if (Context.getCurrentScenarioData() >= Context.getDataInputProvider().getNbGherkinExample()) {
        log.debug("Go to next feature");
        Context.goToNextFeature();
    } else {
        log.debug("Data remaining on current feature");
    }
}
 
Example #8
Source File: BookStoreWithHooksIntegrationHooks.java    From tutorials with MIT License 4 votes vote down vote up
@After
public void afterScenario(Scenario scenario) {
    takeScreenshot();
}
 
Example #9
Source File: RpnCalculatorSteps.java    From pitest-cucumber-plugin with Apache License 2.0 4 votes vote down vote up
@After
public void after(Scenario scenario) {
    // scenario.write("HELLLLOO");
}
 
Example #10
Source File: HooksStepDefinitions.java    From cucumber with MIT License 4 votes vote down vote up
@After
public void after() {
  // no-op
}
 
Example #11
Source File: EnrichmentSteps.java    From cukedoctor with Apache License 2.0 4 votes vote down vote up
@After
public void after() throws IOException {
    metaCuke.tearDown();
}
 
Example #12
Source File: GraqlSteps.java    From grakn with GNU Affero General Public License v3.0 4 votes vote down vote up
@After
public void close_transaction() {
    tx.close();
}
 
Example #13
Source File: CucumberContextSteps.java    From neodymium-library with MIT License 4 votes vote down vote up
@After(order = 100)
public void teardown(Scenario scenario)
{
    WebDriverUtils.tearDown(scenario);
}
 
Example #14
Source File: CucumberSupport.java    From neodymium-library with MIT License 4 votes vote down vote up
@After(order = 100)
public void tearDown(Scenario scenario)
{
    WebDriverUtils.tearDown(scenario);
}
 
Example #15
Source File: HookSteps.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@After("@af")
public void afterFailed() {
    throw new AssertionError("This hook should fail");
}
 
Example #16
Source File: HookSteps.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@After("@ap")
public void afterPassed() {
}
 
Example #17
Source File: HookSteps.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@After("@AfterHookWithException")
public void afterHookWithException(){
    Assert.fail("Exception in Hook step");
}
 
Example #18
Source File: HookSteps.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@After("@WithHooks")
public void afterHook(){
    // nothing
}
 
Example #19
Source File: HookSteps.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@After("@af")
public void afterFailed() {
    throw new AssertionError("This hook should fail");
}
 
Example #20
Source File: HookSteps.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@After("@ap")
public void afterPassed() {
}
 
Example #21
Source File: HookSteps.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@After("@AfterHookWithException")
public void afterHookWithException(){
    Assert.fail("Exception in Hook step");
}
 
Example #22
Source File: HookSteps.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@After("@WithHooks")
public void afterHook(){
    // nothing
}
 
Example #23
Source File: Hooks.java    From extentreports-cucumber4-adapter with Apache License 2.0 4 votes vote down vote up
@After
public void after(Scenario scenario) throws IOException {
    scenario.embed(extractBytes("src/test/resources/logo.png"), "image/png");
}
 
Example #24
Source File: RpnCalculatorSteps.java    From extentreports-cucumber4-adapter with Apache License 2.0 4 votes vote down vote up
@After
public void after(Scenario scenario) {
    // scenario.write("HELLLLOO");
}
 
Example #25
Source File: OrderStepdefs.java    From exchange-core with Apache License 2.0 4 votes vote down vote up
@After
public void after() {
    if (container != null) {
        container.close();
    }
}
 
Example #26
Source File: ApiKeysStepsDefinitions.java    From apm-agent-java with Apache License 2.0 4 votes vote down vote up
@After
public void cleanup() {
    server.stop();
}
 
Example #27
Source File: SpreeLoginStepsGeneric.java    From qashowcase with GNU General Public License v3.0 4 votes vote down vote up
@After
public void after() {
    tearDown();
}
 
Example #28
Source File: SpreeLoginSteps.java    From qashowcase with GNU General Public License v3.0 4 votes vote down vote up
@After
public void after() {
    tearDown();
}