[英]Running parallel and sequential tests using TestNG, Appium and Selenium
I am building a test framework that should support test execution on Android, iOS and Web.我正在构建一个测试框架,它应该支持在 Android、iOS 和 Web 上执行测试。 Since the app is complex with many test cases (1000+) one of the requirements is to be able to execute in parallel (here should be included tests that require only single device), also having tests with parent-child behavior (chat application - the SMS send from device 'A' to device "B").由于应用程序很复杂,有许多测试用例(1000+),其中一个要求是能够并行执行(这里应该包括只需要单个设备的测试),还具有父子行为的测试(聊天应用程序 - SMS 从设备“A”发送到设备“B”)。 I am planning to use POM with PageFactory.我打算将 POM 与 PageFactory 一起使用。
So here my initial thoughts on how to do this:所以这里是我关于如何做到这一点的初步想法:
Pros: easy to manage driver instance creation before each test, manageable sequential (parent-child) test execution (in testng.xml I can specify parent and child methods) easy manageable parallel execution.优点:在每次测试之前易于管理驱动程序实例创建,可管理的顺序(父子)测试执行(在 testng.xml 我可以指定父方法和子方法)易于管理的并行执行。
Cons: create an instance of the driver before each tests method will be time consuming, if one test perform sign in, and the next test needs to send SMS, due to driver initialization in beforeMethod I need to perform sign in (code duplication) again.缺点:在每个测试方法之前创建一个驱动的实例会很耗时,如果一个测试执行登录,并且下一个测试需要发送短信,由于beforeMethod中的驱动初始化我需要再次执行登录(代码重复) .
Could you suggest or point to a framework that can support all mentioned requirements.您能否建议或指出一个可以支持所有提到的要求的框架。 Should I use the selenium grid?我应该使用 selenium 网格吗?
Any help is highly appreciated:)非常感谢任何帮助:)
Based on your description, you can check AppiumTestDistribution framework and extend it for your needs.根据您的描述,您可以检查AppiumTestDistribution框架并根据您的需要对其进行扩展。
I suggest checking official docs and this project is a good point to start我建议查看官方文档,这个项目是一个很好的起点
One note from myself: start driver only once in BeforeSuite
: installing the app and appium helpers apps is time consuming;我自己的一个注释:在BeforeSuite
中只启动一次驱动程序:安装应用程序和 appium 助手应用程序非常耗时; you can simply reset app state in BeforeTest
, eg by starting activity您可以在 BeforeTest 中简单地重置应用程序BeforeTest
,例如通过启动活动
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.