Search code examples
performance-testingcoded-ui-tests

How to run coded ui script multiple times for performance driven test


I want to run the coded UI data driven script for 7days. Is that possible?

I am running for performance testing a desktop based application.

I am using Datasource as an XML file:

      <Env> 
            <Nav>
              <Path1>a</Path1>
              <Path2>b</Path2>
              <Path3>c</Path3>
              <Path4>d</Path4>
           </Nav>
           <Nav>
             <Path1>e</Path1>
             <Path2>f</Path2>
             <Path3>g</Path3>
             <Path4>h</Path4>
          </Nav>
      </Env>

My script navigates to path abcd, then efgh and then it stops. I want that my script should continue to run to abcd again after efgh untill I stop it manually. Can I do that using coded UI ? and How?


Solution

  • You can add a simple GoTo to your [TestMethod] to keep running the same steps over and over:

    [DeploymentItem("ProjectName\\Data.xml"), TestMethod()]
    [DataSource("Microsoft.VisualStudio.TestTools.DataSource.XML",
                   "|DataDirectory|\\Data.xml",
                   "Row",
                    DataAccessMethod.Sequential)]
    public void Test()
    {
         Start:
         DoStuff();
         goto Start;
    }
    

    It's a dirty solution, but this should run until you manually stop it.