.NET Unit testing docs fuckery?
-
I'm supposed to write tests for a fuckall .NET library yadda yadda. That's all I was told and I heard XUnit is the latest shiny test framework for .NET. So I go there,
and I go through the get started section, write a fact and a theory run a couple tests. Cool.
Where do i go from here though? What else can I use apart from Fact and Theory? There is a InlineData option, but what else is there?
The docs seem really vague or I must be looking at the wrong docs page. I've been just staring into the void cos there MUST be docs for this.
LEt's take a look at NUnit
It's got a whole section on writing tests, what attributes you can use(Teardown, Assumptions, Assertions) and so on.
Where is the XUnit equivalent in the docs? What am I doing wrong? I fucking need the docs what the shit is this xunit docs page what the fuck?
EDIT: I found this
Wow, Fuck you motherfuckers!!!!
-
TBH there isn't much to XUnit. A lot of it is done through regular .NET features such as constructors, IDisposable etc.
The following quick references will start you off what is the equivalent between frameworks.
https://xunit.github.io/docs/comparisons
Also do not use the Xunit Test Runner in something like TeamCity / Azure Devops build. It doesn't work, it has been depreciated and it random tests will just fail for absolutely no reason. Make sure you use
dotnet test
instead in your build steps.
-
https://xunit.github.io/docs/shared-context
I don't think this is linked on the main doc page.
-
@sweaty_gammon I am on a tight deadline and most programmers here are at various levels of proficiency when it comes to .NET / Unit Testing.
Someone came to me this morning and asked "What else is there in xUnit?" and I told him to go checkout NUnit and sent him the comparison chart you've linked here. We have to find samples / repos / examples to even discover what is there in XUnit, which would be fine for personal projects. The problem here is if this shit gets delayed and when the manager gets pissy and goes "why the fuck is it taking so much time. Read the fucking docs", which is his usual goto, and a dev goes "The docs are not there, they're half-fucky". I AM SCREWED.
I would have no answer to "Why the fuck did you pick a test framework with docs like this?" over NUnit which has thorough documentation and I'd be standing there holding my dick in my hand looking like a wanker. I do not want that to happen. At this point, the tests might be integrated and once they're done it's gonna be maintained for a very lonnnnnggggggggg time. And I don't want the other who inherit the project to go to the docs page and have this problem all over again.
-
@sweaty_gammon It's there. I'm glad it is covered but it looks like the docs have chapters missing between them like what the fuck.
-
@stillwater Fair enough. I personally use MSTest myself. TBH I am somewhat new to writing tests etc. I just happened to use XUnit at my last contract.
After the fiasco with their flakey test runner, I don't be using it again personally.
-
@sweaty_gammon said in .NET Unit testing docs fuckery?:
I personally use MSTest myself
MSTest was suggested!!!! I told them nah XUnit is the latest and greatest for no fucking reason whatsoever. You can call me a cunt now.
-
@sweaty_gammon said in .NET Unit testing docs fuckery?:
After the fiasco with their flakey test runner, I don't be using it again personally.
You talkin about XUnit or MSTest?
-
@stillwater In my original comment.
XUnit
@sweaty_gammon said in .NET Unit testing docs fuckery?:
Also do not use the Xunit Test Runner in something like TeamCity / Azure Devops build. It doesn't work, it has been depreciated and it random tests will just fail for absolutely no reason.
Some background:
I spent 2 or 3 days trying to track down why tests were failing all over the place, but not in VS when using Test Explorer. The week before we updated from .NET Core 2.0 to 2.1 so I thought it was a incompatibility between .NET 2.1 and our current code. So I assumed it was that.
Nope it was the XUnit runner. It was depreciated in the previous version and we were just lucky it was working okay for the tests we had previously. Once I changed to
dotnet test
tests worked as they did in Test Explorer.
-
@stillwater It sounds to me like xUnit is still good, and you just assumed the docs were leaving stuff out instead of actually being everything there was to know.
-
@pie_flavor said in .NET Unit testing docs fuckery?:
@stillwater It sounds to me like xUnit is still good, and you just assumed the docs were leaving stuff out instead of actually being everything there was to know.
False.
-
@stillwater said in .NET Unit testing docs fuckery?:
@pie_flavor said in .NET Unit testing docs fuckery?:
@stillwater It sounds to me like xUnit is still good, and you just assumed the docs were leaving stuff out instead of actually being everything there was to know.
False.
Informative.
-
@pie_flavor I'll elaborate
What the fuck is with you people throwing out opinions before reading what's actually written.
There are no fucking docs. This is not me saying it.
-
The guy working on the repo admits there are no docs per se. There is no fucking api documentation for XUnit.
-
People go visit the samples to discover features.
If you had actually read what I wrote, you'd have known that.
If you have to say something contrarian just for the heck of it, feel free to fuck off elsewhere and be an idiot there.
You say I'm ASSUMING and then your sentence starts with "It SOUNDS to ME". Get the fuck out of here.
-
-
@sweaty_gammon said in .NET Unit testing docs fuckery?:
I spent 2 or 3 days trying to track down why tests were failing all over the place, but not in VS when using Test Explorer. The week before we updated from .NET Core 2.0 to 2.1 so I thought it was a incompatibility between .NET 2.1 and our current code. So I assumed it was that.
Nope it was the XUnit runnerYou were not aware of the depreciated runner? How did you find out?
-
@stillwater I checked the release notes, once I eliminated other possible causes. As part of the move to .NET Core 2.1 another developer upgraded all the packages to the latest at the time.
https://xunit.github.io/releases/2.4
Unfortunately, this release also removes the dotnet xunit runner, as the stability of the runner was never perfect, and it suffered from many assembly-loading related issues. Users from .NET Core can continue to use VSTest (either inside Visual Studio, or via dotnet test).
As I said I thought it was an environmental issue with .NET Core 2.1 and TFS 2017
-
@sweaty_gammon said in .NET Unit testing docs fuckery?:
As I said I thought it was an environmental issue with .NET Core 2.1 and TFS 2017
Ah well. I'd have thought the same. Let's all wait for .NET Core 3.0 now and see what it has in store :/
-
@stillwater said in .NET Unit testing docs fuckery?:
EDIT: I found this
Wow, Fuck you motherfuckers!!!!
Latest comment by bradwilson commented on Oct 28
@maxalmonte14 In addition to being closed for age, it should also have been closed as being non-actionable. Issues need to be opened for specific, discrete bugs or tasks. "Please make X better" is too open ended to be usable.
As mentioned above, we welcome specific issues as well as PRs to improve the documentation (the docs site is on Github as well).
So what I'm hearing is, they want me to open a ticket to have the docs written, one for each sub-feature, function, parameter, and construct?
I'm almost willing to scrub the generated xml thing and robot it...
-
@Tsaukpaetra said in .NET Unit testing docs fuckery?:
So what I'm hearing is, they want me to open a ticket to have the docs written, one for each sub-feature, function, parameter, and construct?
The classic answer to your question is "OPEN SOURCE MUDAFUCKA!!!!!!!!!!! Fork and unfuck/fuck it".
-
@stillwater said in .NET Unit testing docs fuckery?:
@Tsaukpaetra said in .NET Unit testing docs fuckery?:
So what I'm hearing is, they want me to open a ticket to have the docs written, one for each sub-feature, function, parameter, and construct?
The classic answer to your question is "OPEN SOURCE MUDAFUCKA!!!!!!!!!!! Fork and unfuck/fuck it".
So, still going with XUnit then? Nothing explains why this should end up being the case, so far.
-
@Gribnit said in .NET Unit testing docs fuckery?:
So, still going with XUnit then? Nothing explains why this should end up being the case, so far.
Nope. NUnit.
-
@stillwater said in .NET Unit testing docs fuckery?:
I fucking need the docs what the shit is this xunit docs page what the fuck?
aka: Industry Standard Documentation.
-
@stillwater Let me know how you get on with it. I've just been using MSTest as that is the default in the Tests menu in VS
-
@sweaty_gammon It's going fine so far. Tests are being written and we have not had any problems with NUnit itself so far. That being said, I don't know of any reasons why it would necessarily be better than MSTest. If it comes with VS I guess that's A-Okay to use.
Personally, this weekend I'mma check out MSTest and if there is no apparent benefit to using NUnit I'm using MSTest for personal projects since it comes with VS.
-
@stillwater I think there used to be some stuff that only NUnit supported (asserting exceptions, test parameterization), but now MSTest has feature parity as far as I know.
-
@pie_flavor said in .NET Unit testing docs fuckery?:
It sounds to me like xUnit is still good,
Based on what? @stillwater's reported hearsay?
-
@pie_flavor well not so much. They left in a flakey test runner for ages and the navigation on the website isn't the best. Also I prefer explicitly saying that a method is Initialising the test etc.
-
I've been using Shouldly because it has:
- Nice syntax
- Easy to read error messages when a test fails
@Unperverted-Vixen I've been using MSTest and there hasn't been anything that I've felt has been missing. However I am still somewhat new to do writing tests.
-
@Unperverted-Vixen said in .NET Unit testing docs fuckery?:
@stillwater I think there used to be some stuff that only NUnit supported (asserting exceptions, test parameterization), but now MSTest has feature parity as far as I know.
I have not gone far into this whole "Unit test everything" phase and when / If I hit roadblocks then I'll know.
-
@sweaty_gammon said in .NET Unit testing docs fuckery?:
Shouldly
Looks pretty cool. My list of things to checkout keeps growin and growin'
-
I like Catch - but then I'm using C++...