I want to update shared step in my testcase using C# program

Amey Pimpley 21 Reputation points
2024-05-20T07:48:00.78+00:00

I want to update shared steps in my testcase using C# program,

I was able to get the shared steps reference with below code, but found that it is not updating the shared steps in tfs.. giving error "The ids and revisions collections must have the same length."

ITestIterationResult iterationResult = GetIterationResult(mCurrentTestCaseID, result);

                ITestCase testCase = result.GetTestCase();

                if (testCase.Actions[mCurrentSharedStep] is ISharedStepReference sharedStepReference)

                {

                    ISharedStep sharedStep = sharedStepReference.FindSharedStep();

                    TFSPluginLog.Write(LogType.Info, "UpdateSharedStepResult: " + sharedStep);

                    foreach (ITestAction action in sharedStep.Actions)

                    {

                        if (action is ITestStep subTestStep)

                        {

                            //ISharedStepResult sharedStepResult = iterationResult.CreateSharedStepResult(action.Id, subTestStep.Id);

                            ISharedStepResult sharedStepResult = iterationResult.CreateSharedStepResult(testCase.Actions[mCurrentSharedStep].Id, subTestStep.Id);

                            sharedStepResult.Comment = comments[index];
C#
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.
11,100 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,011 questions
0 comments No comments
{count} votes

Your answer

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