C
C#3d ago
Zerthz

TUnit or XUnit for a new solution?

If you had to go ahead and implement tests from scratch for a prod solution, would you roll with XUnit 3.0+ or TUnit? I feel like NUnit and VsTest are already eliminated from the competition.
15 Replies
SleepWellPupper
If you had to go
I would choose XUnit because it "just werks" ™ and its simplicity forces me to design small, readable, self-descriptive tests. I have not used TUnit so I can't compare. Also it looks like TUnit does not support external cancellation. Maybe someone using it can chime in? In XUnit I use TestContext.Current.CancellationToken a lot because I deal with potentially long running tests all the time and like to manually cancel the test and rerun.
Zerthz
ZerthzOP3d ago
Hmm, that does sound like the best case scenario. TUnit seems to be the new kid on the block, but not sure if it's prod ready yet. Haven't looked into it too deep yet
SleepWellPupper
I suppose it is faster than the incumbents, looking at their benchmarks on the GH page.
Zerthz
ZerthzOP3d ago
Is XUnit V3 out and about in other words?
SleepWellPupper
I'm using it right now.
Zerthz
ZerthzOP3d ago
Ah, also saw something on the GitHub for XUnit that they're not sure if they're doing another V2 release. So def no reason to go with V2 for a new solution
SleepWellPupper
nope :)
denis de benis
we moved and it's ok
Unknown User
Unknown User3d ago
Message Not Public
Sign In & Join Server To View
viceroypenguin
Correct
Unknown User
Unknown User3d ago
Message Not Public
Sign In & Join Server To View
viceroypenguin
Am driving, give me 5min to get home and write it out.
Unknown User
Unknown User3d ago
Message Not Public
Sign In & Join Server To View
viceroypenguin
so moving to TUnit was a choice done in the xunit.v2 days. xunit.v2 was not parallel by default, and tunit appeared to be more complete in terms of built-in features. It took a project I was working on from 15m for a full test run down to 4m. being able to use features like test dependencies, etc. was very helpful as well. however, tunit went through a major rewrite between 0.27 and 0.50, and it seems, to me, that tunit has lost a lot of stability durng the rewrite. i've had to re-report bugs that had already been fixed by 0.27, and the nature of the test runner under 0.50 feels significantly slower than 0.27 line. I switched to xunit.v3, which is now fully parallel, and i've that it feels better and faster than tunit 0.50+. i have updated most of my personal projects back to xunit.v3; i still have one major project that will take some time to migrate back since xunit.v3 still does not (and by author's intentions, will not) support test dependencies. on my todolist for that project is a research project to see about implementing a new xunit test framework that will introduce th ability to add dependencies. since this is an extension point in xunit.v3, it will be one fo those things that may or may not make it's way back into xunit.v3 mainline, or be published as a separate nuget package for consumers who want to add dependency support.
Unknown User
Unknown User3d ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?