Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Not A Problem
-
2.14, 2.15
-
None
-
None
-
Apache Maven 3.0.4 (r1232337; 2012-01-17 16:44:56+0800)
Maven home: D:\Maven\apache-maven-3.0.4
Java version: 1.6.0_26, vendor: Sun Microsystems Inc.
Java home: C:\Program Files\Java\jdk1.6.0_26\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"Apache Maven 3.0.4 (r1232337; 2012-01-17 16:44:56+0800) Maven home: D:\Maven\apache-maven-3.0.4 Java version: 1.6.0_26, vendor: Sun Microsystems Inc. Java home: C:\Program Files\Java\jdk1.6.0_26\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"
-
Patch
Description
Method with @AfterTest annotation are never been called if use the 'Running a Single Test' feature for testng.
There are two classes in test project.
BaseTest # only has one method cleanUp with @AfterTest. it just prints out a string 'clean up'
MyTest # inherit from BaseTest (cases: testPlus, testSubtract, testMultiplication)
1).Cmd: mvn test
Result:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Configuring TestNG with: TestNG652Configurator
clean up <==================================== Right @AfterClass method outputs
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.322 sec
Results :
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.662s
[INFO] Finished at: Sun Apr 07 20:21:41 CST 2013
[INFO] Final Memory: 7M/244M
[INFO] ------------------------------------------------------------------------
2).Cmd: mvn test -Dtest=MyTest#testPlus
Result:
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running MyTest
Configuring TestNG with: TestNG652Configurator
<==================================== where is 'clean up'
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.292 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.641s
[INFO] Finished at: Sun Apr 07 20:25:22 CST 2013
[INFO] Final Memory: 7M/244M
[INFO] ------------------------------------------------------------------------
I find a workaround to resolve this problem. Please see the attachment.
Attachments
Attachments
Issue Links
- duplicates
-
SUREFIRE-1065 Allow includesFile and excludesFile parameters to be set from the commandline
- Closed