如何调试在phantomjs运行的ember-cli测试 [英] How to debug ember-cli tests running in phantomjs

查看:81
本文介绍了如何调试在phantomjs运行的ember-cli测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

上下文:我对我的ember-cli应用程序进行了验收测试,Chrome中的测试传递得很好。但是,在phantomjs中,我的测试失败了 - 用户界面不会以相同的方式创建,我正在努力解决为什么。 (我认为测试因为 https://github.com/ember-cli/ember-cli而损坏/ issues / 1763 ,但是如何调试的一般问题仍然存在)

Context: I have an acceptance test for my ember-cli application, and the test passes just fine in Chrome. However, in phantomjs, my test fails -- the UI doesn't get created the same way, and I'm trying to work out why. (I think the test is broken because of https://github.com/ember-cli/ember-cli/issues/1763, but the general question of how to debug remains)

在Chrome中,我可以在我的测试中使用标准的调试工具,很好 - 但在幻影中,我无法使用调试器。我也没有看到console.log()消息显示在输出 - 我所得到的是我的终端窗口中的测试结果列表。

In Chrome, I can use the standard debugging tools on my tests and all is well -- but in phantomjs, I can't get at it with a debugger. I also don't see console.log() messages show up in the output -- all I get is a list of test results in my terminal window.

我可以通过编写如

equal(true, false, "This is a log message");

然后我收到消息作为失败的断言的详细信息,或者我可以尝试和解决DOM中的内容与

and then I get the message as details for the assertion that failed, or I can try and work out what's in the DOM with

equal(true, false, document.getElementsByClassName("my-class".innerHTML);

但这两个a:停止测试进一步,b:只让我从测试本身,而不是我的应用程序。

but both of those a:stop the test going any further, and b:only let me log information from the test itself, not my application.

有没有办法在ember测试之外运行我的测试,或者某种方式附加到正在运行的测试流程?有没有办法让console.log()消息显示在输出?

Is there a way to run my tests outside of "ember test", or some way to attach to the running test processes? Alternatively, is there a way to get console.log() messages to show up in the output?

推荐答案

您可以暴露PhantomJS调试端口并在浏览器中打开它,然后您可以在调试器断点处与上下文进行交互。

You can expose PhantomJS debug port and open it in browser then you can interact with context at your debugger breakpoints.

使用Testem测试运行器对PhantomJS进行调试测试

这篇关于如何调试在phantomjs运行的ember-cli测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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