[GRADLE-1189] TestNG @BeforeTest does not work as expected for groovy plugin and useTestNG() Created: 26/Oct/10 Updated: 04/Jan/13 Resolved: 24/Nov/10 |
|
| Status: | Resolved |
| Project: | Gradle |
| Affects Version/s: | 0.9 |
| Fix Version/s: | 0.9-rc-2 |
| Type: | Bug | ||
| Reporter: | Sargis Harutyunyan | Assignee: | Hans Dockter |
| Resolution: | Fixed | Votes: | 0 |
| Attachments: |
|
| Description |
|
Hi I have following build.gradle: apply plugin: 'idea' sourceCompatibility = 1.6 repositories { dependencies { testCompile group: 'org.testng', name: 'testng', version: '5.14.1' test { and here is my tests: class BeforeTestBugTest { List<String> testList @BeforeTest @Test @Test } here is test result: <test-method status="FAIL" signature="testNumber02()" name="testNumber02" duration-ms="0" started-at="2010-10-26T21:58:05Z" finished-at="2010-10-26T21:58:05Z"> You can find ass attached file full test result. Also something interesting in my test result: <test-method status="PASS" signature="setUp()" name="setUp" is-config="true" duration-ms="14" started-at="2010-10-26T21:58:04Z" finished-at="2010-10-26T21:58:05Z"> as I understand my method annotated with @BeforeTest running as simple, test but not sure. Thanks in advaance. |
| Comments |
| Comment by Sargis Harutyunyan [ 26/Oct/10 ] |
|
I checked for java project with ant with the same TestNG version it works fine |
| Comment by Adam Murdoch [ 26/Oct/10 ] |
|
According to the TestNG documentation, methods marked @BeforeTest are run once before TestNG executes any test methods. Methods marked @BeforeTest are not run before each test method. You need to use @BeforeMethod for that. The relevant documentation can be found here: http://testng.org/doc/documentation-main.html#annotations You might also have a look at http://jira.opensymphony.com/browse/TESTNG-223. It describes almost exactly the same situation you describe above. It is marked as 'not a problem'. So, this seems to be a bug with the Ant tasks, rather than Gradle. |
| Comment by Sargis Harutyunyan [ 27/Oct/10 ] |
|
H, you are absolutely right, I should read more carefully TestNG doc instead of rely on Ant results |
| Comment by Sargis Harutyunyan [ 27/Oct/10 ] |
|
Probably problem not in ANT also bacause for ANT I used: <suite name="UnitTestsSuite" verbose="2" parallel="false"> And with this config @BeforeTest was ok. Anyway thanks once more |