[testng] 332/355: Add test cases for AfterSuite

Eugene Zhukov eugene-guest at moszumanska.debian.org
Tue Aug 18 10:20:21 UTC 2015


This is an automated email from the git hooks/post-receive script.

eugene-guest pushed a commit to annotated tag OpenBSD
in repository testng.

commit 122aa0c1804804bd73fd4ba665c4a9753fb7cc0d
Author: Julien Herr <julien.herr at alcatel-lucent.com>
Date:   Tue May 12 13:14:47 2015 +0200

    Add test cases for AfterSuite
---
 src/test/java/test/enable/A.java                   | 28 ++++++++++++++++++++++
 src/test/java/test/enable/B.java                   | 28 ++++++++++++++++++++++
 src/test/java/test/enable/C.java                   | 28 ++++++++++++++++++++++
 src/test/java/test/enable/EnableTest.java          | 10 +++++---
 .../java/test/enable/Issue420BaseTestCase.java     | 12 +++++++++-
 5 files changed, 102 insertions(+), 4 deletions(-)

diff --git a/src/test/java/test/enable/A.java b/src/test/java/test/enable/A.java
index 45bd922..59a79aa 100644
--- a/src/test/java/test/enable/A.java
+++ b/src/test/java/test/enable/A.java
@@ -1,5 +1,6 @@
 package test.enable;
 
+import org.testng.annotations.AfterSuite;
 import org.testng.annotations.BeforeSuite;
 import org.testng.annotations.Test;
 
@@ -42,4 +43,31 @@ public class A {
 
   @BeforeSuite(enabled = false, alwaysRun = true)
   public void disabledBeforeSuiteRunA() {}
+
+  @AfterSuite
+  public void afterSuiteA() {}
+
+  @AfterSuite(enabled = true)
+  public void afterSuiteA2() {}
+
+  @AfterSuite(enabled = false)
+  public void disabledAfterSuiteA() {}
+
+  @AfterSuite(alwaysRun = false)
+  public void afterSuiteNoRunA() {}
+
+  @AfterSuite(enabled = true, alwaysRun = false)
+  public void afterSuiteNoRunA2() {}
+
+  @AfterSuite(enabled = false, alwaysRun = false)
+  public void disabledAfterSuiteNoRunA() {}
+
+  @AfterSuite(alwaysRun = true)
+  public void afterSuiteRunA() {}
+
+  @AfterSuite(enabled = true, alwaysRun = true)
+  public void afterSuiteRunA2() {}
+
+  @AfterSuite(enabled = false, alwaysRun = true)
+  public void disabledAfterSuiteRunA() {}
 }
diff --git a/src/test/java/test/enable/B.java b/src/test/java/test/enable/B.java
index c486438..8c9c4f3 100644
--- a/src/test/java/test/enable/B.java
+++ b/src/test/java/test/enable/B.java
@@ -1,5 +1,6 @@
 package test.enable;
 
+import org.testng.annotations.AfterSuite;
 import org.testng.annotations.BeforeSuite;
 import org.testng.annotations.Test;
 
@@ -43,4 +44,31 @@ public class B {
 
   @BeforeSuite(enabled = false, alwaysRun = true)
   public void disabledBeforeSuiteRunB() {}
+
+  @AfterSuite
+  public void afterSuiteB() {}
+
+  @AfterSuite(enabled = true)
+  public void afterSuiteB2() {}
+
+  @AfterSuite(enabled = false)
+  public void disabledAfterSuiteB() {}
+
+  @AfterSuite(alwaysRun = false)
+  public void afterSuiteNoRunB() {}
+
+  @AfterSuite(enabled = true, alwaysRun = false)
+  public void afterSuiteNoRunB2() {}
+
+  @AfterSuite(enabled = false, alwaysRun = false)
+  public void disabledAfterSuiteNoRunB() {}
+
+  @AfterSuite(alwaysRun = true)
+  public void afterSuiteRunB() {}
+
+  @AfterSuite(enabled = true, alwaysRun = true)
+  public void afterSuiteRunB2() {}
+
+  @AfterSuite(enabled = false, alwaysRun = true)
+  public void disabledAfterSuiteRunB() {}
 }
diff --git a/src/test/java/test/enable/C.java b/src/test/java/test/enable/C.java
index 7794036..edf7a8b 100644
--- a/src/test/java/test/enable/C.java
+++ b/src/test/java/test/enable/C.java
@@ -1,5 +1,6 @@
 package test.enable;
 
