简体   繁体   English

使用不同的参数顺序执行TestNG测试?

[英]Execute TestNG tests sequentially with different parameters?

I am writing a series of automated tests for my e-commerce company, specifically checkout tests. 我正在为我的电子商务公司编写一系列自动化测试,尤其是结帐测试。 I need to write the exact same set of tests using a (fake) Visa, Discover, AmEx, and MasterCard. 我需要使用(假)Visa,Discover,AmEx和MasterCard编写完全相同的一组测试。 I would love to be able to write a set of tests in one or more classes and then, during the same test run, repeat the tests again only with slightly different inputs (ie, the credit card numbers). 我希望能够在一个或多个类中编写一组测试,然后在同一测试运行期间,仅使用稍有不同的输入(即信用卡号)再次重复测试。 Is there anyway to do that? 反正有这样做吗? I am already running these tests in parallel using <parameters> in the testng.xml, but I want these checkout tests to run sequentially as a part of the entire test run for a particular browser, but those test runs on different browsers are ran in parallel (which I already have accomplished). 我已经在testng.xml中使用<parameters>并行运行这些测试,但是我希望这些签出测试作为特定浏览器的整个测试运行的一部分按顺序运行,但是这些测试运行在不同的浏览器上并行(我已经完成)。

Read up on the @DataProvider annotation and how to use it in the TestNG documentation. 在TestNG文档中阅读@DataProvider批注以及如何使用它。 It's what makes TestNG special. 这就是使TestNG与众不同的原因。 The data provider method will send as many rows of data to a test method as you want. 数据提供者方法将根据需要将尽可能多的数据行发送到测试方法。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM