@AfterSuite public void after_suite() { Assert.assertEquals(orderMethods.size(), 8, "Incorrect size of called methods"); Assert.assertEquals(orderMethods.get(0), BEFORE_CLASS_BASE, "Incorrect called method by index 0"); Assert.assertEquals(orderMethods.get(1), BEFORE_CLASS_TEST_PUBLIC, "Incorrect called method by index 1"); Assert.assertEquals(orderMethods.get(2), BEFORE_METHOD_BASE, "Incorrect called method by index 2"); Assert.assertEquals(orderMethods.get(3), BEFORE_METHOD_TEST_PUBLIC, "Incorrect called method by index 3"); Assert.assertEquals(orderMethods.get(4), AFTER_METHOD_TEST_PUBLIC, "Incorrect called method by index 4"); Assert.assertEquals(orderMethods.get(5), AFTER_METHOD_BASE_PUBLIC, "Incorrect called method by index 5"); Assert.assertEquals(orderMethods.get(6), AFTER_CLASS_TEST_PUBLIC, "Incorrect called method by index 6"); Assert.assertEquals(orderMethods.get(7), AFTER_CLASS_BASE_PUBLIC, "Incorrect called method by index 7"); Assert.assertFalse(orderMethods.contains(BEFORE_CLASS_BASE_PRIVATE), "Private method with @OurBeforeClass from super class was called"); Assert.assertFalse(orderMethods.contains(BEFORE_METHOD_BASE_PRIVATE), "Private method with @OurBeforeMethod from super class was called"); Assert.assertFalse(orderMethods.contains(AFTER_METHOD_BASE_PRIVATE), "Private method with @OurAfterMethod from super class was called"); Assert.assertFalse(orderMethods.contains(AFTER_CLASS_BASE_PRIVATE), "Private method with @OurAfterClass from super class was called"); }
@AfterSuite public void cleanupAfterSuite(ITestContext context) { if( suite != null ) { @SuppressWarnings("unchecked") List<CleanupAfter> cleanups = (List<CleanupAfter>) suite.getAttribute("cleanups"); if( cleanups != null ) { ListIterator<CleanupAfter> listIterator = cleanups.listIterator(cleanups.size()); while( listIterator.hasPrevious() ) { CleanupAfter cleanup = listIterator.previous(); if( cleanup != null ) { cleanup.cleanUp(); } } } } }
@AfterSuite(groups={"init"}) public static void tearDownAfterSuite() throws Exception { System.out.println("CLOSING CASSANDRA CONNECTION"); if(dynamicCluster){ System.out.println("Stopping nodes"); clusterHasBuilt = false; try{ ccmBridge.forceStop(); System.out.println("Discarding cluster"); ccmBridge.remove(); HOST = System.getProperty("host", ConnectionDetails.getHost()); }catch(Exception e){ System.out.println("Silent error discarding cluster"); } } }
public static Annotation getValue(Method javaMethod, Class <? extends Annotation > annotationClass) { Annotation annotation = javaMethod.getAnnotation(annotationClass); if (annotation == null) { boolean skip = false; // Filter out the usual Annotations. Annotation[] annots = javaMethod.getAnnotations(); for (Annotation an : annots) { if (an.annotationType().equals(BeforeMethod.class) || an.annotationType().equals(AfterMethod.class) || an.annotationType().equals(BeforeSuite.class) || an.annotationType().equals(AfterSuite.class) || an.annotationType().equals(BeforeTest.class) || an.annotationType().equals(AfterTest.class)) { skip = true; break; } } if (!skip) { annotation = javaMethod.getDeclaringClass().getAnnotation(annotationClass); } } return annotation; }
@AfterSuite public void afterSuite() throws Exception { ZKClientPool.reset(); if (_gZkClient != null) { _gZkClient.close(); _gZkClient = null; } if (_zkServer != null) { TestHelper.stopZkServer(_zkServer); _zkServer = null; } if (_gZkClientTestNS != null) { _gZkClientTestNS.close(); _gZkClientTestNS = null; } if (_zkServerTestNS != null) { TestHelper.stopZkServer(_zkServerTestNS); _zkServerTestNS = null; } }
/** * Stop RC server if it's running. */ @AfterSuite(alwaysRun = true) private void stopRCServer() { if (isRCStarted) { Object server = seleniumServer[0]; Method stopMethod = (Method) seleniumServer[1]; try { stopMethod.invoke(server); } catch (Exception e) { STEVIA_TEST_BASE_LOG.warn("Failed to shutdown the Selenium Server",e); } } }
@BeforeSuite @AfterSuite(alwaysRun=true) public static void deleteRoot() throws Exception { // always use standard HTTP requestor for delete root DbxClientV2 client = newClientV2( newRequestConfig() .withHttpRequestor(newStandardHttpRequestor()) ); try { client.files().delete(RootContainer.ROOT); } catch (DeleteErrorException ex) { if (ex.errorValue.isPathLookup() && ex.errorValue.getPathLookupValue().isNotFound()) { // ignore } else { throw ex; } } }
/** * @author wasiq.bhamla * @since 17-Apr-2017 3:47:41 PM */ @AfterSuite (alwaysRun = true) public void tearDownTestSuite () { if (this.androidServer != null && this.androidDevice != null) { this.androidDevice.stop (); this.androidServer.stop (); } }
@AfterSuite public void afterSuite(){ System.out.println("BaseCase: afterSuite"); Log.close(); TestReport.endTime = DateUtil.getNow("yyyy-MM-dd HH:mm:ss"); TestReport.endMsTime = DateUtil.getNow("yyyy-MM-dd HH:mm:ss.SSS"); System.out.println("case����--->" + TestReport.caseCount); System.out.println("fail����--->"+TestReport.failureCount); System.out.println("success����--->"+TestReport.successCount); System.out.println("skip����--->"+TestReport.skipedCount); if(! LogConfig.receivers.equals("")){ new TestReport(LogConfig.receivers, LogConfig.subject).sendReport(); } }
@AfterSuite public void setUpAfterClass() throws Exception { // System.out.println("@AfterSuite -> TestBase.setUpAfterClass"); MonarchUtils.getConnection(new HashMap<String, String>(1){{ put(MonarchUtils.LOCATOR_PORT, testBase.getLocatorPort()); }}).close(); testBase.tearDown2(); }
@AfterSuite public void setUpAfterClass() throws Exception { // System.out.println("@AfterSuite -> TestBase.setUpAfterClass"); /*MonarchUtils.getConnection(new HashMap<String, String>(1){{ put(MonarchUtils.LOCATOR_PORT, testBase.getLocatorPort()); }}).close();*/ MonarchUtils.getConnection(MonarchUtils.LOCATOR_PORT, testBase.getLocatorPort()).close(); testBase.tearDown2(); }
@AfterSuite public void tearDown() { if (!skipTest) { if (s3Connection != null) { assert s3Bucket != null && executorService != null : "must have been initialized in setup()"; cleanS3(s3Connection, s3Bucket); executorService.shutdownNow(); } } }
/** * Code run after entire suite. * @throws Exception if an error occurs */ @AfterSuite(groups = {TestGroup.UNIT_DB, TestGroup.INTEGRATION }) public static final void tearDownSuite() throws Exception { for (DbConnector connector : s_connectors.values()) { ReflectionUtils.close(connector); } }
@AfterSuite protected static void destroy() throws Exception { if (logger.isInfoEnabled()) { logger.info("Unbinding jdbc/WSO2MetricsDB"); } InitialContext ic = new InitialContext(); ic.unbind("jdbc/WSO2MetricsDB"); ic.unbind("jdbc"); if (logger.isInfoEnabled()) { logger.info("Stopping reporters"); } metrics.deactivate(); }
@AfterSuite protected static void destroy() throws Exception { if (logger.isInfoEnabled()) { logger.info("Deactivating Metrics"); } metrics.deactivate(); }
@AfterSuite(alwaysRun = true) public void tearDown() throws Exception { try { if (this.mgmt != null) { Entities.destroyAll(this.mgmt); } } catch (Throwable e) { LOG.error("Caught exception in tearDown method", e); } finally { this.mgmt = null; if (origFeatureEnablement != null) { BrooklynFeatureEnablement.setDefault(ToscaTypePlanTransformer.FEATURE_TOSCA_ENABLED, origFeatureEnablement); } } }
/** * Stops WireMock when all tests are executed. */ @AfterSuite public void afterClass() { logger.debug("========== Stopping WireMock =========="); if (wireMockServer != null) { wireMockServer.stop(); wireMockServer = null; } }
@AfterSuite public final void tearDownServer() { log.debug("...Stopping Server..."); try { server.stop(); } catch (Exception e) { log.debug(e.getMessage()); } }
@AfterSuite public void tearDownClass() { if (executor != null) { executor.shutdownNow(); executor = null; } }
@AfterSuite(alwaysRun = true) public static void jdiTearDown() throws IOException { LocalDateTime date = Instant.ofEpochMilli(21 * 3600000 + getTestRunTime()) .atZone(ZoneId.systemDefault()) .toLocalDateTime(); String formattedTime = DateTimeFormatter.ofPattern("HH:mm:ss.S").format(date); logger.info("Test run finished. " + LINE_BREAK + "Total test run time: " + formattedTime); if (WebSettings.killBrowser.toLowerCase().contains("after")) killAllRunWebBrowsers(); }
@AfterSuite public static void jdiTearDown() { if (WinSettings.driverFactory instanceof WiniumDriverFactory) { WiniumDriverFactory winiumDriverFactory = (WiniumDriverFactory) WinSettings.driverFactory; winiumDriverFactory.getDriver("winniumdesctop").close(); //Can be useful only for *.exe applications Process process = winiumDriverFactory.getStartedProcess(); if (process != null) process.destroy(); // killAllRunDrivers(); } }
/** * 1) This will uninstall the app. 2) This will create an index.html file in * output folder to list down the test runs. * * @throws IOException * @throws MessagingException * @throws AddressException */ @AfterSuite(alwaysRun = true, groups = { "Android", "iOS" }) public void createIndexFile(ITestContext testContext) throws IOException{ String root = PropertyLoader.loadProperty("output.path").get(); testLogger.info("report path " + root); int pathLevel = root.split("/").length; String reportFolder = root.split("/")[pathLevel - 1]; int numberOfPassedTests = testContext.getPassedTests().size(); int numberOfFailedTests = testContext.getFailedTests().size(); int numberOfSkippedTests = testContext.getSkippedTests().size(); String summaryFileName = "runSummary.csv"; String summaryFilePath = root + "/.."; String summaryReport = reportFolder + "," + numberOfPassedTests + "," + numberOfFailedTests + "," + numberOfSkippedTests; FileGenerator.appendTextToBeginingOfFile(summaryFilePath, summaryFileName, summaryReport); testLogger.info(reportFolder); testLogger.info("Passed: " + numberOfPassedTests); testLogger.info("Failed: " + numberOfFailedTests); testLogger.info("Skipped: " + numberOfSkippedTests); FileGenerator.generateBarGraphIndexHTML(summaryFilePath); String parentFolder = root + "/../.."; for (int i = 1; i < pathLevel; i++) { FileGenerator.generateIndexHTML(parentFolder.toString()); parentFolder = parentFolder + "/.."; } }
@AfterSuite(groups = LONG_RUNNING) public void deleteServer() { ServerMetadata serverStateBeforeDelete = loadMetadataOf(server); serverService.delete(server); assertThatServerProperlyStarted(serverStateBeforeDelete); }
@AfterSuite public void afterSuite() throws Exception { if( cleanupTemp ) { final long now = System.currentTimeMillis(); boolean empty = true; if( !java.nio.file.Files.exists( Env.tmp ) ) return; try( val stream = java.nio.file.Files.newDirectoryStream( Env.tmp ) ) { for( Path build : stream ) { final boolean self = Env.tmpRoot.equals( build ); final long lastModified = java.nio.file.Files.getLastModifiedTime( build ).toMillis(); final long diff = now - lastModified; if( self || diff > TEN_HOURS ) { log.info( "delete {}", build ); deleteDirectory( build ); } else { log.info( "skip {}, self = {}, diff = {}", build, self, diff ); log.trace( "build={}, env={}", build ); log.trace( "now={}, lastModified={}", now, lastModified ); empty = false; } } } if( empty ) deleteDirectory( Env.tmp ); } }
@AfterSuite public void tearDown() { File propFile = new File(location, "hello world.docx"); propFile.setWritable(true); propFile.delete(); Assert.assertFalse(propFile.exists()); }
@AfterSuite public void tearDown() throws SecurityException { File propFile = new File(location, "hello world.docx"); propFile.setWritable(true); propFile.delete(); Assert.assertFalse(propFile.exists()); }
@AfterSuite public void tearDown() throws IOException { // Files.delete(Paths.get(location, "hello world.pptx")); File propFile = new File(location, "hello world.pptx"); propFile.setWritable(true); propFile.delete(); Assert.assertFalse(propFile.exists()); }
@AfterSuite public void tearDown() { File propFile = new File(location, "hello world.pptx"); propFile.setWritable(true); propFile.delete(); Assert.assertFalse(propFile.exists()); }
@AfterSuite(alwaysRun=true) public void shutdown() { try { SelectiveHarvestPageHelper.deactivateAllHarvests(); driver.close(); } catch (Exception e) { e.printStackTrace(); } }
@AfterSuite public void afterSuite() throws IOException { try { _kafkaTestHelper.stopClients(); } finally { _kafkaTestHelper.stopServers(); } }
@AfterSuite public void afterSuite() throws IOException { try { kafkaTestHelper.stopClients(); } finally { kafkaTestHelper.stopServers(); } }
@AfterSuite public static void cleanup() { try { aerospike.close(); } catch (Exception e) { LOG.error("Error while closing Aerospike client connection", e); } }
@AfterSuite public static void cleanup() { try { if (mongodExecutable != null) { mongodExecutable.stop(); } } finally { Files.forceDelete(new File(DB_FOLDER_NAME)); } }
@AfterSuite public static void cleanup() throws IOException { deleteDataSet(); if (node != null) { node.stop(); client.close(); } File file = new File(DB_FOLDER_NAME); FileUtils.deleteDirectory(file); }
@AfterSuite protected void disposeServerAndRdd() throws IOException { if (cassandraServer != null) { cassandraServer.shutdown(); } }
@AfterSuite public void afterSuite() { try { if(scheduler!= null){ scheduler.shutdown(); } } catch ( SchedulerException e ) { e.printStackTrace(); } }
@AfterSuite(alwaysRun = true) public void afterSuite() { _gZkClient.close(); TestHelper.stopZkServer(_zkServer); _zkServer = null; // System.out.println("Number of open zkClient after ZkUnitTests: " // + ZkClient.getNumberOfConnections()); }
@AfterSuite public void afterSuite() { // System.out.println("START AdminTestBase.afterSuite() at " + new // Date(System.currentTimeMillis())); // stop admin _adminThread.stop(); // stop zk ZKClientPool.reset(); _gZkClient.close(); TestHelper.stopZkServer(_zkServer); // System.out.println("END AdminTestBase.afterSuite() at " + new // Date(System.currentTimeMillis())); }