-
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
TestResult does not support the expansion of existing statuses. #1945
Comments
@shaburov - The code snippets in this issue, are they supposed to be proposing the new changes? I didn't quite understand. Also how would one cater to the needs of the listeners that are supposed to be invoked when a test passes or fails or skips or succeeds within percentage etc., I believe there were previously also cases wherein this was asked for and I dont remember us reaching a conclusion on that. @juherr @cbeust thoughts ? |
Why not for the idea but what is the fonctionnal need behind it? |
I like your screenshot! 👍 But 2 things:
|
3 years later, I still want an enum :D The current feature request could be done if we consider a SPI on the TERMINATED status (where SUCCESS, FAILURE, SKIP and SUCCESS_PERCENTAGE_FAILURE are just default configurations of it). Currently planned for 8.x because it may change the current API. Ping @krmahadevan |
@juherr public interface IStatus {
String name();
public static enum DefaultStatuses implements IStatus {
SUCCESS,
FAILURE,
SKIP,
SUCCESS_PERCENTAGE_FAILURE
}
} |
Yes, I think we are saying the same thing. The current TestNG status mix the test states (CREATED -> STARTED -> [RUNNING] -> [FINISHED]) and the reason of the finished state (SUCCESS, FAILURE, SKIP, SUCCESS_PERCENTAGE_FAILURE). If I understand what you are asking for then you just want a way to specify the reason of the finished state. Caution: status may be hardcoded in TestNG integrations (IDE, build tools, ...). |
I'm only talking about test execution statuses and the possibility of their extension. Initially, in the task, the problem is in the exception. Actual behavior (exception) TestResult private static String toString(int status) {
switch (status) {
case SUCCESS:
return "SUCCESS";
case FAILURE:
return "FAILURE";
case SKIP:
return "SKIP";
case SUCCESS_PERCENTAGE_FAILURE:
return "SUCCESS WITHIN PERCENTAGE";
case STARTED:
return "STARTED";
case CREATED:
return "CREATED";
default:
throw new TestNGException("Encountered an un-defined test status of [" + status + "].");
}
} An exception in the default block does not allow the use of custom statuses. Ideally, it would be nice to be able to extend statuses with a status mapper, but this is not required. And in a completely ideal world, if we make a product through the API, then the user should be able to register his own implementation of the |
Yes, by luck it is not possible and we won't have to support it 🙏 Just open it in the current design is not the good solution at the good problem you highlight. |
In any case, in my opinion, the hardcode of statuses without the possibility of expanding the list is not the best solution. |
The engine manages a state machine and I don't see any use case that justifies to implement this complexity. The current design issue is that it mixes the 2 concepts into a single name. |
TestNG Version
testng-7.0.0-beta1
1 Expected behavior (? class status mapper for TestNG)
For example enum class
2 Expected behavior (Integer status mapper for TestNG)
3 Expected behavior (Less strict
toString
method)return "UNKNOWN_STATUS_" + status;
Actual behavior (exception)
throw new TestNGException("Encountered an un-defined test status of [" + status + "].");
The text was updated successfully, but these errors were encountered: