0
votes

I'm asking this just to see if it is possible to run specflow test using a user credential Token to access tfs(TestCase) data.

The context: We have CI/CD pipeline in place to run over 19K Specflow tests synchronized to TFS using specsync. Most of our tests are data-driven using Scenario Outline. In our Release Management pipeline, we setup test runs to be performed on multiple tests machines. But we need to cache a user credentials to the tfs collection/project in each machine in order to have the tests to pick up the test data.

The Issue: Many times, our test failed with this output:

  • The unit test adapter failed to connect to the data source or to read the data. For more information on troubleshooting this error, see "Troubleshooting Data-Driven Unit Tests" (http://go.microsoft.com/fwlink/?LinkId=62412) in the MSDN Library. Error details: Unable to find the requested .Net Framework Data Provider. It may not be installed.*

The failure is because the tfs access credentials are no longer good for reasons such as the password has changed or the user is no longer valid, etc. Therefore, we need to connect to each machine(more than 10) and reset tfs access credentials.

The requirement: Is there a way to embed a tfs tokenized credentials into the specflow tests(Feature files) or a config file so that the data source access is transparent for the test runs?

BR

1
So, anybody to help with this?TedOss

1 Answers

0
votes

Generally, you can use personal access tokens (PAT) for connecting to TFS (see this for details), but I am not aware for any way passing this in for the TestCase data source.

As in your case the test method is generated by SpecSync, you can configure SpecSync to embed the test data to the generated method instead of sourcing them from TFS.

In SpecSync v1.*, this can be done by specifying a merged-examples parameter to the SpecSync plugin registration in the App.config file, like this:

<add name="SpecSync.MTM" type="Generator" parameters="merged-examples" />

From SpecSync v2 (currently in pre-release state), this will be the default behavior anyway, but you can change it in the specsync.json config file:

{
  ...
  "specFlow": {
    "scenarioOutlineAutomationWrappers": "iterateThroughExamples"
  },
  ...
}

(Here iterateThroughExamples uses the embedded test data (default) and useTestCaseData would get the data from TFS.)