org.testng.annotations.AfterTest Java Examples

The following examples show how to use org.testng.annotations.AfterTest. 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: Axis2ServerStartupWithSecuredServices.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@AfterTest(alwaysRun = true)
public void unDeployServices()
        throws IOException, LoginAuthenticationExceptionException, ExceptionException, XPathExpressionException,
        URISyntaxException, SAXException, XMLStreamException, AutomationUtilException {
    if (TestConfigurationProvider.isIntegration() && axis2Server1 != null && axis2Server1.isStarted()) {
        axis2Server1.stop();
    } else {
        AutomationContext asContext = new AutomationContext("AS", TestUserMode.SUPER_TENANT_ADMIN);
        int deploymentDelay = TestConfigurationProvider.getServiceDeploymentDelay();
        String serviceName = "SecureStockQuoteServiceScenario";
        ServiceDeploymentUtil deployer = new ServiceDeploymentUtil();
        LoginLogoutClient loginLogoutClient = new LoginLogoutClient(asContext);
        for (int i = 1; i < 9; i++) {
            deployer.unDeployArrService(asContext.getContextUrls().getBackEndUrl(), loginLogoutClient.login(),
                    serviceName + i, deploymentDelay);
        }

    }
}
 
Example #2
Source File: Axis2ServerStartupTestCase.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
@AfterTest(alwaysRun = true)
public void unDeployServices() throws Exception {
    if (axis2Server1 != null && axis2Server1.isStarted()) {
        axis2Server1.stop();
    } else {
        if (TestConfigurationProvider.isPlatform() && asContext != null) {
            int deploymentDelay = TestConfigurationProvider.getServiceDeploymentDelay();
            String serviceName = ESBTestConstant.SIMPLE_AXIS2_SERVICE;
            String studentServiceName = ESBTestConstant.STUDENT_REST_SERVICE;
            ServiceDeploymentUtil deployer = new ServiceDeploymentUtil();
            String sessionCookie = new LoginLogoutClient(asContext).login();
            deployer.unDeployArrService(asContext.getContextUrls().getBackEndUrl(), sessionCookie, serviceName,
                    deploymentDelay);
            deployer.unDeployArrService(asContext.getContextUrls().getBackEndUrl(), sessionCookie,
                    studentServiceName, deploymentDelay);

        }
    }
}
 
Example #3
Source File: QuarkusTestNgCallbacks.java    From quarkus with Apache License 2.0 6 votes vote down vote up
static void invokeTestNgAfterMethods(Object testInstance)
        throws IllegalAccessException, IllegalArgumentException, InvocationTargetException, ClassNotFoundException {
    if (testInstance != null) {
        List<Method> afterMethods = new ArrayList<>();
        collectCallbacks(testInstance.getClass(), afterMethods, (Class<? extends Annotation>) testInstance.getClass()
                .getClassLoader().loadClass(AfterMethod.class.getName()));
        collectCallbacks(testInstance.getClass(), afterMethods, (Class<? extends Annotation>) testInstance.getClass()
                .getClassLoader().loadClass(AfterTest.class.getName()));
        for (Method m : afterMethods) {
            // we don't know the values for parameterized methods that TestNG allows, we just skip those
            if (m.getParameterCount() == 0) {
                m.setAccessible(true);
                m.invoke(testInstance);
            }
        }
    }
}
 
Example #4
Source File: GrapheneCLITest.java    From Graphene with GNU General Public License v3.0 5 votes vote down vote up
@AfterTest
void printIfError() {
    if (asserted) {
        System.setOut(originalOut);
        System.setErr(originalErr);

        System.out.println(outContent.toString());
        System.err.println(errContent.toString());
    }
}
 
Example #5
Source File: TestBlackHoleSmoke.java    From presto with Apache License 2.0 5 votes vote down vote up
@AfterTest(alwaysRun = true)
public void tearDown()
{
    assertThatNoBlackHoleTableIsCreated();
    queryRunner.close();
    queryRunner = null;
}
 
