Elegant Acceptance Testing in .NET with SpecFlow

Поделиться
HTML-код
  • Опубликовано: 27 ноя 2024

Комментарии • 51

  • @justinmarshall5891
    @justinmarshall5891 Год назад +2

    Thankyou Nick Chapsas and Specflow for demystifying the interesting topic of Acceptance Testing in .NET

  • @crisu85
    @crisu85 3 года назад +5

    I didn't knew about Fluent Docker, love it

  • @nickwong9649
    @nickwong9649 Год назад +4

    My team has some usage on specflow as well, ultimate goal is to let someone else write the test, but so far are still maintained by developers themselves.
    My biggest concern/problem is using of verbal sentence and attempt to map it back to the code implementation is very difficult, especially the system is complex enough.
    Everyone describe the test/steps slightly differently. Some may think your 'given' should not be written in that way, some may think you can describe your 'when' better. Even the same guy who write the description can describe the same scenario steps in a totally different way later when he come back. This is just an extra layer of human language to code mapping which will never be consistent and will never be standardized and you have to spend a lot of time finding whether the step you want in your mind has been implemented by someone already or not. Now, if you find something similar exist, you still need to check if the implementation is just the one you need or not.
    If not? Then people tend to define some given-when-then in a similar but slightly different way, to just meet their own need. Why not parameterize it? Yes, it can, but this breaks all existing tests, sometimes even across test scenarios if it is some common steps, and no one will risk to do that.

    • @HB-vt2dy
      @HB-vt2dy 4 месяца назад +1

      Yeah it needs some coordination and team agreements how to work with it. Please check the test pyramid. Unit tests should be written with unit test tools. BDD/Cucumber/Specflow should be used for component or high-level acceptance tests. They should reflect the user perspective. So the organization of Specflow Tests should follow the structure of requirements or business description of the application.

  • @HuntsWorkshop
    @HuntsWorkshop 3 года назад +2

    Hooks line 40 is killing me Nick lol since You have me 'hooked' on 1 dot per line formatting. .Build().Start(); Awesome video as always man!

  • @cyrilc189
    @cyrilc189 2 года назад

    2:13 Lol.. I felt your pain when you complained about the lack of a dark theme. Dark themes for the win. This should be a must for all modern UIs.

  • @ArchLordTT
    @ArchLordTT 3 года назад +1

    Nick, thx for greatest videos. I'm totally in love with BDD, but have some troubles with implementing it in .NET.

  • @daa82
    @daa82 3 года назад +1

    Great video Nick!

  • @HenriqueSantos-gv4wr
    @HenriqueSantos-gv4wr Год назад

    Firstly, excellent video Nick.
    I was unsure about how the HttpClient is being used, as it seems that before each scenario we are instantiating a new HttpClient. This can be harmful when occupying server ports. This way we guarantee a single instance for all tests?

  • @marcinsiennicki7451
    @marcinsiennicki7451 3 года назад +1

    Hi Nick great video. Could you write something about your path to learning specflow and acceptance tests?

  • @SelmirAljic
    @SelmirAljic 3 года назад +3

    I’m interested in how you would write acceptance test for a GUI application. In my previous company they started a headless version of the app and injected the registered services in the tests, do you think there’s a better approach?

  • @petropzqi
    @petropzqi 10 месяцев назад

    Gold

  • @11r3start11
    @11r3start11 3 года назад +1

    great videos!
    But watching your API-testing videos I’m always wondering why don’t you use TestClient (which will run a real API in-memory) ?

    • @nickchapsas
      @nickchapsas  3 года назад +3

      It will run a real api in memory but that is not the experience that your consumers will have. It is “most likely” to perform exactly the same but it’s not guaranteed when networking is involved. TestClient is great for integration tests but I would never use it for acceptance tests

  • @AlanDarkworld
    @AlanDarkworld 3 года назад +3

    I completely understand the need to test a system from an external / user perspective. But I fail to see the value in all of the prose and the artificial given/when/then separation. It just causes headaches with contexts and passing over values (as opposed to local variables in a unit/integration test). Also, the "features" file is just prose, it tells you nothing about what is actually being executed. It's a glorified comment. Where's the benefit?

    • @nickchapsas
      @nickchapsas  3 года назад +8

      The benefit is that it makes it very clear to see how the system is supposed to be behaving. Once written, you don't need to dive into any C# code to see how things should work and how your solution should be coming together. SpecFlow also makes it very easy for everyone to see by using the LivingDoc feature. It also enables ATDD, which is how I'm personally using it. Here is how it works in my case. All the features are written by product people, either product managers or product owners. Then when I'm starting to develop that feature, I first implement the feature file in the solution and create the bindings and then I build the feature to satifsy the test. If you can train your team to be on that level then it makes it so incredibly easy to build the right thing. It's not for everyone but it can really work.

    • @pilotboba
      @pilotboba 3 года назад +1

      One big benefit is that Business Analysts or Testers or Product Owners, etc (ie non devs) can learn gerkin and write these scenarios for you. Those acceptance tests can drive your development.
      Another great example of this is fitnesse. Which lets you write acceptance tests in a web UI and run them right from there.

    • @talmcmahon836
      @talmcmahon836 3 года назад +7

      I Use Specflow/Gherkin for 2 primary reasons. 1) Young developers can't always organize their thoughts/code into clear an concise pieces and the side effect of using Gherkin is that they do start thinking that way. 2) After 20 years in software development, it is abundantly clear to me that documentation about what specific business rules and how the software is exercising those rules is the last thing on anyone's list of things to do. Using Specflow and Gherkin as part of your testing regime gives the built in bonus of having a nearly human readable set of documentation packaged along with your codebase. There are even tools that will take the Gherkin and turn it into a "pretty" document.

  • @matthewrossee
    @matthewrossee 5 месяцев назад

    So what's the difference compared to end-to-end testing?

  • @arturrjXXXXXXXX
    @arturrjXXXXXXXX 3 года назад

    Hi Nick! TOP video! Where Do I found the sources for this video?

  • @LonliLokli
    @LonliLokli 3 года назад +1

    Great video, thanks for creating! But lines of code are too heavy, integration tests with mocking repository is simpler as for me.

  • @amazotv8382
    @amazotv8382 2 года назад

    Hi Nick do you have the same tutorial available using restsharp?kindly give some guidance on using specflow with restsharp and xunit

  • @PeterManger
    @PeterManger 3 года назад

    I had to pause and stop laughing when the bright screen hits...

  • @jankowalski2652
    @jankowalski2652 2 года назад

    Did you created table in gurkin by hand or you use some tool?

  • @mortware
    @mortware 3 года назад

    Hi Nick - I'm also using Rider, and I seem to have a problem with the Selenium ChromeDriver process still running after the tests have finished. I have to kill them manually from the command line before I can run them again. Tested it in VS2022 and it kill the process properly after closing the window. Any ideas?

  • @nik6920
    @nik6920 3 года назад +1

    Unit-tests and E2E testing are much easier and take less time to create new tests

  • @sas-tube
    @sas-tube 2 года назад

    In my case not working Ductus cannot find the Dockerfile

  • @PeteHannon
    @PeteHannon 3 года назад

    Those port numbers though... 😁

  • @matthewblott
    @matthewblott 3 года назад +1

    Outstanding video.

  • @frotes
    @frotes 3 года назад

    Great video, especially the part with docker included.
    I often hear many terms to describe different layers or scopes for tests such as unit, integration, end to end, regression, functional, behavioral, acceptance. How do you go about reconciling all these or what are the nuisances between some that seem the same?

  • @paulmouatib9999
    @paulmouatib9999 3 года назад +2

    How much does Specflow cost?

    • @nickchapsas
      @nickchapsas  3 года назад +5

      Specflow is free and all the previously "paid" features are also free now

    • @paulmouatib9999
      @paulmouatib9999 3 года назад

      @@nickchapsas Nice :) I may consider it in my future projects for my customers. Thx a lot! I didn't knew this framework

  • @andrenec
    @andrenec 3 года назад

    Thank you for this great video. Would you like please to share you dockerfile with us?

  • @RuslanRios
    @RuslanRios 3 года назад

    Hi man. How can i get your fully course about of c# or .net core? Have you any tutorial beginner to the advanced?

    • @nickchapsas
      @nickchapsas  3 года назад +2

      I am not selling any courses. All my content is free and available on RUclips.

    • @RuslanRios
      @RuslanRios 3 года назад

      @@nickchapsas thanks for explanation

  • @Sambafrosch
    @Sambafrosch 3 года назад

    I'm not able to run the test scenarios from within the feature file, only from the test explorer. What do I miss?

    • @nickchapsas
      @nickchapsas  3 года назад

      You can run them from the feature file as well and also debug them. You just need to have the extension/plugin installed

    • @Sambafrosch
      @Sambafrosch 3 года назад

      @@nickchapsas Thanks for your response. I have the SpecFlow extension installed, Version 2019.0.91.54171, but there is no green triangle shown. I use VS Professional.

    • @nickchapsas
      @nickchapsas  3 года назад

      @@Sambafrosch I only use JerBrains Rider, not VS so I wouldn't know.

    • @Sambafrosch
      @Sambafrosch 3 года назад

      @@nickchapsas I figured it out. This feature was removed. You can find the details here support.specflow.org/hc/en-us/community/posts/360013261057--VisualStudio-Extension-Ability-to-run-the-scenarios-directly-on-feature-files

  • @eduardkovacs8740
    @eduardkovacs8740 3 года назад

    Is this example available somewhere?

  • @clearlyunwell
    @clearlyunwell 3 года назад

    👍

  • @HB-vt2dy
    @HB-vt2dy 4 месяца назад

    I know and like Cucumber from the Java world. Now I am working in a C# company and really like to introduce here Specflow. Its efficient, precise and really easy-to-use. One question remains: How can e2e Tests be composed from component tests? E.g. we have different apps (web, win, android) and Specflow Tests for each of these components. Tests are all in one .sln and for each component there is a .csproj:
    AllTests.sln
    WebTests.csproj
    WinTests.csproj
    AndroidTests.csproj
    e2eTests.csproj
    In the e2e.csproj I'd like to call tests from the other projects in order to setup e2e Tests across different components. Is this possible with Specflow?