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.
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.
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?
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?
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
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?
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.
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.
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.
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?
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?
@@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 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
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?
Thankyou Nick Chapsas and Specflow for demystifying the interesting topic of Acceptance Testing in .NET
I didn't knew about Fluent Docker, love it
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.
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.
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!
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.
Nick, thx for greatest videos. I'm totally in love with BDD, but have some troubles with implementing it in .NET.
Great video Nick!
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?
Hi Nick great video. Could you write something about your path to learning specflow and acceptance tests?
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?
Gold
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) ?
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
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?
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.
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.
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.
So what's the difference compared to end-to-end testing?
Hi Nick! TOP video! Where Do I found the sources for this video?
Great video, thanks for creating! But lines of code are too heavy, integration tests with mocking repository is simpler as for me.
Hi Nick do you have the same tutorial available using restsharp?kindly give some guidance on using specflow with restsharp and xunit
I had to pause and stop laughing when the bright screen hits...
Did you created table in gurkin by hand or you use some tool?
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?
Unit-tests and E2E testing are much easier and take less time to create new tests
In my case not working Ductus cannot find the Dockerfile
Those port numbers though... 😁
Outstanding video.
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?
How much does Specflow cost?
Specflow is free and all the previously "paid" features are also free now
@@nickchapsas Nice :) I may consider it in my future projects for my customers. Thx a lot! I didn't knew this framework
Thank you for this great video. Would you like please to share you dockerfile with us?
Hi man. How can i get your fully course about of c# or .net core? Have you any tutorial beginner to the advanced?
I am not selling any courses. All my content is free and available on RUclips.
@@nickchapsas thanks for explanation
I'm not able to run the test scenarios from within the feature file, only from the test explorer. What do I miss?
You can run them from the feature file as well and also debug them. You just need to have the extension/plugin installed
@@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 I only use JerBrains Rider, not VS so I wouldn't know.
@@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
Is this example available somewhere?
Check the video description
👍
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?