-
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
Replace Assert implementation by AssertJ #2649
Comments
I personally always recommend AssertJ as the preferred Assertion API We never recommend anyone to migrate from Assert to AssertJ for any existing test cases. Would deprecation mean that it would be removed sometime in the future? |
True, optional dependency is an option too. Shades the dependency under a private package will allow users to use another version than the one used by TestNG itself. |
@juherr so if I understand this correctly you are looking at having the Assert class internally work with an assertion implementation ( by default testng would use assertj) and if a user wants they can provide an implementation of our interface and plugin the implementation via a configuration and testng would use that one ? Is that what you are hinting at ? Yes I also feel that the testng assertions can be deprecated and users can instead use an assertion dedicated library such as assertj. As you said it would help us focus on the test engine. |
I don't think we need a spi here. |
I dont see what kind of interfaces or spi that would be needed, I think most assertion libraries only relies on the "existing spi" like: |
I was not referring to spi, but I was referring to the sort of implementation that we did for the scripting support in method selectors (beanshell).
Also if we end up adding assertj calls to all the APIs exposed by
Can you please elaborate on what do you mean by shading it? Are you referring to the shading functionality as done by this maven plugin ? https://maven.apache.org/plugins/maven-shade-plugin/index.html We dont give a fat jar to our users right. We give them as a maven dependency. |
I was referring to an interface driven approach which internally uses an assertj default implementation so that it becomes completely plug and play. This way one could use any different assertion implementation as well (something like a logging assertion, which asserts and logs into a log file or into a test result etc.,) |
I propose a step by step strategy where the objective is to drop the current assert implementation.
|
Are you talking about something like this ? https://medium.com/@akhaku/java-class-shadowing-and-shading-9439b0eacb13
Why would we be doing this, when the whole point of us working towards removing Assert is because we don't want to be sidelined by the assertion implementations etc., and instead have all users use an assertion dedicated library. If we host them as a dedicated project wouldn't we still have to maintain it ? |
Yes, exactly something like that.
Because it will allow us to remove it easily from the main project and I think it will too breaking change for the community without an easy workaround.
Yes, but expect an AssertJ upgrade, I don't see any additional support, do you? |
Well, I hope so too. It would depend a lot on how we are plumbing the assertion implementations in TestNG to use assertj behind the scenes. If its a direct 1:1 api mapping, I agree with you that we wont be having to do any additional support. Lets see how it pans out. Will try to wrap up that over this week and raise a PR. |
That includes "shading CVEs" 😱
+1 There might be a case for https://github.com/openrewrite/rewrite-testing-frameworks migration (e.g. from TestNG Assert to AssertJ / Truth) |
Recently, we had many issues with Assertion. See #2643 #2636 #2540
I think it could be helpful to deprecate the internal assertion API and let the user choose the library he prefers.
It will allow us to drop some annex subjects and be more focused on the test engine.
One option could be to shade AssertJ into the TestNG jar and use it as the default implementation of Assertion.
@krmahadevan WDYT?
The text was updated successfully, but these errors were encountered: