简体   繁体   English

CUIT-在同一测试方法中,在步骤级别进行数据驱动的迭代

[英]CUIT - Data Driven iteration at step level within the same test method

I'm new to CUIT and I'm trying to create a data driven test that goes through numerous iterations in one go. 我是CUIT的新手,我正在尝试创建一个数据驱动的测试,该测试一次即可进行多次迭代。 I currently have it so that it Opens the browser, enters log in values,click sign in and closes the browser, then open a browser and start again. 我目前拥有它,因此它可以打开浏览器,输入登录值,单击登录并关闭浏览器,然后打开浏览器并重新启动。

I want it to Open the browser, enter log in values, click sign in, re-enter log in values, click sign in, re-enter log in values, click sign in, close the browser. 我希望它打开浏览器,输入登录值,单击登录,重新输入登录值,单击登录,重新输入登录值,单击登录,关闭浏览器。

[DataSource("Microsoft.VisualStudio.TestTools.DataSource.CSV", "C:\\Visual Studio 2012\\Projects\\CodedUITestProject2\\MedProvisionInvalidLogIn.csv", "WebsiteInvalidLogIn#csv", DataAccessMethod.Sequential), DeploymentItem("WebsiteInvalidLogIn.csv"), TestMethod]

public void WebsiteInvalidLogIn()
{
    this.UIMap.OpenWebsite();
    this.UIMap.TypeUserNameParams.UIUserNameEditText = TestContext.DataRow["UserNameValue"].ToString();
    this.UIMap.TypeUserName();
    this.UIMap.TypePasswordParams.UIPasswordEditPassword = Playback.EncryptText(TestContext.DataRow["PasswordValue"].ToString());
    this.UIMap.TypePassword();
    this.UIMap.ClickSignIn();
    this.UIMap.AssertSignInEnabled();
}

How would I go about this? 我将如何处理? I tried copying all the lines and pasting them in a second time(before the assert) but it didn't work. 我尝试复制所有行并第二次粘贴它们(在断言之前),但是没有用。 It only moves to the next iteration when it completes the sign in. 完成登录后,它才移至下一个迭代。

Best solution would be to make a TestInit and a TestCleanup testmethod, and put them in an ordered test with your data driven test. 最好的解决方案是制作一个TestInit和一个TestCleanup测试方法,并将它们与数据驱动测试一起置于有序测试中。 This way you will have separate test results for separate data rows. 这样,您将为单独的数据行获得单独的测试结果。

TestInit - opens browser TestInit-打开浏览器

WebsiteInvalidLogIn - the data driven test WebsiteInvalidLogIn-数据驱动测试

TestCleanup - closes the browser TestCleanup-关闭浏览器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 一个CUIT测试可以支持测试不同计算机上的两个应用程序吗? - Can one CUIT test support testing two applications that are on different computers? 如何将伪造物与Microsoft Test Manager(MTM)2012中的测试计划相关联以运行CUIT自动测试 - How to associate a Fake Build to the test plan in Microsoft Test Manager (MTM)2012 in order to run CUIT automated test MSTest 数据驱动测试集 DisplayName for Rows from DataSource - MSTest data driven Test set DisplayName for Rows from DataSource 以 Excel 文件作为数据源的数据驱动编码 UI 测试 - Data driven coded UI test with excel file as a data source Excel电子表格中的数据驱动的单元测试 - Data-Driven Unit Test from Excel Spreadsheet 为什么数据驱动的单元测试在vs2012中在vs2010中正常工作时失败? - Why does data driven unit test fail in vs2012 when it worked fine in vs2010? SSRS 2012数据驱动订阅 - SSRS 2012 Data Driven Subscriptions 如何使用多线程,单迭代加载测试 - How to load test with multiple thread, single iteration 如何使自定义提取规则属性数据驱动? - how to make custom extraction rule property data driven? Visual Studio Web测试-不要重复登录步骤 - Visual Studio Web Test - Do not Repeat Login Step
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM