Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Current
Fixed: GITHUB-2653: Assert methods requires casting since TestNg 7.0 for mixed boxed and unboxed primitives in assertEquals.
New: GITHUB-2663 Add support for Priority in Configuration Methods. (Martin Aldrin)
Fixed: GITHUB-2653: Assert methods requires casting since TestNg 7.0 for mixed boxed and unboxed primitives in assertEquals. (Martin Aldrin)
Fixed: GITHUB-2229: Restore @BeforeGroups and @AfterGroups Annotations functionality (Krishnan Mahadevan)
Fixed: GITHUB-2563: Skip test if its data provider provides no data (Krishnan Mahadevan)
Fixed: GITHUB-2535: TestResult.getEndMillis() returns 0 for skipped configuration - after upgrading testng to 7.0 + (Krishnan Mahadevan)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,11 @@
* @return the value (default 0)
*/
long timeOut() default 0;

/**
* The scheduling priority. Lower priorities will be scheduled first.
*
* @return the value (default 0)
*/
int priority() default 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,11 @@
* @return the value (default 0)
*/
long timeOut() default 0;

/**
* The scheduling priority. Lower priorities will be scheduled first.
*
* @return the value (default 0)
*/
int priority() default 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,11 @@
* @return the value (default 0)
*/
long timeOut() default 0;

/**
* The scheduling priority. Lower priorities will be scheduled first.
*
* @return the value (default 0)
*/
int priority() default 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,11 @@
* @return the valude (default 0)
*/
long timeOut() default 0;

/**
* The scheduling priority. Lower priorities will be scheduled first.
*
* @return the value (default 0)
*/
int priority() default 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,11 @@
* @return the value (default 0)
*/
long timeOut() default 0;

/**
* The scheduling priority. Lower priorities will be scheduled first.
*
* @return the value (default 0)
*/
int priority() default 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,11 @@
* @return the value (default 0)
*/
long timeOut() default 0;

/**
* The scheduling priority. Lower priorities will be scheduled first.
*
* @return the value (default 0)
*/
int priority() default 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,11 @@
* @return the value (default 0)
*/
long timeOut() default 0;

/**
* The scheduling priority. Lower priorities will be scheduled first.
*
* @return the value (default 0)
*/
int priority() default 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,11 @@
* @return the value (default 0)
*/
long timeOut() default 0;

/**
* The scheduling priority. Lower priorities will be scheduled first.
*
* @return the value (default 0)
*/
int priority() default 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,11 @@
* @return the value (default 0)
*/
long timeOut() default 0;

/**
* The scheduling priority. Lower priorities will be scheduled first.
*
* @return the value (default 0)
*/
int priority() default 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,11 @@
* @return the value (default 0)
*/
long timeOut() default 0;

