下面列出了怎么用org.testng.annotations.AfterSuite的API类实例代码及写法,或者点击链接到github查看源代码。
@AfterSuite(groups = "samples")
public void cleanupStaleDatabase() {
ConnectionPolicy connectionPolicy = new ConnectionPolicy();
connectionPolicy.setConnectionMode(ConnectionMode.Direct);
RetryOptions options = new RetryOptions();
connectionPolicy.setRetryOptions(options);
AsyncDocumentClient client = this.clientBuilder()
.withServiceEndpoint(TestConfigurations.HOST)
.withMasterKeyOrResourceToken(TestConfigurations.MASTER_KEY)
.withConnectionPolicy(connectionPolicy)
.build();
safeCleanDatabases(client);
client.close();
}
@AfterSuite(alwaysRun = true)
public void shutdownEngine() {
if (engine != null) {
shutdownEngine(engine);
}
executorService.shutdown();
}
@AfterSuite(groups = {"simple", "long", "direct", "multi-master", "emulator", "non-emulator"}, timeOut = SUITE_SHUTDOWN_TIMEOUT)
public static void afterSuite() {
logger.info("afterSuite Started");
AsyncDocumentClient houseKeepingClient = createGatewayHouseKeepingDocumentClient().build();
try {
safeDeleteDatabase(houseKeepingClient, SHARED_DATABASE);
DatabaseForTest.cleanupStaleTestDatabases(DatabaseManagerImpl.getInstance(houseKeepingClient));
} finally {
safeClose(houseKeepingClient);
}
}
@AfterSuite
public void afterSuite(ITestContext context) {
System.gc(); // Hint JVM to clear unreference objects. Just to help detect ByteBuf object leaks.
restServer.stop();
server.stop();
broker.stopMessageDelivery();
LOGGER.info("Stopped broker for suite " + context.getSuite().getName());
}
@AfterSuite
public void afterSuite(ITestContext context) {
System.gc(); // Hint JVM to clear unreference objects. Just to help detect ByteBuf object leaks.
restServer.stop();
server.stop();
broker.stopMessageDelivery();
LOGGER.info("Stopped broker for suite " + context.getSuite().getName());
}
@AfterSuite
public void Teardown() {
try {
if(driver != null)
driver.quit();
} catch (Exception e) {
e.printStackTrace();
}
}
@AfterSuite
public void shutdown() {
executor.shutdown();
}
@AfterSuite
public void shutdown() {
executor.shutdown();
}
@AfterSuite(alwaysRun = true)
public void tearDown() throws Exception {
shutdownDatabase();
}
@AfterSuite
// After the suite is done, dump any errors to output
public void dumpErrors() {
if (!suiteErrors.isEmpty())
System.err.println("Errors found in test suite: " + suiteErrors);
}
@AfterSuite
public void cleanupCompilerCache() {
Compiler.purgeCache();
}
@AfterSuite
public void cleanupSuite() {
}
@AfterSuite
public void cleanupSuite() {
}
@AfterSuite
// After the suite is done, dump any errors to output
public void dumpErrors() {
if (!suiteErrors.isEmpty())
System.err.println("Errors found in test suite: " + suiteErrors);
}
@AfterSuite
public void cleanupCompilerCache() {
Compiler.purgeCache();
}
@AfterSuite(alwaysRun = true)
public void tearDownOnce() throws IOException, DatabricksRestException {
//We remove all clusters with the prefix
TestUtil.cleanupTestClusters(service, TestUtil.getTestClusters(service));
}
@AfterSuite(alwaysRun = true)
public static void closeDriverObjects() {
for (DriverFactory webDriverThread : webDriverThreadPool) {
webDriverThread.quitDriver();
}
}
@AfterSuite(alwaysRun = true)
public static void closeDriverObjects() {
for (DriverFactory webDriverThread : webDriverThreadPool) {
webDriverThread.quitDriver();
}
}
@AfterSuite(alwaysRun = true)
public static void closeDriverObjects() {
for (DriverFactory webDriverThread : webDriverThreadPool) {
webDriverThread.quitDriver();
}
}
@AfterSuite(alwaysRun = true)
public static void closeDriverObjects() {
for (DriverFactory webDriverThread : webDriverThreadPool) {
webDriverThread.quitDriver();
}
}
@AfterSuite(alwaysRun = true)
public static void closeDriverObjects() {
for (DriverFactory webDriverThread : webDriverThreadPool) {
webDriverThread.quitDriver();
}
}
@AfterSuite(alwaysRun = true)
public static void closeDriverObjects() {
for (AppiumFactory appiumFactory : webDriverThreadPool) {
appiumFactory.quitDriver();
}
}
@AfterSuite(alwaysRun = true)
public static void closeDriverObjects() {
for (DriverFactory webDriverThread : webDriverThreadPool) {
webDriverThread.quitDriver();
}
}
@AfterSuite(alwaysRun = true)
public static void closeDriverObjects() {
for (DriverFactory webDriverThread : webDriverThreadPool) {
webDriverThread.quitDriver();
}
}
@AfterSuite(alwaysRun = true)
public static void closeDriverObjects() {
for (DriverFactory webDriverThread : webDriverThreadPool) {
webDriverThread.quitDriver();
}
}
@AfterSuite
public static void cleanUpDriver() {
driver.quit();
}
@AfterSuite(alwaysRun = true)
public static void closeDriverObjects() {
for (DriverFactory webDriverThread : webDriverThreadPool) {
webDriverThread.quitDriver();
}
}
@AfterSuite(alwaysRun = true)
public static void closeDriverObjects() {
for (DriverFactory webDriverThread : webDriverThreadPool) {
webDriverThread.quitDriver();
}
}
@AfterSuite(alwaysRun = true)
public static void closeDriverObjects() {
for (DriverFactory webDriverThread : webDriverThreadPool) {
webDriverThread.quitDriver();
}
}
@AfterSuite(alwaysRun = true)
public static void closeDriverObjects() {
for (DriverFactory webDriverThread : webDriverThreadPool) {
webDriverThread.quitDriver();
}
}