Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7410397
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T06:13:43+00:00 2026-05-29T06:13:43+00:00

I have a series of CodedUI test methods that make up a single test

  • 0

I have a series of CodedUI test methods that make up a single test case. The test methods need to run in order (IE testmethoda runs then testmethodb and then testmethodc) and I want the results to show up in Microsoft Test Manager to look like testmethoda passed, testmethodb passed, testmethodc failed. Is there a way to do this while being able to run multiple iterations of the overall test case?

I have tried are putting the test methods into a single test method and calling that. This gives me the desired test order and the ability to make multiple test runs, but test manager shows a single pass/fail on the entire test case.

I have also tried attaching a datasource to the individual test methods and ordering them in test manager which gives me the desired test results in test manager but has the side effect that if i want to run more than one data row the order gets messed up. For example 3 data rows would run:

testmethoda
testmethoda
testmethoda

testmethodb
testmethodb
testmethodb

testmethodc
testmethodc
testmethodc

I want them to run:
testmethoda
testmethodb
testmeothdc

testmethoda
testmethodb
testmethodc etc..

I have thought about using an ordered test as well but that still shows up as a single test in MTM and there isn’t a method I am aware of to data drive it anyways so it would have it’s own problems.

Is there a feature that I am missing in VS or MTM to get these results? Maybe a method that would allow me to define a test run in the results file? Would writing/editing the trx file get my results into MTM? I have a feeling I would also have to make changes to the TFS database which isn’t an option.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T06:13:44+00:00Added an answer on May 29, 2026 at 6:13 am

    I don’t think there is a way to do this through VS or MTM. The option to add all your test methods on a single one sounds good but when one of them fails then the ‘parent’ test method stops and throws the ‘AssertFailedException’ that one of the inner tests had thrown.

    However, if your test methods (a, b, c…) are completely unaffected one by the other (this means that if the testMethodA fails the other tests can run without problems), I would try to catch all the internal exceptions and at the end print which methods passed and which not.

    [TestClass]
    public class TestClass
    {
        Dictionary<string, string> testMethods;
        bool testResult;
    
        [TestInitialize]
        public void TestInitialize()
        {
            testMethods = new Dictionary<string, string>();
            testResult = true;
        }
    
        [TestMethod]
        public void TestMethod()
        {
            //Run TestMethodA
            try
            {
                TestMethodA();
                testMethods.Add("TestMethodA", "Passed");
            }
            catch (AssertFailedException exception) //Edit: better catch a generic Exception because CodedUI tests often fail when searcing for UI Controls 
            {
                testResult = false;
                testMethods.Add("TestMethodA", "Failed: " + exception.Message);
            }
    
            //Run TestMethodB
            try
            {
                TestMethodB();
                testMethods.Add("TestMethodB", "Passed");
            }
            catch (AssertFailedException exception)
            {
                testResult = false;
                testMethods.Add("TestMethodB", "Failed: " + exception.Message);
            }
        }
    
        [TestCleanup]
        public void TestCleanup()
        {
            foreach (KeyValuePair<string, string> testMethod in testMethods)
            {
                //Print the result for each test method
                TestContext.WriteLine(testMethod.Key.ToString() + " --> " + testMethod.Value.ToString());
            }
    
            //Assert if the parent test was passed or not.
            Assert.IsTrue(testResult, "One or more inner tests were failed.");
        }
    }
    

    You could also create a different class that will manage all this behaviour to avoid all these ‘try-catch’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a series of functional tests against a web application that correctly run,
We have a series of drop down controls that determine the sort order of
I have a series of forms that I need a user to complete in
I have a series of HTML tests that I am able to run using
I have series of video files that i need to automatically draw some line
I have a series of values in a database that I need to pull
I have a series of files that I need to 'cat' whenever a one
I have a series of data that need to be written into SQL, what
I have a series of text that contains mixed numbers (ie: a whole part
I have a series of Extension methods to help with null-checking on IDataRecord objects,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.