How do I run specflow unit tests from a browser - bdd

I was able to run SpecFlow scenarios from a test project. Now I would like to be able to run these scenarios from a browser. How do I get that to work?

I think you'll need to use something like Selenium or Watin to drive the browser from your SpecFlow step definitions.

Related

TFS on Automation Tests Suits - How to Run

I have 2 executables, an app and an automation test app who will perform actions on the app. My automation tests are basically NUNIT tests who calls Chrome Web Driver.
Everything is hosted at TFS. In my build definition, i run sanity checks for every PR. I wanted to expand that. The automation tests are divided into many different categories (being Sanity a category). I've been seeing some stuff related to TFS Test Suits, and my idea was to make in a way whenever when someone makes a PR, he could choose some test category to run on that PR using that build. So in a easyer way of sayng, if my PR changes how 'blue buttons work' ill run the 'blue buttons test suit' on my pr.
Would using Test Suits be the best solution for this ? Has any1 done this or have any nice information on how to achieve this ?
Thanks for any responses !! Best regards !
You could be able to use the Visual Studio Test Agent Deploy and Run Functional tests steps in your build definition to run auto tests on build agents.
Associated test methods with test cases in Visual Studio.
Create a build definition to build your project and add the 2 steps I mentioned above. In the Run Functional Test step, select the test suites which contains those test cases in step1.
More details please refer this blog: Executing Automated tests in Build vNext using Test Plan, Test Suites

TFS Build Definition Ignore Coded UI Tests

We recently added Coded UI Tests to our solution. The tests complete successfully when ran through Test Explorer but when the code is checked in and a build is triggered, all the CUIT's fail (error message is below).
I have gone to each of the links in the error message. The first one details how to set up a test agent to run the tests. We don't really need tests on all our environments as we are setting up a lab environment to run them and adding the test agent would require me submitting a ticket which would probably take months to get a response back, not to mention walking the person through what needs to be done.
The second link is dead and I'm pretty sure I don't want to change the build to be interactive.
I am hoping there is an easy way to change the build definition (which I have access to) so that it can ignore all Coded UI Tests but still run the Unit Tests. Is this possible? Is there an easier way of going about this? Each set of tests have their own project file, all Coded UI Tests in one project and all Unit Tests in another project.
Thanks in advance.
Here is the error that is on all of the coded UI tests:
Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: Microsoft.VisualStudio.TestTools.UITest.Extension.UITestException: To run tests that interact with the desktop, you must set up the test agent to run as an interactive process. For more information, see "How to: Set Up Your Test Agent to Run Tests That Interact with the Desktop" (http://go.microsoft.com/fwlink/?LinkId=255012)
If you are running the tests as part of your team build, you must also set up the build agent to run as an interactive process. For more information, see "How to: Configure and Run Scheduled Tests After Building Your Application" (http://go.microsoft.com/fwlink/?LinkId=254735).
One thing you can do is to group all the coded UI tests into a particular test category and exclude running those in the build. We do this with our "integration" tests and only choose to run our true unit tests for speed reasons.
See below link for how to use test categories:
https://msdn.microsoft.com/en-us/library/dd286683.aspx
Also see the below for how to edit your build definition to only run the tests you want:
Excluding tests from tfs build
You can use use some naming patterns and combine that with the Test case Filter option in the execute test step:
https://jessehouwing.net/xaml-build-staged-execution-of-unit-tests/
Something like:
FullyQualifiedName ~ .Ui.
This would require the Ui tests to have .Ui in the namespace

How to integrate specflow unit test with MTM test cases

How to integrate specflow unit test with MTM test cases.
1) I have created the automated unit tests in specflow-C#-BDD style.
2) I already have manual test cases in MTM
3) I am connected to TFS and my project is checkedin.
I need to make sure the unit test methods (automation) are run against the manual test cases in the mtm from my local machine. I have referred various articles over the internet but unable to reach to a solution. It was found that i need to create test agents , controllers and environment which i am unable to do.
Please guide me from here.
You can integrate any MS Test Unit Test with a test case.
If you are using Specflow you need to make sure that you implement using MS Test. This is fairly strait forwards and allows you to execute the automation in a test environment. In visual studio if you open your solution that contains the tests you can also open the test case and associate on the automation tab.
You then add your environment within which you want to run the tests to Lab Manager as a Standard Environment.
http://nakedalm.com/standard-environments-for-automated-deployment-and-testing/

Analyzing Code Coverage from GRUNT

I have a JavaScript-heavy app being built via GRUNT. To test this app, I have tests written with Jasmine. The tests are being run via Karma and Protractor. I would like to show code coverage of these tests in the command-line. My question is, how do I do this? I can't figure out how to integrate code coverage details within my build process. Ideally, I would love to see code coverage of my unit tests and code covereage of my integration tests.
Thank you.
I don't believe code-coverage is possible at this time with Protractor. Karma's code-coverage is made available via istanbul. It appears one would have to write a custom reporter. I agree this would be a nice feature. I may take some time in the near future to see if I can crank this out. If I make any progress, I will post here again.

How can we execute test cases using MTM

I am using VS 2012, TFS and MTM. I have created test cases manually in MTM. When I try to run the test case it does not launch the browser. Please let me know what needs to be done.
MTM does not launch the browser for you. I would recommend to get a clean test\recording that you:
Open the browser & Naviage to site
X number of steps to perform the test
Reset and Close the broswer
That way when you generate a CodedUI test from the recording you get something that can easily be automated.

Resources