简体   繁体   English

Jenkins和Maven可以安全地运行多少硒测试脚本

[英]How many selenium test scripts can be safely run with Jenkins and Maven

Background 背景

I have a set of Java test scripts that are all in one package. 我有一组Java测试脚本,它们全部放在一个软件包中。 My pom file specifies Testng. 我的pom文件指定了Testng。 I store the tests on Bitbucket along with all the libraries required. 我将测试连同所需的所有库一起存储在Bitbucket上。 I have an instance of Jenkins running on my server as part of my site. 我有一个Jenkins实例在我的服务器上作为我的站点的一部分运行。 The tests run via headless Firefox. 测试通过无头Firefox运行。

Issue 问题

So it was working perfectly until a larger batch was added. 因此,在添加更大的批次之前,它运行良好。 Each .java file has between 5-12 @test declarations (Testng) in it, pretty much each @test is a method. 每个.java文件中都有5-12个@test声明(Testng),几乎每个@test都是一个方法。 It worked fine when there was about 5 .java files in the Bitbucket but now that there are 14 .java files in there it's throwing an error. 当Bitbucket中大约有5个.java文件时,它工作正常,但是现在那里有14个.java文件,则抛出错误。

Jenkins View Console output Jenkins View控制台输出

org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host

firefox output 火狐输出

(process:23458): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' 
failed Xlib:  extension "RANDR" missing on display ":79".
firefox: Fatal IO error 2 (No such file or directory) on X server :79

Deduction 扣除

So this looks like an error with the Xvnc that was set up for headless testing since its a GLib-CRITICAL problem and a connection error. 因此,这看起来像Xvnc的错误,该错误是为GLib-CRITICAL问题和连接错误而设置的,用于无头测试。 But nothing in the Jenkins build has changed from the last time bar the extra tests. 但是,Jenkins版本中的任何内容从上一次测试额外的测试条以来都没有改变。

Question

Now for the actual question, Is it save to run large batches of test with Jenkins or should they be broken into sub sets of tests to catch errors like this, in my case would that mean having lots of different Bitbuket repositories so as to run different batches? 现在是一个实际的问题,用Jenkins运行大量测试是否省钱?还是应该将它们分解成子测试集以捕获此类错误,在我的情况下,这意味着拥有许多不同的Bitbuket存储库以便运行不同的批? or can I run lots of batches from one repository? 还是可以从一个存储库运行很多批次?

If anyone has a quick fix or a suggestion on what could fix my error that would be appreciated too, I am just going to roll-back the repository to a runnable state though and add the new tests individually. 如果任何人对可以解决我的错误的方法有快速修复或建议,我也会将其回滚到可运行状态,然后单独添加新测试。

It is safer to run your tests through a "Selenium Grid" , even if that grid needs to be on the same machine as the Jenkins server. 通过“ Selenium Grid”运行测试更加安全,即使该网格需要与Jenkins服务器位于同一台计算机上。 Better than running multiple browsers directly from the Jenkins job. 比直接从Jenkins作业运行多个浏览器更好。 I think you will get much better results that way. 我认为您将以这种方式获得更好的结果。 As for the number that you can run, it depends on the power of the system, but running more than 5-10 at a time (threads) is reasonable probably. 至于可以运行的数量,取决于系统的功能,但是一次(线程)运行5-10个以上可能是合理的。 Also, it simplifies things to have 1 test method per test class but if your willing to deal with the additional work of making sure a browser stays alive through multiple test methods, then you can do it that way, but i would say its prone to error. 此外,它简化了每个测试类具有1个测试方法的过程,但是如果您愿意处理确保浏览器通过多种测试方法保持活动的其他工作,那么您可以这样做,但是我会说它很容易错误。

Since you're using TestNG, you could try excluding different test cases to try and track down the error. 由于您使用的是TestNG,因此可以尝试排除其他测试用例以尝试找出错误。 Going by the details you posted, it's hard to tell whether the error is due to a resource constraint or a bad test case. 根据您发布的详细信息,很难确定错误是由于资源限制还是不良的测试用例引起的。

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

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