Share via

Update TFS Configurations for Test Case using test Case Entry SetConfigurations USING c#

Subbu 1 Reputation point
2021-03-22T17:12:44.457+00:00

Hi Team, Is this issue resolved, could you please help me a solution again ? https://social.msdn.microsoft.com/Forums/vstudio/en-US/a65eeded-a520-44e5-a0d5-65c19a1023b2/unable-to-update-configurations-for-test-case-using-tfs-api?forum=vsmantest I am also facing same issue, I am able to update / setconfigurations for a TestSuite and at the same time, my testcases associated to testsuite are not updated. In the manual scenario - with a 2 configurations, my 30 test cases are getting doubled. But, with a c# code - it is not. Could you please help me with a solution ? ITestSuiteCollection testSuites = testproject.TestSuites.ReferencingTestCase(int.Parse(testCaseID)); foreach (var testSuite in testSuites) { testSuite.SetDefaultConfigurations(idAndNames); ITestCaseCollection testcases = testSuite.AllTestCases; var testCaseEntry = testSuite.TestCases.ToList().Find(k => k.TestCase.Id == int.Parse(testCaseID)); var idAndName = new IdAndName(1, "Configuration"); var listIdName = new List<IdAndName>(); listIdName.Add(idAndName); testCaseEntry.SetConfigurations(listIdName); }

Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Subbu 1 Reputation point
    2021-03-22T17:13:15.32+00:00

    The below code is not able to save test cases with list of configurations.

    ITestSuiteCollection testSuites = testproject.TestSuites.ReferencingTestCase(int.Parse(testCaseID));
    foreach (var testSuite in testSuites)
    {
    // var suite = testSuite.TestSuite as IStaticTestSuite;

                    testSuite.SetDefaultConfigurations(idAndNames);
    
                    ITestCaseCollection testcases = testSuite.AllTestCases;
    
                    var testCaseEntry = testSuite.TestCases.ToList().Find(k => k.TestCase.Id == int.Parse(testCaseID));
                    var idAndName = new IdAndName(1, "Configuration");
                    var listIdName = new List<IdAndName>();
                    listIdName.Add(idAndName);
                    testCaseEntry.SetConfigurations(listIdName);
    
    
               }
    

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.