Elegant Acceptance Testing in .NET with SpecFlow

2021 ж. 4 Сәу.
27 425 Рет қаралды

Check out SpecFlow: go.specflow.org/NickChapsas
Subscribe: bit.ly/ChapsasSub
Become a Patreon and get source code access: / nickchapsas
This video was sponsored by SpecFlow
Hello everybody I'm Nick and in this video I will show you how you can start writing elegant acceptance tests for your .NET applications using SpecFlow. SpecFlow is an amazing tool, primarily used to BDD but it is also a great tool to use for Acceptance Testing. It is by far the most advanced tool for such purpose in the .NET ecosystem and it's something I am personally using.
Specflow plugin for Rider: plugins.jetbrains.com/plugin/...
Don't forget to comment, like and subscribe :)
Social Media:
Follow me on GitHub: bit.ly/ChapsasGitHub
Follow me on Twitter: bit.ly/ChapsasTwitter
Connect on LinkedIn: bit.ly/ChapsasLinkedIn
#dotnet #bdd #acceptancetests

Пікірлер
  • 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.

    @nickwong9649@nickwong96499 ай бұрын
  • I didn't knew about Fluent Docker, love it

    @crisu85@crisu853 жыл бұрын
  • Thankyou Nick Chapsas and Specflow for demystifying the interesting topic of Acceptance Testing in .NET

    @justinmarshall5891@justinmarshall5891 Жыл бұрын
  • Great video Nick!

    @daa82@daa822 жыл бұрын
  • Nick, thx for greatest videos. I'm totally in love with BDD, but have some troubles with implementing it in .NET.

    @ArchLordTT@ArchLordTT3 жыл бұрын
  • 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!

    @HuntsWorkshop@HuntsWorkshop3 жыл бұрын
  • 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.

    @cyrilc189@cyrilc1892 жыл бұрын
  • Hi Nick great video. Could you write something about your path to learning specflow and acceptance tests?

    @marcinsiennicki7451@marcinsiennicki74513 жыл бұрын
  • Outstanding video.

    @matthewblott@matthewblott3 жыл бұрын
  • 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?

    @SelmirAljic@SelmirAljic3 жыл бұрын
  • Hi Nick! TOP video! Where Do I found the sources for this video?

    @arturrjXXXXXXXX@arturrjXXXXXXXX3 жыл бұрын
  • Gold

    @petropzqi@petropzqi4 ай бұрын
  • 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?

    @HenriqueSantos-gv4wr@HenriqueSantos-gv4wr6 ай бұрын
  • Hi Nick do you have the same tutorial available using restsharp?kindly give some guidance on using specflow with restsharp and xunit

    @amazotv8382@amazotv8382 Жыл бұрын
  • 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?

    @frotes@frotes3 жыл бұрын
  • Great video, thanks for creating! But lines of code are too heavy, integration tests with mocking repository is simpler as for me.

    @LonliLokli@LonliLokli3 жыл бұрын
  • 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) ?

    @11r3start11@11r3start113 жыл бұрын
    • 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

      @nickchapsas@nickchapsas3 жыл бұрын
  • Did you created table in gurkin by hand or you use some tool?

    @jankowalski2652@jankowalski2652 Жыл бұрын
  • 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?

    @mortware@mortware2 жыл бұрын
  • I had to pause and stop laughing when the bright screen hits...

    @PeterManger@PeterManger2 жыл бұрын
  • In my case not working Ductus cannot find the Dockerfile

    @sas-tube@sas-tube Жыл бұрын
  • Those port numbers though... 😁

    @PeteHannon@PeteHannon3 жыл бұрын
  • Hi man. How can i get your fully course about of c# or .net core? Have you any tutorial beginner to the advanced?

    @RuslanRios@RuslanRios3 жыл бұрын
    • I am not selling any courses. All my content is free and available on KZhead.

      @nickchapsas@nickchapsas3 жыл бұрын
    • @@nickchapsas thanks for explanation

      @RuslanRios@RuslanRios3 жыл бұрын
  • Unit-tests and E2E testing are much easier and take less time to create new tests

    @nik6920@nik69202 жыл бұрын
  • Thank you for this great video. Would you like please to share you dockerfile with us?

    @andrenec@andrenec2 жыл бұрын
  • 👍

    @clearlyunwell@clearlyunwell3 жыл бұрын
  • Is this example available somewhere?

    @eduardkovacs8740@eduardkovacs87403 жыл бұрын
    • Check the video description

      @nickchapsas@nickchapsas3 жыл бұрын
  • I'm not able to run the test scenarios from within the feature file, only from the test explorer. What do I miss?

    @Sambafrosch@Sambafrosch3 жыл бұрын
    • You can run them from the feature file as well and also debug them. You just need to have the extension/plugin installed

      @nickchapsas@nickchapsas3 жыл бұрын
    • @@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.

      @Sambafrosch@Sambafrosch3 жыл бұрын
    • @@Sambafrosch I only use JerBrains Rider, not VS so I wouldn't know.

      @nickchapsas@nickchapsas3 жыл бұрын
    • @@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

      @Sambafrosch@Sambafrosch3 жыл бұрын
  • 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?

    @AlanDarkworld@AlanDarkworld3 жыл бұрын
    • 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.

      @nickchapsas@nickchapsas3 жыл бұрын
    • 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.

      @pilotboba@pilotboba3 жыл бұрын
    • 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.

      @talmcmahon836@talmcmahon8363 жыл бұрын
  • How much does Specflow cost?

    @paulmouatib9999@paulmouatib99993 жыл бұрын
    • Specflow is free and all the previously "paid" features are also free now

      @nickchapsas@nickchapsas3 жыл бұрын
    • @@nickchapsas Nice :) I may consider it in my future projects for my customers. Thx a lot! I didn't knew this framework

      @paulmouatib9999@paulmouatib99993 жыл бұрын
KZhead