-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Migration from XUnit is painful. #580
Comments
Hi, I really like what I have seen until now from TUnit and would like to convert our XUnit tests to TUnit. I use a lot IsType and Single, which is very helpful, because it returns the result to do further testing with it. I thought about to write own Asserts, but I don't know how to return a value I can use in the next steps. It seems it is not intended to have a result of an Assert. Is this planned for the next time? Thanks |
@kant2002 I'm sorry that you have to make changes but it's a different framework so it's expected to have API differences. I didn't set out to copy the xUnit API exactly. So unfortunately it will be a bit of a manual task for now. It's actually probably possible to create analyzers with code fixes to help automate the process but that will be quite a big task so it would take quite a bit of time and effort to implement. |
Heya. Returning values sounds like it could be useful and doable. Leave this with me ! |
@thomhurst I did not expect API match one-2-one, but most other frameworks, at least for smaller projects can be very easiely migrated, since a lot of things converge. It would be hard sell to migrate to your framework for existing codebases IMO, where benefits would be move prominent. I mean, I wrote this only to give you hint on how painful would be migrate existing tests suites. I bet MsTest would be the same deal. The more users you could steal from others, the better to shake status quo a bit 😄 . |
@kant2002 If it helps at all, when I did this I used a few cycles of regex find and replace and it wasn't incredibly painful. |
@Xen0byte maybe it make sense to share it, even if not for my sake, but for others? What do you think. Even if it’s rough probably still would be better |
@kant2002, unfortunately I didn't save them, it was a quick-and-dirty on-the-fly thing, but in hindsight I should have. They're pretty easy to write, it took me about 30 minutes to do an entire solution with about 2.5k tests across multiple projects. The regular expressions would look like something along the lines of the following: find: NOTE 1: For assertions (example above) I would strongly recommend getting rid of the xUnit assertions library reference before you do this, and not after, because it's easier to keep track of how much you've covered and how much is still pending, by means of the compiler being unhappy. NOTE 2: Migrating constructors to setup methods, for instance, works roughly the same way, you just need to make sure you include |
Design which requires assert to be awaitable, make migration from XUnit or MSUnit or NUnit painful.
All tests now have to be
async Task
which is.. you know... lot of typing.That looks super strange to compare things in awaitable fashion.
vs
become
notice that I have to write type name.
Probably only XUnit related.
become
T
andT?
for simple types.become
is invalid, since I have to rewrite like that.
which is understandable, but again. I have to retype a lot of code.
IsEqualsTo
and have to useIsEquivalentTo
which is not what I expect from other frameworks.IsEqualsTo
norIsEquivalentTo
works for me.Summary
Overall I think migration process even for small set of 13 tests which I have , is very painful to my taste.
The text was updated successfully, but these errors were encountered: