PhantomJs在运行grunt-karma测试用例时崩溃????/ [英] PhantomJs Crashes while running with grunt-karma test cases ????/

查看:71
本文介绍了PhantomJs在运行grunt-karma测试用例时崩溃????/的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用phantomJs运行业力测试用例时,我们面临一个问题,我们的phantomJs崩溃并断开连接. 是由于内存泄漏或其他问题引起的,请告诉我是否有人有合适的解决方案. 我发现解决方法是将测试用例分解为多个繁重的任务,但是由于我们有很多超过1500个的测试用例,因此这不是一个可行的任务.

We are facing an issue while running karma test cases with phantomJs our phantomJs crashes and gets disconnected. Is that due to memory leakage or some other issue.Kindly let me know if some one has some suitable solution. I found that the workaround is to break test cases into multiple grunt task but since we have a lot of test cases more than 1500 so that would not be a feasible task.

我们正在使用以下版本
节点:-0.10.32 业力:-0.12.24 PhantomJs:-1.9.8(karma-phantomJs-Launcher)

We are using the below versions
Node:- 0.10.32 Karma:- 0.12.24 PhantomJs:- 1.9.8 (karma-phantomJs-Launcher)

请尽快让我知道解决方案.

Please let me know the solutions asap.

推荐答案

我发现这有两种可能.

  1. PhantomJS在标签关闭之前不会释放内存,因此如果测试套件太大,则可能内存不足.
  2. karma-phantomjs-launcher & karma-phantomjs2-launcher 不要将stdout/stderr输出挂钩到启动的浏览器进程,并且因此我已经看到一些实例,启动的浏览器只是挂起并断开连接,这很可能是由于其stderr输出被填满
  1. PhantomJS does not release memory until its tab is closed so if your test suite is too large, you could be running out of memory.
  2. karma-phantomjs-launcher & karma-phantomjs2-launcher do not hook the stdout/stderr output for their started browser process and so I've seen some instances that the started browser just hangs and gets disconnected, most likely due to its stderr output getting filled up

第一个问题可以通过将测试套件拆分为较小的套件来解决.或者,您可以研究是否有一种方法可以告诉PhantomJS运行其JavaScript垃圾回收,但是我没有走这条路,因此无法在此提供更多详细信息.

The first problem can be worked around by splitting your test suite into smaller ones. Or, you could research if there is perhaps a way to tell PhantomJS to run its JavaScript garbage collection, but I have not gone down that road so can't provide much more detail there.

第二个问题可以通过以下方式解决:

The second problem can be fixed by:

  1. 使用最新的 karma-phantomjs-launcher 版本,该版本将浏览器与标准输出挂钩/stderr输出(已在版本0.2.1中修复)
  2. 使用 karma-phantomjs2-launcher 的版本https://github.com/gskachkov/karma-phantomjs2-launcher/pull/5"rel =" nofollow>拉动请求#5 ,它从基础
  1. using the latest karma-phantomjs-launcher version that hooks browser the stdout/stderr output (fixed in version 0.2.1)
  2. using a version of karma-phantomjs2-launcher from its pull request #5 which brings in upstream changes from the base karma-phantomJS-launcher project and thus resolves the problem here as well.

这篇关于PhantomJs在运行grunt-karma测试用例时崩溃????/的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