Using REST VSTS API - Update existing Test Suite C

2019-08-29 04:42发布

问题:

I created a method to update an existing Test Suite. The method executes without any exception or error. However, the Test Suite is not getting updated with the list of configurations nor is the "Inherit Default Configurations" getting set to false.

    public TestSuite UpdateTestSuiteConfigurations(Guid projectId, int planId, int suiteId, List<int> configIds)
    {
        var VstsConfigurationIds = new List<ShallowReference>();

        foreach (var item in configIds)
        {
            VstsConfigurationIds.Add(new ShallowReference(item.ToString()));
        }

        var SuiteToUpdate = new SuiteUpdateModel(inheritDefaultConfigurations: false, defaultConfigurations: VstsConfigurationIds.ToArray());

        var VSTS = new TestManagementHttpClient(URI, Credentials);

        var TestSuiteUpdate = VSTS.UpdateTestSuiteAsync(SuiteToUpdate, projectId, planId, suiteId).Result;

        VSTS.Dispose();

        return TestSuiteUpdate;
    }

Can someone please point out the issue? My expectation is that after updating the Test Suite should not inherit default configurations and should have the provided configurations assigned to it. I have verified that the configurations are present and that I am using the correct configuration ids.

I have not created a shallow reference before so maybe that is the issue?

回答1:

I can reproduce this issue with 15.112.1 version of Microsoft.TeamFoundationServer.ExtendedClient package, but works fine with latest version (15.131.0-preview).

So, you can create a new project and install latest version package, then try again.