简体   繁体   English

Cypress 跨多台机器 [Azure Devops]

[英]Cypress Across Multiple Machines [Azure Devops]

I have 20 windows 10 VMS and have about 700 solo cypress tests and I want a way to be able to spread all these tests across the 20 VMs so the tests run a lot faster is this possible and how also take into mind I need to run a Jar, as well as that, is what builds the website that the cypress tests are run on.我有 20 个 windows 10 个 VMS 并且有大约 700 个单独的柏树测试,我想要一种能够将所有这些测试分布在 20 个 VM 上的方法,以便测试运行得更快,这是否可能以及如何考虑我需要运行一个 Jar 以及那个,是构建运行柏树测试的网站的东西。 Any suggestions to speed up these processes?有什么建议可以加快这些过程吗? I am also using Azure DevOps as that is the company standard to run these automation tests.我也在使用 Azure DevOps,因为这是运行这些自动化测试的公司标准。

In Azure DevOps you can set up agents to handle this.在 Azure DevOps 中,您可以设置代理来处理此问题。 Then you can define a pipeline job and tell ADO to run it in parallel , pointing at your pool of agents.然后您可以定义一个管道作业并告诉 ADO 并行运行它,指向您的代理池。

Additionally, you will need to pay for Cypress.io's dashboard service , which will enable parallel test execution .此外,您需要为Cypress.io 的仪表板服务付费,这将启用并行测试执行

Once everything is in place, you'll need to run the tests with the --record and --parallel flags.一切就绪后,您需要使用--record--parallel标志运行测试。 Cypress.io's service will act as the orchestrator to tell each machine which tests to run, and to combine all the test results together. Cypress.io 的服务将充当协调器,告诉每台机器要运行哪些测试,并将所有测试结果组合在一起。

Without using any additional paid services (like Cypress.io's dashboard service), I think the strategy is to:在不使用任何额外的付费服务(如 Cypress.io 的仪表板服务)的情况下,我认为策略是:

  1. divide your 700 tests into several subsets, then将你的 700 个测试分成几个子集,然后
  2. run these subsets on multiple agents in parallel.在多个代理上并行运行这些子集。

To accomplish #1, you could either use several Cypress configuration files and hardcode a specific subset of tests using the testFiles property, or you could create a script that selects dynamically determines the tests (based on some parameter) and then uses the Cypress module API to actually run your tests.要完成 #1,您可以使用多个赛普拉斯配置文件并使用testFiles属性对特定的测试子集进行硬编码,或者您可以创建一个脚本来动态选择确定测试(基于某些参数),然后使用赛普拉斯模块 API实际运行您的测试。

Regardless of which approach you take with #1, you'll have to use ADO multi-configurations (see SO post here , which gives a guide on how to set up and use them) in order to accomplish #2.无论您对 #1 采用哪种方法,您都必须使用 ADO 多配置(请参阅此处的 SO 帖子,其中提供了有关如何设置和使用它们的指南)才能完成 #2。 Essentially, ADO multi-configurations allow you to define the same set of tasks that can be run on multiple agents, while passing a Multiplier argument to each of those agents.从本质上讲,ADO 多配置允许您定义可以在多个代理上运行的同一组任务,同时将Multiplier参数传递给每个代理。 This Multiplier argument is just a comma-separated string, for example, 'testSet1,testSet2,testSet3' .这个Multiplier参数只是一个逗号分隔的字符串,例如'testSet1,testSet2,testSet3' However, each agent will receive only 1 of those values, for example, the first agent might receive 'testSet1' , the second agent might receive 'testSet2' , etc.但是,每个代理只会收到其中一个值,例如,第一个代理可能会收到'testSet1' ,第二个代理可能会收到'testSet2'等。

So now, you can imagine that each agent performs the setup of your application and then runs a subset of the Cypress tests depending on which argument it receives ( 'testSet1' , 'testSet2' , etc.).所以现在,您可以想象每个代理执行应用程序的设置,然后根据它接收的参数( 'testSet1''testSet2'等)运行赛普拉斯测试的子集。

Last, you might want to collate the test results so that you can publish them.最后,您可能想要整理测试结果以便发布它们。 I'd recommend outputting the test results into a generated, deterministic folder in a shared network drive for each of the test runs.我建议将测试结果输出到每个测试运行的共享网络驱动器中生成的确定性文件夹中。 For example, if you had 3 agents running the 700 tests, they could publish their test result XML's into the //shared-drive/cypress/results/<date> folder.例如,如果您有 3 个代理运行 700 次测试,他们可以将他们的测试结果 XML 发布到//shared-drive/cypress/results/<date>文件夹中。 Then, you would have a final, separate agent job that would collate the test results and publish them.然后,您将有一个最终的、单独的代理作业来整理测试结果并发布它们。

If you can/want to set up the infrastructure, there is sorry-cypress that you should check out.如果您可以/想要设置基础架构,那么您应该检查一下sorry-cypress It has many of the features of cypress' paid service, most importantly parallelization with load balancing.它具有 cypress 付费服务的许多特性,最重要的是具有负载平衡的并行化。

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

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