Example #6
Source File: AndroidAppTest.java    From samples with MIT License 5 votes vote down vote up
@AfterTest
public void Teardown() {
    try {
        if (driver != null)
            driver.quit();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
Example #7
Source File: iOSAppTest.java    From samples with MIT License 5 votes vote down vote up
@AfterTest
public void Teardown() {
  try {
  	if(driver != null)
      driver.quit();
  } catch (Exception e) {
      e.printStackTrace();
  }
}
 
Example #8
Source File: CustomInvokeWithJsonPProviderTest.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@AfterTest
public void tearDownClient() {
    ConfigProviderResolver cpr = ConfigProviderResolver.instance();
    try {
        Config old = cpr.getConfig();
        cpr.releaseConfig(old);
    } catch (IllegalStateException ignored) {
    }
}
 
Example #9
Source File: CustomInvokeWithJsonBProviderTest.java    From quarkus with Apache License 2.0 5 votes vote down vote up
@AfterTest
public void tearDownClient() {
    ConfigProviderResolver cpr = ConfigProviderResolver.instance();
    try {
        Config old = cpr.getConfig();
        cpr.releaseConfig(old);
    } catch (IllegalStateException ignored) {
    }
}
 
Example #10
Source File: iOSWebTest.java    From samples with MIT License 5 votes vote down vote up
@AfterTest
public void Teardown() {
	try {
		if (driver != null)
			driver.quit();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example #11
Source File: AndroidAppTest.java    From samples with MIT License 5 votes vote down vote up
@AfterTest
public void Teardown() {
	try {
		if (driver != null)
			driver.quit();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example #12
Source File: AndroidWebTest.java    From samples with MIT License 5 votes vote down vote up
@AfterTest
public void Teardown() {
	try {
		if (driver != null)
			driver.quit();
	} catch (Exception e) {
		e.printStackTrace();
	}
}
 
Example #13
Source File: TimeTokenTest.java    From azure-cosmosdb-java with MIT License 5 votes vote down vote up
@AfterTest(groups = { "unit" })
public void afterMethod() {
    // set back default locale before test
    if (defaultLocale != null) {
        Locale.setDefault(defaultLocale);
    } else {
        Locale.setDefault(Locale.US);
    }
}
 
Example #14
Source File: HealthCareScenarioServerStartupTestCase.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
@SetEnvironment(executionEnvironments = { ExecutionEnvironment.STANDALONE })
@AfterTest(alwaysRun = true)
public void unDeployServices()
        throws MalformedURLException, LoginAuthenticationExceptionException, ExceptionException, RemoteException {
    if (axis2Server1 != null && axis2Server1.isStarted()) {
        axis2Server1.stop();
    }

}
 
Example #15
Source File: IOSTest.java    From coteafs-appium with Apache License 2.0 4 votes vote down vote up
/**
 * @author wasiqb
 * @since Oct 28, 2018
 */
@AfterTest(alwaysRun = true)
public void teardownTest() {
    this.server.stop();
}
 
Example #16
Source File: NoPersistenceCachingTest.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@AfterTest
public void setErrTest() {
   System.setErr(prevStderr);
}
 
Example #17
Source File: ParallelMethods.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@AfterTest
public void afterTest() {
    stepEight();
}
 
Example #18
Source File: FooRepositoryTestBase.java    From spring-test-examples with Apache License 2.0 4 votes vote down vote up
@AfterTest
public void cleanDb() {
  flyway.clean();
}
 
Example #19
Source File: BeanLinkerTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@AfterTest
public void afterTest() {
    this.linker = null;
}
 
Example #20
Source File: RequestBodyTest.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@AfterTest
public void teardown() throws Exception {
    exec.shutdownNow();
    LightWeightHttpServer.stop();
}
 
Example #21
Source File: DefaultTest.java    From coteafs-appium with Apache License 2.0 4 votes vote down vote up
/**
 * @author wasiq.bhamla
 * @since 17-Apr-2017 3:47:41 PM
 */
@AfterTest(alwaysRun = true)
public void tearDownTest() {
    this.androidDevice.stop();
    this.androidServer.stop();
}
 
Example #22
Source File: BaseTest.java    From appium-parallel-execution with MIT License 4 votes vote down vote up
@AfterTest
public void tearDown() {
    driver.quit();
}
 
Example #23
Source File: ParallelMethods.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@AfterTest
public void afterTest2() {
    stepEight();
}
 
Example #24
Source File: AppTestAndroid.java    From samples with MIT License 4 votes vote down vote up
@AfterTest
public void Teardown() {
    if (driver != null) {
        driver.quit();
    }
}
 
Example #25
Source File: AfterFixturesCombination.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@AfterTest
public void afterTest() {
    stepTwo();
}
 
Example #26
Source File: AllFeatures.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@AfterTest
public void afterTest2() throws IOException {
    addImgAttachment();
    addStringAttachment();
}
 
Example #27
Source File: AllFeatures.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@AfterTest
public void afterTest1() throws IOException {
    addImgAttachment();
    addStringAttachment();
}
 
Example #28
Source File: TestTagFixtures.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@AfterTest
public void afterTest2() {
    step();
}
 
Example #29
Source File: TestTagFixtures.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@AfterTest
public void afterTest1() {
    step();
}
 
Example #30
Source File: FailedAfterTest.java    From allure-java with Apache License 2.0 4 votes vote down vote up
@AfterTest
public void afterTest() throws Exception {
    throw new RuntimeException();
}