/**
* The scheduling priority. Lower priorities will be scheduled first.
*
* @return the value (default 0)
*/
int priority() default 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,11 @@ public interface ITestOrConfiguration extends IParameterizable {
String getDescription();

void setDescription(String description);

/**
* The scheduling priority. Lower priorities will be scheduled first.
*
* @return the value (default 0)
*/
int getPriority();
}
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ public int getPriority() {

@Override
public void setPriority(int priority) {
// ignored
m_method.setPriority(priority);
}

@Override
Expand All @@ -337,7 +337,7 @@ public int getInterceptedPriority() {

@Override
public void setInterceptedPriority(int priority) {
// ignored
m_method.setInterceptedPriority(priority);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ private void init() {
m_inheritGroupsFromTestClass = annotation.getInheritGroups();
setEnabled(annotation.getEnabled());
setDescription(annotation.getDescription());
setPriority(annotation.getPriority());
}

if (annotation != null && annotation.isFakeConfiguration()) {
Expand Down Expand Up @@ -503,6 +504,7 @@ public ConfigurationMethod clone() {
clone.setDescription(getDescription());
clone.setEnabled(getEnabled());
clone.setParameterInvocationCount(getParameterInvocationCount());
clone.setPriority(getPriority());
clone.m_inheritGroupsFromTestClass = inheritGroupsFromTestClass();

return clone;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,16 +289,17 @@ private static Graph<ITestNGMethod> topologicalSort(
}
predecessors.addAll(Arrays.asList(methodsNamed));
}
if (XmlTest.isGroupBasedExecution(xmlTest)) {
String[] groupsDependedUpon = m.getGroupsDependedUpon();
if (groupsDependedUpon.length > 0) {
for (String group : groupsDependedUpon) {
ITestNGMethod[] methodsThatBelongToGroup =
MethodGroupsHelper.findMethodsThatBelongToGroup(m, methods, group);
predecessors.addAll(Arrays.asList(methodsThatBelongToGroup));
}
// Should not be part of this commit. just added until GITHUB-2664 is solved.
// if (XmlTest.isGroupBasedExecution(xmlTest)) {
String[] groupsDependedUpon = m.getGroupsDependedUpon();
if (groupsDependedUpon.length > 0) {
for (String group : groupsDependedUpon) {
ITestNGMethod[] methodsThatBelongToGroup =
MethodGroupsHelper.findMethodsThatBelongToGroup(m, methods, group);
predecessors.addAll(Arrays.asList(methodsThatBelongToGroup));
}
}
// }

for (ITestNGMethod predecessor : predecessors) {
result.addPredecessor(m, predecessor);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ private static void finishInitialize(
result.setGroups(bs.getGroups());
result.setInheritGroups(bs.getInheritGroups());
result.setTimeOut(bs.getTimeOut());
result.setPriority(bs.getPriority());
}

public static List<Class<? extends IAnnotation>> getAllAnnotations() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ private IAnnotation maybeCreateNewConfigurationTag(Annotation a, Class<?> annota
false,
false,
bs.timeOut(),
bs.priority(),
new String[0]);
} else if (annotationClass == IAfterSuite.class) {
AfterSuite bs = (AfterSuite) a;
Expand Down Expand Up @@ -136,6 +137,7 @@ private IAnnotation maybeCreateNewConfigurationTag(Annotation a, Class<?> annota
false,
false,
bs.timeOut(),
bs.priority(),
new String[0]);
} else if (annotationClass == IBeforeTest.class) {
BeforeTest bs = (BeforeTest) a;
Expand Down Expand Up @@ -163,6 +165,7 @@ private IAnnotation maybeCreateNewConfigurationTag(Annotation a, Class<?> annota
false,
false,
bs.timeOut(),
bs.priority(),
new String[0]);
} else if (annotationClass == IAfterTest.class) {
AfterTest bs = (AfterTest) a;
Expand Down Expand Up @@ -190,6 +193,7 @@ private IAnnotation maybeCreateNewConfigurationTag(Annotation a, Class<?> annota
false,
false,
bs.timeOut(),
bs.priority(),
new String[0]);
} else if (annotationClass == IBeforeGroups.class) {
BeforeGroups bs = (BeforeGroups) a;
Expand Down Expand Up @@ -218,6 +222,7 @@ private IAnnotation maybeCreateNewConfigurationTag(Annotation a, Class<?> annota
false,
false,
bs.timeOut(),
bs.priority(),
new String[0]);
} else if (annotationClass == IAfterGroups.class) {
AfterGroups bs = (AfterGroups) a;
Expand Down Expand Up @@ -246,6 +251,7 @@ private IAnnotation maybeCreateNewConfigurationTag(Annotation a, Class<?> annota
false,
false,
bs.timeOut(),
bs.priority(),
new String[0]);
} else if (annotationClass == IBeforeClass.class) {
BeforeClass bs = (BeforeClass) a;
Expand Down Expand Up @@ -273,6 +279,7 @@ private IAnnotation maybeCreateNewConfigurationTag(Annotation a, Class<?> annota
false,
false,
bs.timeOut(),
bs.priority(),
new String[0]);
} else if (annotationClass == IAfterClass.class) {
AfterClass bs = (AfterClass) a;
Expand Down Expand Up @@ -300,6 +307,7 @@ private IAnnotation maybeCreateNewConfigurationTag(Annotation a, Class<?> annota
false,
false,
bs.timeOut(),
bs.priority(),
new String[0]);
} else if (annotationClass == IBeforeMethod.class) {
BeforeMethod bs = (BeforeMethod) a;
Expand Down Expand Up @@ -327,6 +335,7 @@ private IAnnotation maybeCreateNewConfigurationTag(Annotation a, Class<?> annota
bs.firstTimeOnly(),
false,
bs.timeOut(),
bs.priority(),
bs.onlyForGroups());
} else if (annotationClass == IAfterMethod.class) {
AfterMethod bs = (AfterMethod) a;
Expand Down Expand Up @@ -354,6 +363,7 @@ private IAnnotation maybeCreateNewConfigurationTag(Annotation a, Class<?> annota
false,
bs.lastTimeOnly(),
bs.timeOut(),
bs.priority(),
bs.onlyForGroups());
}

Expand Down Expand Up @@ -383,6 +393,7 @@ private IAnnotation createConfigurationTag(
boolean firstTimeOnly,
boolean lastTimeOnly,
long timeOut,
int priority,
String[] groupFilters) {
ConfigurationAnnotation result = new ConfigurationAnnotation();
result.setIsBeforeGroups(isBeforeGroups);
Expand Down Expand Up @@ -410,6 +421,7 @@ private IAnnotation createConfigurationTag(
result.setFirstTimeOnly(firstTimeOnly);
result.setLastTimeOnly(lastTimeOnly);
result.setTimeOut(timeOut);
result.setPriority(priority);

return result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public void setDescription(String description) {
m_description = description;
}

@Override
public int getPriority() {
return m_priority;
}
Expand Down
Loading