[GRADLE-2540] TestNG test events contain TestDescriptors without correct parent Created: 29/Oct/12  Updated: 04/Jan/13  Resolved: 13/Nov/12

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Szczepan Faber Assignee: Unassigned
Resolution: Not A Bug Votes: 0


The test abstraction over JUnit and TestNG is not quite correct wrt TestDescriptors. An event received from the TestNG execution contain TestDescriptor that has a parent of the entire suite. I'd expect the parent to be the descriptor for the test class. This is the case for JUnit tests.

I don't think this is a huge problem. However, it's worth keeping this in mind when we improve TestNG. Perhaps it's something easily done as a side job. If we do it it is a breaking change in a way. However, it's a change for better I think.

Comment by Adam Murdoch [ 13/Nov/12 ]

The parent of a test refers to the context of where the test is executing. The parent of a testng test (method) is the test suite. The parent of a junit test (method) is usually, but not always, the class that the method belongs to.

If you want to find out the class of a test, use TestDescriptor.getClassName().

Comment by Szczepan Faber [ 14/Nov/12 ]

Ok, makes sense.

Generated at Wed Jun 30 12:24:43 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.