[英]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.