Testing in .NET is About to Change

แชร์
ฝัง
  • เผยแพร่เมื่อ 20 ก.ย. 2024
  • Until the 30th of September get 30% off any course on Dometrain with code BTS30: dometrain.com/...
    Subscribe to my weekly newsletter: nickchapsas.com
    Become a Patreon and get special perks: / nickchapsas
    Hello, everybody, I'm Nick, and in this video I will introduce you to a brand new testing library in .NET called TUnit. TUnit aims to be the new way of doing testing in .NET and I am very excited about its future.
    Give TUnit a star on GitHub: github.com/tho...
    Workshops: bit.ly/nickwor...
    Don't forget to comment, like and subscribe :)
    Social Media:
    Follow me on GitHub: github.com/Elf...
    Follow me on Twitter: / nickchapsas
    Connect on LinkedIn: / nick-chapsas
    Keep coding merch: keepcoding.shop
    #csharp #dotnet #codecop

ความคิดเห็น • 176

  • @JackTheSpades
    @JackTheSpades 18 ชั่วโมงที่ผ่านมา +246

    Personally I prefer PUnit.
    Testing in Production :3

    • @IsaacOjeda
      @IsaacOjeda 17 ชั่วโมงที่ผ่านมา +7

      🤣🤣🤣

    • @MrMelick
      @MrMelick 16 ชั่วโมงที่ผ่านมา +19

      @@IsaacOjeda The Crowdstrike method

    • @PatrickMageez
      @PatrickMageez 9 ชั่วโมงที่ผ่านมา

      This comment made my day thank you

    • @watherby29
      @watherby29 7 ชั่วโมงที่ผ่านมา

      Are you a Microsoftie?

  • @sergeybenzenko6629
    @sergeybenzenko6629 19 ชั่วโมงที่ผ่านมา +75

    We have shitty tests that randomly fail and depend on one another. Now we got a perfect framework to hide it and not having to fix these damn tests. YAY!!!

  • @markovcd
    @markovcd 19 ชั่วโมงที่ผ่านมา +72

    Now I can over-engineer my tests easier than ever! ;)

  • @PeteRobinson-gb7nz
    @PeteRobinson-gb7nz 19 ชั่วโมงที่ผ่านมา +14

    We need *test* frameworks not just *unit* test frameworks (we use them for more than just unit tests)

  • @DoorThief
    @DoorThief 17 ชั่วโมงที่ผ่านมา +12

    This is pretty cool. If I'm writing unit tests, its true I might not see the value with this framework if all my tests are perfectly isolated. But for integration tests/UI tests, i can finally not have it run in one giant method and finally have test order control! This is really useful for different types of testing.

  • @softwaretechnologyengineering
    @softwaretechnologyengineering 20 ชั่วโมงที่ผ่านมา +17

    Before assembly, what a fantastic way to hide weird behaviour in a large test suite.

    • @cyril113
      @cyril113 19 ชั่วโมงที่ผ่านมา

      Because doing things before tests is weird. And how is it going to hide it if the code that runs is annotated with Before(Assembly)?

    • @nickchapsas
      @nickchapsas  18 ชั่วโมงที่ผ่านมา +3

      Not true for acceptance tests where you’re spinning up a bit suite of tests.

    • @softwaretechnologyengineering
      @softwaretechnologyengineering 17 ชั่วโมงที่ผ่านมา

      You got a large amount of files in an assembly. A problem in one file and this thing in an unrelated file causing the issue. Seems like it would be annoying.

    • @NickSteffen
      @NickSteffen 13 ชั่วโมงที่ผ่านมา

      Most existing tests I’ve run across just leave the weird behavior in place and let their pipelines fail occasionally. People hate troubleshooting tests because most of these times the issue is in the test code and not the code being tested so they view it as a waste of time. I personally will fix them as I come across but I definitely respect the opinion that if you could just add a depends on attribute to make the order explicitz and quickly fix the issue that might be the worthwhile solution. I’ll still come by and fix it later for you but not everyone needs to be testing experts.

    • @Thomhurst
      @Thomhurst 13 ชั่วโมงที่ผ่านมา +1

      One usage where this can be beneficial is running your tests against an in memory server. You can start it before your tests, and dispose it after.

  • @anth9623
    @anth9623 19 ชั่วโมงที่ผ่านมา +8

    Hmmm maybe overtime it will show more advantages over other testing frameworks, but NUnit/XUnit are both decent, well supported, and feature rich, so it does make it more difficult to switch at the moment. But that being said, it's new and no doubt will get better, so who knows 😊

  • @ryanelfman3520
    @ryanelfman3520 18 ชั่วโมงที่ผ่านมา +15

    So much hate in these comments. If you’ve never ran into the limitations of xUnit then you wouldn’t realize the benefits. A lot of people override the standard xUnit framework because parallelization in xUnit is bad and not as configurable as it should be. Once you do that it’s extremely difficult to use spec flow on top of it or some other framework
    This is excellent to see its source generated. It’s the way to go

  • @SADS-810
    @SADS-810 12 ชั่วโมงที่ผ่านมา +6

    I love this framework and I love the assertions too, because I like my assertions to both start with "Assert" so that I can scan them in the code easily and also to be fluent. I can proudly say that I am this project's first sponsor!

    • @hellowill
      @hellowill 9 ชั่วโมงที่ผ่านมา

      All they did is copy java

  • @BetrayedEnemy
    @BetrayedEnemy 18 ชั่วโมงที่ผ่านมา +3

    Liked for "Assert DOT THAT DOT IS DOT " -Dance

  • @tridy7893
    @tridy7893 20 ชั่วโมงที่ผ่านมา +18

    There is no AI in it? Pfffff, what a waste. [ɯsɐɔɹɐs].

    • @nickchapsas
      @nickchapsas  18 ชั่วโมงที่ผ่านมา +7

      AIUnit next

    • @lylobean
      @lylobean 16 ชั่วโมงที่ผ่านมา +1

      He makes a good point chat gpt might not know how to write my tests in it. Yet.

    • @MattWanchap
      @MattWanchap 9 ชั่วโมงที่ผ่านมา

      That sarcasm tag is brilliant! Don't know why but I've never seen it written like that before

  • @xBalaDeCanhaox
    @xBalaDeCanhaox 12 ชั่วโมงที่ผ่านมา +3

    This is awesome as we don't need vstest host anymore and I personally hate it.

  • @MatinDevs
    @MatinDevs 20 ชั่วโมงที่ผ่านมา +27

    2:15 I love how nick chooses "random" numbers

    • @local9
      @local9 18 ชั่วโมงที่ผ่านมา

      If only the test ran for 260 seconds too

  • @nickst0ne
    @nickst0ne 16 ชั่วโมงที่ผ่านมา +3

    Thanks Nick. It's interesting to discover new libraries, though I don't see myself using this one before years.
    The Retry feature is a real plus. When a 2-hours long CI/CD fails for the third time because of flaky unit tests (among ~40,000 unit tests in the solution) you want to see the world burn.
    All the rest, I don't think I've encountered situations where Xunit was limited.

    • @ВладиславДараган-ш3ф
      @ВладиславДараган-ш3ф 7 ชั่วโมงที่ผ่านมา

      If you have a flaky code, then you need to fix the code, not adapt the freaking tests, dude.
      It is not acceptable to have a flaky code in a first place.

  • @regestea
    @regestea 19 ชั่วโมงที่ผ่านมา +7

    I think it's better to add these futures to XUnit or NUnit instead of recreating a library or maybe a package for XUnit or NUnit to add these futures because most of us don't like to go for a new library

  • @BrianBehm
    @BrianBehm 18 ชั่วโมงที่ผ่านมา +5

    What about support for build pipelines? Are there any pros and cons there?

  • @okmarshall
    @okmarshall 13 ชั่วโมงที่ผ่านมา +1

    This gets me excited.
    I'd love to see more stuff about parallel execution of tests and how this stuff works with Azure pipelines.

  • @R.B.
    @R.B. 9 ชั่วโมงที่ผ่านมา

    The biggest problem I have with test arguments is that if you are using a matrix of test arguments and expected results, most frameworks see that as one test. I'd want to use the matrix of arguments to test the cases, and if one edge case fails, the entire test fails. What would make something like this more ideal for me is that the multiple test arguments are broken out, at least for reporting when there's a failure, as individual test cases.
    I think the idea of the Before decorator is good, but it would also be great if you could define categories of tests which depend on on or more of those setup methods, so that state might be reused but different fixtures might require different setup states and that could be used to apply what is needed for each test. There's a condition where one test might inherit two different conflicting states, so some thought needs to be put into that type of system, but I see a lot of potential.

  • @Cristian-ek7xy
    @Cristian-ek7xy 20 ชั่วโมงที่ผ่านมา +28

    I'm happy with NUnit

    • @Maloooon
      @Maloooon 20 ชั่วโมงที่ผ่านมา +6

      Yeah, I expected something really flashy. But aside from using the new test runner, it mostly feels like NUnit. Maybe it has a few more options for "Before", but otherwise, it feels the same.

    • @Domse65
      @Domse65 19 ชั่วโมงที่ผ่านมา +5

      xunit is streets a head of nunit

    • @DemoBytom
      @DemoBytom 16 ชั่วโมงที่ผ่านมา

      @@Maloooon The benefit of this new unit testing framework is that it's much faster than both nUnit and xUnit, and supports AoT, which is becoming a bigger and bigger thing in *some* use cases.
      For th eprojects I'm working on at work it probably wouldn't matter much, but I can see some that could really use those benefits.

  • @dahahaka
    @dahahaka 20 ชั่วโมงที่ผ่านมา +29

    I use GUnit

    • @timur2887
      @timur2887 19 ชั่วโมงที่ผ่านมา +1

      TestsSucksUnit =)

  • @Domse65
    @Domse65 19 ชั่วโมงที่ผ่านมา +2

    I see the same problem with TUnit and NUnit, which is not present with XUnit, which is thats it's a lot easier to use and code tests quickly with resharper. With just base resharper if I decide some line in my code needs to be setup before the test just a quick keyboard shortcut and its automatically moved to the constructor. This make writing tests a lot faster and easier since you don't need to write boilerplate code by hand.
    Also XUnit assert syntax is a lot better in my opinion

    • @nickchapsas
      @nickchapsas  18 ชั่วโมงที่ผ่านมา

      You can do the same thing in TUnit

  •  18 ชั่วโมงที่ผ่านมา +1

    Thanks for the info. As always, refactor all unit tests and use it in production even if it's in preview library, you will thank me later.

  • @davestorm6718
    @davestorm6718 11 ชั่วโมงที่ผ่านมา

    I would like to see simpler scaffolding for testing databases and apis, especially when it comes to delays, intermittent connections, corrupted data, partial data, really slow responses, connection strings, security [certs, encryption,etc] and more. While things like an in-memory database are good, it'd be nice to test more realistic scenarios with a project, so you can handle things better.

  • @loganbussell4855
    @loganbussell4855 17 ชั่วโมงที่ผ่านมา +1

    Looks exciting, but I was hoping to see property-based unit testing here. Patiently waiting for the first library that makes it really accessible for .NET.

    • @z0nx
      @z0nx 15 ชั่วโมงที่ผ่านมา

      What's wrong with CsCheck?

  • @DotNetCookbook
    @DotNetCookbook 18 ชั่วโมงที่ผ่านมา +4

    Really, most projects just need some library that can assert things and some framework that can run those assertions. I've never met a real-life scenario where unit-tests related reflection would be the bottleneck why unit tests run slowly.
    Also these days you might want to use a library that LLMs know about, so that you could autogenerate test cases sometimes. But that's about it, it's not that complicated.

  • @F1nalspace
    @F1nalspace 11 ชั่วโมงที่ผ่านมา +1

    I must admit, i never used any 3rd party for unit-testing in .NET. So every library is most likely better than the one we use: MS-Test. But T-Unit looks good so far and i really like it too that you have lots of control over it. But don't like the assertions. I would rather have manual Assert.IsTrue, IsFalse, AreEqual, etc. If i want that chaining thing, i would use fluent assertions. But myself would never use that, because i really hate chaining api's in general. I think its a stupid idea and i see no benefits of that pattern at all. It looks nice, writing a one liner but as soon as your line exceeds the editor width or has more than two lines - then it gets less readable and gets extremely hard to debug.

    • @Thomhurst
      @Thomhurst 10 ชั่วโมงที่ผ่านมา

      Thanks for the feedback. You're not tied to the TUnit assertions and can use whichever library you like!

  • @PaulSebastianM
    @PaulSebastianM 19 ชั่วโมงที่ผ่านมา +3

    I wish .Net had testing builtin like Rust and actually support the same way of having a testing module in the same file that is only compiled when running tests.

  • @ivanp_personal
    @ivanp_personal 14 ชั่วโมงที่ผ่านมา +1

    Assert.That(x).IsEqualTo(y) is actually the same approach as in the Java library Assert4J

  • @alanwakeup3344
    @alanwakeup3344 13 ชั่วโมงที่ผ่านมา +2

    All that hype in the beginning for a more granular [SetUp] attribute o_O?

  • @jwmoffat
    @jwmoffat 9 ชั่วโมงที่ผ่านมา

    DependsOn is pretty much what I've wanted for a number of my integration tests. Thanks for sharing!

  • @kinsondigital
    @kinsondigital 19 ชั่วโมงที่ผ่านมา +1

    Oh hell yes! I likey!!
    Yeah, this should get some funding sent it's way for sure.

  • @renynzea
    @renynzea 14 ชั่วโมงที่ผ่านมา

    Two things: When you do the full video, I would like to see how you would emulation collection fixtures in XUnit. My guess, looking at the preview, is that I would create a base class that implements `BeforeAssembly`, wire up a static property on the base class, then in all my child tests I could access that. (E.g. for an EF Context, some class that wraps API requests, etc.)
    Second thing, what are your thoughts on creating an abstraction around asserts? Cause it seems like every assert library decides to do things its own way, and if you switch libraries that ends up being the worse part of the migration; changing all the asserts. If you abstracted that out into your own assert classes, and had different concrete implementations for different test libraries you could more easily swap the asserts out by just changing how you implement them in the abstractions. You'd still have to fix the test attributes, but that could probably be done through a mass find/replace.

  • @rngesus8057
    @rngesus8057 19 ชั่วโมงที่ผ่านมา +2

    reminds me of the spec flow library

  • @smithkl42
    @smithkl42 12 ชั่วโมงที่ผ่านมา +1

    I'm curious how the code generation performance works on large projects. I'd rather suffer through test discovery delays when I'm running tests than suffer through code generation delays every single time I build - but if the code generation/build step isn't particularly noticeable, that could be an interesting tweak.

    • @Thomhurst
      @Thomhurst 12 ชั่วโมงที่ผ่านมา

      Heya! Ive got a benchmark on GitHub for building but admittedly it is a very minimal test project. I'd be happy to extend it but writing dummy tests in itself is a bit of effort so isn't the highest on my priority list right now.
      As for local development, it hopefully shouldn't affect you too much as it uses the newer incremental source generator. That means it only generates new source if it detects changes that would affect it. So hopefully it'll keep performance to an acceptable level!

    • @phizc
      @phizc 11 ชั่วโมงที่ผ่านมา

      Source generators don't normally run at compile time. They run every time a file is changed. If you clone a repository, or clean the build artifacts directory, it takes a little time to generate the files, but once that's done they're normal C# files and shouldn't affect the built times much.
      In theory source generators could cause a lot of work every time you type a character, but incremental source generators do a quick analysis to see if the change would require it to regenerate the source. Most of the time it doesn't.
      I haven't read the source generators for TUnit, but I suspect it only needs to run the source generator when one of the attributes is changed or added.
      Tldr; it shouldn't cause much of an increase in build times.

  • @Zullfix
    @Zullfix 19 ชั่วโมงที่ผ่านมา +2

    Nick, would you consider making a video about required CET in .NET 9 and the 10-100% method calling performance regressions that come with it on any CPU that isn't a modern intel processor?

    • @nickchapsas
      @nickchapsas  18 ชั่วโมงที่ผ่านมา

      Wait that’s a thing??

    • @Zullfix
      @Zullfix 18 ชั่วโมงที่ผ่านมา +1

      ​@@nickchapsas Yes, and it's causing major performance regressions for CPUs that do not have specialized hardware for CET. It also causes issues when interoping with other runtimes that don't support it, such as Java (the specific JVM is not named).
      TH-cam keeps removing my comments, probably because of my sources. You can check 107651 and 103654 in the dotnet runtime and 36619 in perf-autofiling-issues.

  • @ezrichie2006
    @ezrichie2006 12 ชั่วโมงที่ผ่านมา +1

    really cool feature. bout to start migrating code to TUnit now. XD

  • @Synesthesia-r9
    @Synesthesia-r9 15 ชั่วโมงที่ผ่านมา +2

    Are there any other unit testing libraries that use the new testing platform?

  • @watherby29
    @watherby29 6 ชั่วโมงที่ผ่านมา

    When AI writes the tests perfectly from specs, then I am happy... wait, that would mean the AI could most likely also write the software

  • @Kotz_en
    @Kotz_en 12 ชั่วโมงที่ผ่านมา +2

    Aren't tests that depend on other tests typically an anti-pattern? I don't see why I'd want to use the DependsOn attribute.

    • @Thomhurst
      @Thomhurst 12 ชั่วโมงที่ผ่านมา

      Integration testing or where state matters. Less relevant for unit tests.

    • @ВладиславДараган-ш3ф
      @ВладиславДараган-ш3ф 7 ชั่วโมงที่ผ่านมา

      @@Thomhurstsharing state between test runs is pure evil

  • @LukeAvedon
    @LukeAvedon 15 ชั่วโมงที่ผ่านมา

    TestContext is such an awesome concept. And no reflection omg, omg omg. Going to buy your testing course.
    My favorite is still the G-G-G-G-G-Unit. Poppin tham thangs....

  • @JustArion
    @JustArion 16 ชั่วโมงที่ผ่านมา

    I wonder what would happen if there's a circular dependency of tests. A depends on B. B depends on A. Hopefully a runtime exception. Worst case is a deadlock...

    • @Thomhurst
      @Thomhurst 12 ชั่วโมงที่ผ่านมา

      Hey @JustArion there's a compile time analyzer and also a runtime exception (for if you'd disabled analyzers)

  • @AdamTheWilliams
    @AdamTheWilliams 6 ชั่วโมงที่ผ่านมา

    would love to see you do a video putting o1-preview to the test

  • @olivier0003
    @olivier0003 19 ชั่วโมงที่ผ่านมา

    100k, you deserve it !

  • @vannwx
    @vannwx 8 ชั่วโมงที่ผ่านมา

    This testing ordering sounds cool but it will lead to maintainance issue eventually. Tests should not depends on execution order.

  • @fakhrulhilal
    @fakhrulhilal 18 ชั่วโมงที่ผ่านมา

    Nice, it's closer to NUnit rather than XUnit. I like they put `Before(Test)` which is feature I miss from NUnit but not in XUnit. But, I have to await for assertion? Ok, time to get used to.

  • @berry212
    @berry212 16 ชั่วโมงที่ผ่านมา

    This opens up several windows where we had to create abominable structures. For flakiness, I had to develop a whole retry library...
    Does this support Specflow?

  • @Fred-yq3fs
    @Fred-yq3fs 8 ชั่วโมงที่ผ่านมา

    I don t buy into stateful unit tests, before after and all that goop. I have a static creating the sut and dependencies, then the test method does arrange act assert. Everything s pure. No state, no hidden stuff no magic. For integration tests I use specflow.

  • @ibrahimhussain3248
    @ibrahimhussain3248 13 ชั่วโมงที่ผ่านมา

    I like it. I hate tests being a different project

    • @derekmassey2377
      @derekmassey2377 11 ชั่วโมงที่ผ่านมา

      I completely agree that Unit tests being in the same project as the class being tested would be a game changer.
      After digging into it a bit more I don't think that is how it works in TUnit. Much to my disappointment.
      It would be so much easier to write and refactor code if the test code didn't have to be in a separate project.

  • @jasonmurdick9864
    @jasonmurdick9864 10 ชั่วโมงที่ผ่านมา

    Long time lover of xUnit, but can see the benefits you showed of TUnit. Downside is that greenfield development (using newer .net versions like 8) is rare in my experience.

    • @Thomhurst
      @Thomhurst 10 ชั่วโมงที่ผ่านมา

      Completely understand your frustration but older codebases likely already have massive established test suites that they're unlikely to invest in migrating to a new framework. That combined with the benefits of newer runtime and language features is why I decided to stick to lts.

  • @the-avid-engineer
    @the-avid-engineer 8 ชั่วโมงที่ผ่านมา

    Not a fan of the assertions part at all but I do like the rest. Would prefer to use Shoudly for assertions and have sync or async tests at my own discretion rather than being forced to be async
    It would be interesting if a test could return something that could be passed to the next test.. but that’s probably too crazy

  • @ZlobnyiSerg
    @ZlobnyiSerg 10 ชั่วโมงที่ผ่านมา

    Isn't test dependencies are kind of antipattern? Each test should highlight single problem and should be independent and self-sufficient? Also, the "Before" initializers are too implicit in several ways: first of all logic of initialization could be spread among test classes and be "surprising", and second - not very clear what parameters can be passed to "Before" attribute - no code completion with choices can be used.
    Performance is great btw.

    • @Thomhurst
      @Thomhurst 10 ชั่วโมงที่ผ่านมา

      There's analyzers that tell you what parameters to pass to each before/after method.
      And sharing among multiple classes won't be a thing for before/after class, unless you use before every/after every. I tried to make the language obvious. If you use a normal before/after(class) it'll only affect tests in the class it's defined in

  • @MelGrubb
    @MelGrubb 16 ชั่วโมงที่ผ่านมา +2

    I'm excited about this, especially the direct control over parallelism, but I'll be sticking with Shouldly for my assertions. I can't stand Overly.Fluent.Interfaces.That.Create.A.Class.For.Every.Word.In.An.Assertion. If your framework has a class called "Is" or "It" and it's NOT a mocking library, you've made a wrong turn, and you need to reevaluate your decisions. "But it's so discoverable", you say. Great, that helps me for the first ten minutes of using the framework, and then it's a speed bump for the rest of my career. Just stop it. Give me a "ShouldBeLessThanOrEqualTo". Oh look, I just "discovered" the method I wanted in ONE auto-complete step instead of seven, and I only had to type ".sblto" in the IDE. Velocity matters.

  • @Zencoder720
    @Zencoder720 16 ชั่วโมงที่ผ่านมา

    I'm also not really following the power of this tool over other frameworks. In my testing flow i wish there was a simple way to cache the dependencies between tests

  • @modernkennnern
    @modernkennnern 17 ชั่วโมงที่ผ่านมา

    Source generated test library 👀

  • @markhenderson5283
    @markhenderson5283 14 ชั่วโมงที่ผ่านมา

    I have mixed feelings.
    While I'm sold on supporting the new test platform, and source generation over reflection. The rest of the features I'm not sure are all good idea. Maybe, maybe not. I'm not passing judgment yet. I do wonder if xUnit could be updated to support test platform and source generation?

  •  10 ชั่วโมงที่ผ่านมา

    The title of the video and the example was a bit confusing to me. My initial reaction was "Is he advocating that we start writing our test code inside the actual classes? Dear lord the mess!". Why would you test an Add method inside a class called Test inside an assembly with the name Tests.
    All in all, I think a more real world class would have proven a better example of what TUnit is trying to bring to the table, or maybe it would just have made it a bit less confusing to me as to what the big change to testing was/is.
    I found the documentation for TUnit, but their example was the same code you were showing so that didn't help.

  • @goodfight1749
    @goodfight1749 20 ชั่วโมงที่ผ่านมา +10

    Man.. just used NUnit 😢

    • @fusedqyou
      @fusedqyou 20 ชั่วโมงที่ผ่านมา +9

      Keep using it. TUnit will not exceed NUnit in a long time, and any experience you gain will be usable in TUnit just as much.

    • @nickchapsas
      @nickchapsas  18 ชั่วโมงที่ผ่านมา +1

      Keep using it, TUnit is not ready yet

    • @juniorceccon
      @juniorceccon 18 ชั่วโมงที่ผ่านมา +1

      It is ok to not be using every new thing all the time.

    • @G41headache
      @G41headache 11 ชั่วโมงที่ผ่านมา

      There are far more important things than test frameworks, don't worry

  • @nanvlad
    @nanvlad 15 ชั่วโมงที่ผ่านมา

    Good library. Can you compare it wth a new xUnit v3? They also made a lot of changes, comparing to the v2

  • @G41headache
    @G41headache 11 ชั่วโมงที่ผ่านมา

    How quick is the source generation? Is it noticable?

  • @ВладиславДараган-ш3ф
    @ВладиславДараган-ш3ф 7 ชั่วโมงที่ผ่านมา

    Ok, I watched a 12 minute long definitely paid ad, and didn’t see any selling feature I might actually like in this library. But I see some manipulation.
    Code generation != blazing fast.
    Having every test asynchronous is actually bad for performance.
    They removed dependency on VSTest so…what?
    You can have init and tear down…just like in other test libraries.
    Assertions are too verbose.
    Feature about tests depending on other test is dangerous, it CAN and WILL be used to cover up badly written tests.

  • @ghaf222
    @ghaf222 16 ชั่วโมงที่ผ่านมา

    I’m keen to know how people do versioning in .NET if they aren’t using CI/CD. I can’t find a way to do it that’s not manual. I had a way that worked in the project file using dates but that made Nuget packet manager behave strangely.

    • @pilotboba
      @pilotboba 14 ชั่วโมงที่ผ่านมา +1

      You can use gitversion and run it in your build script. Which is basically how we do it in our CI which is nothing more than an automated way to run your build script.
      (just don't tell me you don't use version control either.)

    • @ghaf222
      @ghaf222 14 ชั่วโมงที่ผ่านมา

      @@pilotboba Thanks, I’ll look into that.

  • @tonygeorgiew7612
    @tonygeorgiew7612 19 ชั่วโมงที่ผ่านมา +5

    What is the point of DependsOnI(OtherTest) ? This is violation of FIRST principles in unit testing. Unit tests shouldn't depend on one another.

    • @nickchapsas
      @nickchapsas  18 ชั่วโมงที่ผ่านมา +1

      Like I said, it’s not for unit testing

    • @MelGrubb
      @MelGrubb 16 ชั่วโมงที่ผ่านมา +5

      Integration testing is different. You're testing suites of behavior. 1) Create a new user. 2) Retrieve the just-created user. 3) Update their email address. 4) Check that the change was persisted. 5) Clean up after yourself by deleting the user. 6) Check that the user was deleted.
      These are six different tests that have to run in a specific order. Yes, you can cram all of these into a single "CRUD" test, but the granularity of 6 individual tests is better for visibility. Now, what I need is the ability to say that #3 depends on #2, and #4 depends on #3, but #5 should only run after #3 & #4 even if they fail. I want to know what the "CRD" parts work, but the "U" is currently broken.

    • @IronDoctorChris
      @IronDoctorChris 12 ชั่วโมงที่ผ่านมา

      ​@@MelGrubb
      Awesome so you can make 6 bad interrelated tests instead of 6 independent ones. And for some reason feel good about it because they're integration tests, not unit tests

    • @MelGrubb
      @MelGrubb 10 ชั่วโมงที่ผ่านมา

      @@IronDoctorChris Integration tests are sometimes about entire workflows. This, then this, then this. It's not all the time, certainly, but I definitely write workflow/scenario-driven tests on occasion. It would be nice to have a testing framework that supports this by design rather than me having to write one multi-step test. If you don't like it, or can't wrap your head around complex testing scenarios, then nobody is trying to force you. I'm just saying built-in support for those of us that can would be nice.

  • @ArnonDanon
    @ArnonDanon 17 ชั่วโมงที่ผ่านมา

    Thanks for intreducing a new tool to our toolbelt, now we know it exists we can decide if and when it might solve us a problem. Cool library thanks.

  • @SuperGulamali
    @SuperGulamali 17 ชั่วโมงที่ผ่านมา

    Even if i wanted to use it, Projects will still just have N/X Unit 😂

  • @ahmedabd-a6
    @ahmedabd-a6 20 ชั่วโมงที่ผ่านมา

    Was it necessary to mention how handsome is he!! 😅😅.
    Great library will give it a try

    • @pilotboba
      @pilotboba 14 ชั่วโมงที่ผ่านมา +1

      Was it necessary to comment on the mention of how handsome he is? (inception activated)

    • @ahmedabd-a6
      @ahmedabd-a6 14 ชั่วโมงที่ผ่านมา

      @@pilotboba 😂😂😂

  • @parlor3115
    @parlor3115 18 ชั่วโมงที่ผ่านมา +3

    Nah, this is just a conspiracy to cover the entire alphabet

    • @nickchapsas
      @nickchapsas  18 ชั่วโมงที่ผ่านมา

      I wished for G Unit but I wasn’t lucky this time

  • @0xSLN
    @0xSLN 8 ชั่วโมงที่ผ่านมา

    Playwright?

  • @vitalydushkin
    @vitalydushkin 16 ชั่วโมงที่ผ่านมา +4

    No thanks. Migrating to this would be so much pain and expensive, while it has no real benefits.

  • @user-ko2yo3zx8h
    @user-ko2yo3zx8h 19 ชั่วโมงที่ผ่านมา

    Add(6,9) nice 🤣

  • @alexshckv
    @alexshckv 14 ชั่วโมงที่ผ่านมา

    IMO too much source generation here. I can understand it for production code, but for tests.

  • @hellowill
    @hellowill 9 ชั่วโมงที่ผ่านมา

    They just made it look like junit and assertj... lol

  • @user-nq8ln7ps7x
    @user-nq8ln7ps7x 16 ชั่วโมงที่ผ่านมา

    Nice

  • @richie7425
    @richie7425 18 ชั่วโมงที่ผ่านมา +6

    I see no value bar its a bit faster. change for the sake of change. in the end you should be running the test your working for then a final full run before you push. after that the pipeline does the testing and really who cares on the speed of that since if its spec'd correctly it will be no issue. If my app is so large and complex that it is way to slow on testing. either your writing tests wrong or your at the point to rearchitecture and or move to go or something that better suits larger projects.

  • @xBodro
    @xBodro 16 ชั่วโมงที่ผ่านมา +1

    Is that paid ads?

    • @nickchapsas
      @nickchapsas  15 ชั่วโมงที่ผ่านมา

      It would have to be disclosed if it was so no

  • @wiipronhi
    @wiipronhi 10 ชั่วโมงที่ผ่านมา

    So it runs a little faster meaning my 6k tests take less than 30 seconds to run but I loose Assery.AreEqual in exchange for a much more verbose setup.
    I have thousands of asserts and write those most of the time, why is this better for me on a day to day basis other than a speedup... I can always use slow tests as an excuse to optimise my code...

    • @Thomhurst
      @Thomhurst 10 ชั่วโมงที่ผ่านมา +1

      You can use whatever assertion library you like. You're not tied to one or the other.

    • @wiipronhi
      @wiipronhi 10 ชั่วโมงที่ผ่านมา

      @@Thomhurst at the same time I can also use any unit testing library I like, the point of switching something so foundational is to give an advantage vs what I'm already using.
      If that thing is speed then this is great but if I now need to supplement the 'superior' thing with more dependencies or write wrappers to get the correct behaviour then it might not be worth the effort since it's very possible that my development workflow and this library are just not aligned.
      If they committed to providing both styles (with await if that's needed here) then that would be great and would make the conversion process more palatable.

    • @Thomhurst
      @Thomhurst 10 ชั่วโมงที่ผ่านมา

      ​@@wiipronhiif converting to this provided challenges for you, I'd be open to hearing them so I could hopefully help alleviate them!

    • @wiipronhi
      @wiipronhi 8 ชั่วโมงที่ผ่านมา

      @@Thomhurst It's not the conversion process itself, that's (hopefully) a one time operation that can be sped up with some regex (and manual fixes). The issue is mostly the difference in style between fluent and non-fluent assertions in day to day work.
      Assert.AreEqual("A", "B");
      Assert.That("A").IsEqualTo("B");
      Both of these do the same thing, but now I don't know all of the capabilities of the built-in assertion framework because some functionality will be hidden behind various operators. I'm not familiar with Tunit but usually there is some level of nesting for all the capabilities to be found which leads to devs searching through various sub types ("Is", "Is.Not", etc.) or giving up and using google.
      If you are looking at that code above in code review it looks more straight forward the first time you read it because it reads more like a sentance... great... but am going to read and write a lot of these things. As far as I can tell there is not really a good use-case for all of this method chaining when I can do it all in one call which is faster to write and faster to read.
      Maybe TUnit hasn't gone as far down the fluent rabbit hole as some other frameworks (.That(X).IsEqualTo(Y) vs .That.Is.EqualTo(Y) ) but if they are going down that path then the developers of that library are making the decision to support what I see as usability issues rather than helping me keep my code small and the code I have to review minimal.
      You seem to somewhat be pro fluent assertions, can you give me a use case where the fluent style is actually an advantage vs just having all accessors available on the Assert class? Builders have their use case but once I'm chaining 3-4 of them together it always feels like I need to go over multiple lines and that calls could have just been optional parameters or scopes.

    • @wiipronhi
      @wiipronhi 7 ชั่วโมงที่ผ่านมา

      ​@@Thomhurst TH-cam deleted my reply but in short it's not about the conversion, that's a one time thing that is just the grunt work of getting through it.
      The real issue is day to day usage where the fluent assertions make it harder to find APIs as they are hidden in sub types (typically, not necessarily here). They also don't make it faster as it's more code to write and in code review it's more code to read which only benefits from the more verbose syntax the first time you read it after that it just takes longer to read compared to normal statements.
      If this is the focus of the library devs to provide this style then they seem to have different priorities which might mean that I find other issues down the line that I have to work around. Yes I can get a library but then I'm dependent on the library exposing all the functionality and I can write my own wrappers but that has the same issues and takes time to write and potentially more time to maintain as TUnit evolves.
      You seem to be pro fluent assertions, can you give me an example where the more declarative style is beneficial? I usually find with this style pro programming it's more text which feel like it could have just been optional parameters on the main assert method or a scope for grouped things.

  • @local9
    @local9 18 ชั่วโมงที่ผ่านมา

    Why do I feel like I've used something like this in Java, christ I hate Java.

  • @z0nx
    @z0nx 15 ชั่วโมงที่ผ่านมา +1

    Really underwhelming after that introduction, lol. Sounds like problems that existing testing libraries should be solving, no need for a new one

  • @SnazzieTV
    @SnazzieTV 17 ชั่วโมงที่ผ่านมา +1

    can we stop add more ways to write tests. Focus on doing less and less tests. Let AI write tests for us.

  • @BlTemplar
    @BlTemplar 19 ชั่วโมงที่ผ่านมา +1

    The best way to write integration tests is not use C# to write them. I simply run my C# app and the environment in docker and send requests from jest tests in js. Tests are very short and run concurrently. Jest looks miles better than this.

    •  18 ชั่วโมงที่ผ่านมา

      Usually you want to test the final effects of the execution, such as if the data is correctly stored in the database. I'm not sure if this is easy with Jest but with standard integration tests you just query the same DB that was used for testing.

    • @Sergio_Loureiro
      @Sergio_Loureiro 17 ชั่วโมงที่ผ่านมา +2

      There is no way Javascript ever could ever look better than c#.

    • @BlTemplar
      @BlTemplar 17 ชั่วโมงที่ผ่านมา

      You can do queries in js of course but you don’t necessarily have to query the database manually. For example if you test POST endpoint you can check the result via GET endpoint

    • @BlTemplar
      @BlTemplar 17 ชั่วโมงที่ผ่านมา

      @@Sergio_Loureiro it’s definitely better for tests. You don’t need static typing in tests.

  • @chswin
    @chswin 14 ชั่วโมงที่ผ่านมา

    Source generation is lame…

  • @marcobaccaro
    @marcobaccaro 17 ชั่วโมงที่ผ่านมา

    There is nothing brilliant about this. This is all potato-potAto.

    • @nickchapsas
      @nickchapsas  15 ชั่วโมงที่ผ่านมา

      Use MsTest Marco

  • @cocoscacao6102
    @cocoscacao6102 16 ชั่วโมงที่ผ่านมา

    Are you advocating for testing due to benefits of it, or because you have a course on it, and it brings you a lot of m**effing money?

    • @nickchapsas
      @nickchapsas  15 ชั่วโมงที่ผ่านมา +5

      Both due to the benefits of it and because it brings me a lot of motherfucking money

  • @alexsherzhukov6747
    @alexsherzhukov6747 15 ชั่วโมงที่ผ่านมา

    Offers nothing really useful, most features allow you to do what you usually shouldnt be doing anyways

    • @nickchapsas
      @nickchapsas  15 ชั่วโมงที่ผ่านมา +4

      What a weak, narrow minded argument

  • @MatinDevs
    @MatinDevs 20 ชั่วโมงที่ผ่านมา

    First!

  • @amirhosseinahmadi3706
    @amirhosseinahmadi3706 19 ชั่วโมงที่ผ่านมา +48

    Offers basically nothing interesting over xUnit/NUnit. I don't know what I'm supposed to be excited about here.

    • @nickchapsas
      @nickchapsas  18 ชั่วโมงที่ผ่านมา +33

      If you can’t see it then it’s not for you

    • @petropzqi
      @petropzqi 17 ชั่วโมงที่ผ่านมา +7

      Same here. I can't see anything that I can't do in NUnit.

    • @lylobean
      @lylobean 16 ชั่วโมงที่ผ่านมา

      Found two nunit developers. It is very different.

    • @saymehname
      @saymehname 15 ชั่วโมงที่ผ่านมา +2

      You probably work with trivial business logic.

    • @markmcwhirter9
      @markmcwhirter9 15 ชั่วโมงที่ผ่านมา +8

      If you have 500 tests it makes a difference in testing speed performance. If you have nontrivial tests, it helps simplify seup