+import org.testng.annotations.AfterSuite;
 import org.testng.annotations.BeforeSuite;
 import org.testng.annotations.Test;
 
@@ -43,4 +44,31 @@ public class C {
 
   @BeforeSuite(enabled = false, alwaysRun = true)
   public void disabledBeforeSuiteRunC() {}
+
+  @AfterSuite
+  public void afterSuiteC() {}
+
+  @AfterSuite(enabled = true)
+  public void afterSuiteC2() {}
+
+  @AfterSuite(enabled = false)
+  public void disabledAfterSuiteC() {}
+
+  @AfterSuite(alwaysRun = false)
+  public void afterSuiteNoRunC() {}
+
+  @AfterSuite(enabled = true, alwaysRun = false)
+  public void afterSuiteNoRunC2() {}
+
+  @AfterSuite(enabled = false, alwaysRun = false)
+  public void disabledAfterSuiteNoRunC() {}
+
+  @AfterSuite(alwaysRun = true)
+  public void afterSuiteRunC() {}
+
+  @AfterSuite(enabled = true, alwaysRun = true)
+  public void afterSuiteRunC2() {}
+
+  @AfterSuite(enabled = false, alwaysRun = true)
+  public void disabledAfterSuiteRunC() {}
 }
diff --git a/src/test/java/test/enable/EnableTest.java b/src/test/java/test/enable/EnableTest.java
index 60439ea..299b0f5 100644
--- a/src/test/java/test/enable/EnableTest.java
+++ b/src/test/java/test/enable/EnableTest.java
@@ -21,7 +21,10 @@ public class EnableTest extends SimpleBaseTest {
         "beforeSuiteA", "beforeSuiteA2", "beforeSuiteNoRunA", "beforeSuiteNoRunA2", "beforeSuiteRunA", "beforeSuiteRunA2",
         "beforeSuiteRunB", "beforeSuiteRunB2",
         "beforeSuiteC", "beforeSuiteC2", "beforeSuiteNoRunC", "beforeSuiteNoRunC2", "beforeSuiteRunC", "beforeSuiteRunC2",
-        "testA2", "testA3", "testB2", "testB3", "testC", "testC2", "testC3"
+        "testA2", "testA3", "testB2", "testB3", "testC", "testC2", "testC3",
+        "afterSuiteA", "afterSuiteA2", "afterSuiteNoRunA", "afterSuiteNoRunA2", "afterSuiteRunA", "afterSuiteRunA2",
+        "afterSuiteRunB", "afterSuiteRunB2",
+        "afterSuiteC", "afterSuiteC2", "afterSuiteNoRunC", "afterSuiteNoRunC2", "afterSuiteRunC", "afterSuiteRunC2"
     );
   }
 
@@ -33,8 +36,9 @@ public class EnableTest extends SimpleBaseTest {
     tng.run();
 
     assertThat(listener.getInvokedMethods()).containsExactly(
-        "initEnvironment",
-        "verifySomethingFirstSample", "verifySomethingSecondSample"
+        "alwaysBeforeSuite", "beforeSuite",
+        "verifySomethingFirstSample", "verifySomethingSecondSample",
+        "afterSuite", "alwaysAfterSuite"
     );
   }
 }
diff --git a/src/test/java/test/enable/Issue420BaseTestCase.java b/src/test/java/test/enable/Issue420BaseTestCase.java
index 1c41077..d605dfb 100644
--- a/src/test/java/test/enable/Issue420BaseTestCase.java
+++ b/src/test/java/test/enable/Issue420BaseTestCase.java
@@ -1,9 +1,19 @@
 package test.enable;
 
+import org.testng.annotations.AfterSuite;
 import org.testng.annotations.BeforeSuite;
 
 public abstract class Issue420BaseTestCase {
 
   @BeforeSuite(alwaysRun = true)
-  public static void initEnvironment() {}
+  public static void alwaysBeforeSuite() {}
+
+  @BeforeSuite(alwaysRun = false)
+  public static void beforeSuite() {}
+
+  @AfterSuite(alwaysRun = false)
+  public static void afterSuite() {}
+
+  @AfterSuite(alwaysRun = true)
+  public static void alwaysAfterSuite() {}
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/testng.git



More information about the pkg-java-commits mailing list