Imagine a situation where there are written tests on JUnit ʻe and everything works fine (well, at least the tests are written).
But there is a miracle idea that TestNG would be more convenient for these tests. We will not go into holivar, which of the frameworks is better, cooler or more convenient. But the fact is that they have a different API.
Of course, replacing
assertArrayEquals
with
assertEquals
easy.
But to change the position of the message for the falling test is already more difficult, here you need to edit the pens.
I do not know how relevant this problem is, but I came across it many times.
So there was a crazy thought - to write a simple liba, with which you can change the framework without a special headache.
I sketched a
rough version of how it might look and offer it for discussion.
The API looks like this:
usingTestNG.assertEquals( "Strings are not equal", "expected", "actual" );
usingJUnit.assertEquals( "Strings are not equal", "expected", "actual" );
Or you can use the default:
usingDefault.assertEquals( "Strings are not equal", "expected", "actual" );
In this case, either try to use TestNG. If it is not in class, then JUnit will be used.
')
For the interface of the calls themselves, JUnit is taken, but this is a moot point. He is more familiar to me and it is subjective. Perhaps it makes sense to add both options.
In general, let's discuss the need for this lib, whether someone has encountered such a problem. Maybe this is another bike.
Update1.Thank you all for the feedback! Made a small roadmap for the near future:
- Add slf4j-like test initialization;
- Zarefaktorit more successful API for static import `a;
- Add Fest-asserts like API;
- Add TestNG like API;
- Add proxy for JUnit and TestNG annotations. If the framework referenced by the test is missing, then a warning should pop up or a crash occurs during the test run, depending on the criticality.
- Add proxy for JUnit and TestNG listeners. As with asserts, the listeners are interchangeable, so they should work if there is any lib.
I would be very happy and grateful if anyone has time for any other thoughts.