Freigeben über


How To: Data Drive CUIT Scripts

Syed Aslam Basha here from the Information Security Tools Team.

One of the major feature for any automation tool is support for data driven test cases, CUIT too supports data driven testing. Let me show an example of data driving CUIT scripts.

Suppose you want to validate login feature of an application with different users.

    • Select test menu and click on windows –> Test View
    • Select the required test name say validatehomepage
    • image
    • Click on ellipse button next to data connection string in properties window
    • You can configure the required data source, select CSV file, click on Next
    • image
    • Click on Finsh
    • image
    • Click on yes for “Copy the database file into the current project and add as deployment item”
    • image
    • You can see data source code being added to the Validatehomepage file

[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "|DataDirectory|\\UserNames.csv", "UserNames#csv", DataAccessMethod.Sequential), DeploymentItem("PortalAutomation\\UserNames.csv"), TestMethod]

public void ValidateHomePage()

  • Data source is added to the project, now assign the values from data source to parameters of CUIT
  • this.UIMap.LoginAdminParams.UsernameEditText = testContextInstance.DataRow[0].ToString();
  • Run the tests, it runs for two iterations and shows the results

Likewise you can data drive any of the test cases, if you think out of the box you can apply the concept to validate all links present in web page.

-Syed Aslam Basha ( syedab@microsoft.com )

Microsoft Information Security Tools (IST) Team

Test Lead

---------------------------------------------------------

Please leave a comment if the blog post has helped you.