Generating test cases in TFS(MTM) using Specflow feature file - tfs

I'm very new to Specflow and working on evaluating it. I was able to write scenario, step definition, and execute the test. But now I'm stuck on integrating the feature file to TFS.
I want to know if there is a way to integrate Specflow feature file to TFS(MTM)
Following is the workflow I want to accomplish :
A feature file is created with multiple scenario
If the feature file is checked in, scenarios are automatically generated in TFS with corresponding area (maybe using tags?)
or I would appreciate if you could share any other integration suggestions you may have.
Thank you in advance!

for export scenario can be used TFS API
example - Create work item in Team Project (TFS) using c# code
https://social.msdn.microsoft.com/Forums/vstudio/en-US/1ff5415e-0ef2-4c65-b0b7-a109187adf51/create-work-item-in-team-project-tfs-using-c-code?forum=tfsgeneral

Related

Is there a way to associate Specflow+Runner test cases with Azure Test plan?

We are looking for some solutions around associating our automation test cases with Azure test plan with Specflow+Runner.
Tech stack:
Visual Studio 2017/19
.Net Framework 4.8
Specflow 3.1.97
SpecRun.Runner/SpecRun.Specflow 3.2.31
We have recently started using Specflow+ Runner and previously we were using Specflow with Xunit. When I am trying to associate a test case in Visual Studio, we are facing below issue. This used to work perfectly when we were using Xunit.
If you have come across this situation and have got a solution or workaround, please do share with us. Basically we are looking at something that can tag our automation test cases in test plan.
Below is the link that provides information about associating test cases, which worked fine for us till we were using XUnit.
https://learn.microsoft.com/en-us/azure/devops/test/associate-automated-test-with-test-case?view=azure-devops
Please do let me know in case you need any further information on this from my side. Any help will be greatly appreciated.
Sadly the association with test cases when using the SpecFlow+ Runner is not possible out of the box. There is no possibility to extend this behavior we are aware of.
But you could use SpecSync. It synchronizes your Scenarios into Test Cases and also provides the test execution results.
You can use the Azure test API's and add them in the Hooks with the correct order so test runs can be created, test results can be updated during test runs. You just need to understand how Azure test API's work and add the test case ID's to your scenario names.

TFS Release Step Create Task

I'm converting our XAML build process to vNEXT build for our on-premise TFS 2017. One step I like to automate is the create a work item task for a specific user to execute after the release has been done. Is there a built in way to do this? I have a PowerShell script but I'd prefer not to use it if there is already a better way
No, there is still no out-of-the-box feature for this. Either using the REST api or the Client Object model in a powershell script just like you have done will do the trick.
You could also take a look at this similar question: How to have TFS automatically add certain tasks to new work items?, jessehouwing has provided a great answer.
Another way is using TFS Aggregator- a serverside pugin for TFS 2013
(update 2 and later) which has the ability to create new work items
based on rules. An example task can be found here:
https://github.com/tfsaggregator/tfsaggregator/wiki/Auto-Create-Children
Update
After go through the extension in VSTS marketplace (https://marketplace.visualstudio.com/) , there is also no existing task could do this. You may still use your powershell script or write your own extension.

Creating build definition with visual studio

I am creating a build definition in visual studio 2013. As you know, while creating build definition we can also set the assembly (in "Automated Tests" section) which contains the unit test methods to run. I am able to create the definition till this point. Now, what I want is once the test run is over, I want to call an exe that will parse the Trx file generated as a result of test run and send the run results in an email.
Can anyone have an idea about where I can set the path to the exe and pass some arguments to it while creating build definition? If this cannot be done while creating definition, what else is the other way to achieve it?
Thanks!
What you ask involves multiple steps, especially if you want to pull the tool from version control (which is IMHO the best option).
See the ALM Rangers' Team Foundation Build Customization Guide for help and guidance on this topic.
Or you can just setup an email notification when the TFS Build completes. That should include the test run results, and a clickable link to go to the full build report.

Exporting Test Cases and Shared Steps

Is there any way of exporting Test Cases and Shared Steps from one project to another in TFS 2012 using database queries?
I have tried TFS Integration tool, but it did not work as I expected, so I was wondering if there is any way of doing this by connecting to SQL Server and exporting all items directly from and to the databases.
A few days ago I needed an Excel testcase export for a newer version of TFS (TFS 2013). Turns out that there is still no export to Excel function built-in to TFS (in contrast to E-Mail and Printing) and the tools became incompatible over time.
But I found this Revival-Tool that seems to work:
https://github.com/jorupp/ExportTestCases
Just wanted to point that out even if it may not be directly related to this topic with TFS2012.
You shouldn't work directly in the database, because it is not supported by Microsoft and you could harm it a lot.
I used the TFS Integration Platform tools a lot for migrating TFS2010 projects, but never used it for TFS2012. My experience with that were good and it shouldn't be a problem to migrate all Test Cases and Shared Steps into another TeamProject. If you have the same Work Item Type Definitions in both projects, you don't need to create field mappings.
Another option would be to use Excel as "Export" and "Import" cache, but you might loose some information, because not everything could be shown in Excel, e.g. Steps of a TestCase, the history, Work Item Links.
If you are skilled in programming using TFS API, you could write your own small migrator, but this could be a lot of effort.
All in all the TFS Integration Platform should be the easiest and best way, so what have been your expectations that have not been fulfilled?
You can use an alternative methods.
First export all Test cases using "Test case extractor."
Them import them in new project using "Test case import tool."
Adding to the point mentioned above, for exporting the test cases you might find the below link more useful:
http://tfstestcaseexporttoexcel.codeplex.com/
I have given it a try and found it very useful and easy to use.

bdd(specflow) and tfs build?

I manage to use bddlib(storyq) with combination of xunit.net using resharper runner. Than decided to try to specflow, since have read its advantages over storyq.
Now I do have also another requirement to integrate this all with tfs build 2010. Am bit lost there how the big picture gonna look like. I found some articles on how to make work xunit.net with tfsbuild 2010, however there is no single word on bdd lib integration with tfsbuild more specifically continuous integration (ci).
Anyone could have helped ? thanks.
If you can run it from the command-line you can simply customize your TFS Build workflow by tossing an InvokeProcess activity in there. An example of customizing the workflow can be seen here: http://www.ewaldhofman.nl/post/2010/04/28/Customize-Team-Build-2010-e28093-Part-3-Use-more-complex-arguments.aspx

Resources