简体   繁体   English

使用 TestNG、Appium 和 Selenium 运行并行和顺序测试

[英]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:所以这里是我关于如何做到这一点的初步想法:

  • In before suite to install the application on android/ios using CLI在之前的套件中使用 CLI 在 android/ios 上安装应用程序
  • In testng.xml provide device related parameters such as udid, platform, os etc...在testng.xml中提供设备相关参数如udid、platform、os等...
  • In beforeMethod in BaseTest that extends all tests - to initialize driver (android, ios or web (chrome,ff...))在扩展所有测试的 BaseTest 中的 beforeMethod 中 - 初始化驱动程序(android、ios 或 web(chrome、ff...))
  • AfterMethod to quit the driver (also I can have before/after methods in test level) AfterMethod 退出驱动程序(我也可以在测试级别使用 before/after 方法)

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.

相关问题 Selenium:TestNG:测试未并行运行 - Selenium: TestNG: Tests are not running in parallel 使用Selenium WebDriver,Selenium Grid和testNG运行并行测试 - Running Parallel Tests using Selenium WebDriver, Selenium Grid and testNG Selenium - TestNG:测试未并行运行 - 使用 selenium + java + browserstack - Selenium - TestNG: Tests are not running in parallel - Using selenium + java + browserstack 基于TestNG的Selenium测试不能并行运行 - TestNG Based Selenium Tests not running in Parallel 在使用 Spring 使用 testNG(Selenium) 运行测试时无法维持两个并行会话? - Unable to maintain two parallel sessions while running tests using testNG(Selenium) using Spring? 在 testNG Selenium 中并行执行测试 - Parallel execution of tests in testNG Selenium 参数化硒测试与TestNG并行 - Parameterized Selenium Tests in Parallel with TestNG 在 Android 中使用 cucumber、appium 和 testNG 在 Java 中进行并行测试 - Parallel tests in Android with cucumber, appium and testNG in java Appium / selenium:testNG并行执行不起作用 - Appium / selenium: testNG parallel execution not working 如何使用 TestNG、Java 和 Appium 在多个移动设备上并行运行每个测试? - How to run each tests on multiple mobile device in parallel using TestNG, Java and Appium?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM