-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Priority in Configuration Methods #2662
base: master
Are you sure you want to change the base?
Conversation
cd9cbf2
to
5cc17a5
Compare
I got some time to clean up the code and added one simple test. |
public class ConfigurationMethodPriorityTest extends SimpleBaseTest { | ||
|
||
@Test(description = "GITHUB-2662") | ||
public void ensureThatPriorityWorksOnConfigratuionMethods() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please help fix the typo in the method name ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
import org.testng.TestNG; | ||
import org.testng.annotations.Test; | ||
|
||
public class ConfigurationMethodPriorityTest extends SimpleBaseTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we please add tests for the following combination ?
- Multiple
@BeforeXX
methods with different priorities across multiple classes (Multi level inheritance) - Multiple
@BeforeXX
methods with different priorities across multiple classes (No inheritance, but the configuration method just resides in a different class. This would be true in the case of@BeforeTest
and@BeforeSuite
and perhaps even@BeforeGroups
as well) - Multiple
@BeforeXX
methods with same priorities in same class - Multiple
@BeforeXX
methods with same priorities in different class (Multi level inheritance) - Multiple
@BeforeXX
methods with same priorities in different class (No multi level inheritance)
(3), (4), (5)
- is to check if the logic defined here is getting utilised properly - Multiple
@BeforeSuite
methods with different priorities defined across multiple<suite>
tags. - Multiple
@BeforeSuite
methods with same priorities defined across multiple<suite>
tags. - Multiple
@BeforeSuite
methods with different priorities defined across multiple<suite>
tags and withparallel
attribute set to<test>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try to find the test for Test Annotation and implement in a similar way
import org.testng.TestNG; | ||
import org.testng.annotations.Test; | ||
|
||
public class ConfigurationMethodPriorityTest extends SimpleBaseTest { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also please add a reference of this class under src/test/resources/testng.xml
so that it gets executed as part of the test execution.
Also please house this class, the test class sample that this test uses and all new test samples that we would be needing, under the package test.configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
CHANGES.txt
Outdated
@@ -1,4 +1,5 @@ | |||
Current | |||
New: GITHUB-2662 Add support for Priority in Configuration Methods. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please help create a new GITHUB issue and add details to that issue and have this updated to refer to that issue ? That way it would be easier to track. Also please add reference to your name ( We dont want to miss giving credit for this delivery to you)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Many thanks I will try to fix these comments during the day? |
5cc17a5
to
0bd597d
Compare
Can not write unit test due to new issue found |
d4be735
to
d3346b7
Compare
"beforeMethodA", | ||
"TestB", | ||
"afterMethodB", | ||
"afterMethodA", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afterMethodA
is not supposed to be run as TestA
was not run yet.
"TestB", | ||
"afterMethodB", | ||
"afterMethodA", | ||
"beforeMethodB", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beforeMethodB
and beforeMethodA
are not supposed to be run as they were already run previously.
public void ensureThatPriorityWorksOnConfigurationMethodsWithMethodDependency() { | ||
List<String> expectedOrder1 = | ||
Arrays.asList( | ||
"s3", "s2", "s1", "t3", "t2", "t1", "c3", "c2", "c1", "m3", "m2", "m1", "test3", "m3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you rename methods in order to make them easy to read in the assertion?
tng.addListener(listener); | ||
tng.run(); | ||
System.out.println(expectedOrder1); | ||
System.out.println(listener.getSucceedMethodNames()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove syso :)
I will do the cleanup of comments and add more unit tests when #2664 is sorted out. since it is blocking this PR. |
d3346b7
to
aef1243
Compare
Fix #2663