如何使用Dalek自动进行Ember测试(特定Ember组件的设置/拆卸) [英] How do I do Automating Ember testing with Dalek (setup/teardown of specific Ember components)

查看:131
本文介绍了如何使用Dalek自动进行Ember测试(特定Ember组件的设置/拆卸)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的TLDR;我的问题的版本是是否可以与qunit集成,以便Dalek可以在需要时获取正确的上下文,或者相反,我可以让Dalek运行安装/拆卸资产管道编译的Ember javascript来构建一个对其进行测试的上下文?"

My TLDR; version of my question is "Is there a way I can integrate with qunit such that Dalek can get the correct context when it needs it, or conversely, can I get Dalek to run setup/teardown asset-pipeline-compiled Ember javascript to build a context for it to run tests on?"

达卢克(Dalek)的新面孔太棒了!我所有的测试目前都用qunit编写.我在围绕在Ember中构建的组件进行自动化测试时遇到一些问题.该组件是一种所见即所得的textarea.

Firstup Dalek look awesome! All my tests are currently written in qunit. I'm having some problems automating tests around a component I'm building in Ember. The component is a kind of WYSIWYG textarea.

(顺便说一句,我的qunit测试是从Rails应用程序中的某个路由驱动的.)

(BTW, my qunit tests are being driven from a route within a rails application.)

要自动执行测试,我的qunit脚本有一个setup和tearDown,它们每次都创建一个原始的textarea.每次测试都会在文本区域中创建一些内容,然后以某种方式对其进行交互来确定其内容.

To automate testing, my qunit scripts have a setup and tearDown that create a pristine textarea each time. Each test creates some content in the textarea, then interacts with it somehow doing some assertions on it.

这一切都很好,除了我需要比qunit所能提供的更好的浏览器模拟(而且我对于编写与范围相关的浏览器响应的模拟代码实在没有耐心).

That's all well and good, except that I require much better browser simulation than qunit can provide me with (and I'm really running out of patience for writing my own range-related browser-response simulation code).

我最需要做的事情是: 1.使用箭头键四处移动插入符号,然后键入字符. 2.单击文本区域中的特定点(不是x,y坐标,而是文本中的特定点).

The things I need to do mostly are: 1. Move the caret around using arrow keys, and type characters. 2. Click at specific points in the textarea (not x,y co-ords, but rather a specific points in the text).

令我震惊的是Dalek可以完全为您提供帮助,但是我在执行此工作流程的方式中,我认为我要么需要Dalek通过我的qunit测试进行远程控制,要么以某种方式在Dalek中重写我的测试,但是要做到这一点,我需要让Dalek使用jQuery和Ember来为设置/拆卸创建组件和数据上下文,我什至不确定Dalek是否支持.

It struck me that Dalek could totally help with this, but the way I'm doing this workflow, I think I'd either need Dalek to be remote controllable via my qunit tests, or else somehow rewrite my tests in Dalek, but to do that, I'd need to be able to get Dalek to use jQuery and Ember to create the component and data context for the setup/teardown, which I'm not even sure Dalek supports.

我真正需要的是零件集成,零件单元测试,并且在能够处理这组条件的JS/Rails/Ember测试空间中似乎没有一个很好的答案.

What I really need is part-integration, part-unit testing, and there doesn't seem to be a great answer in the JS/Rails/Ember testing space that will handle this set of conditions.

推荐答案

我担心DalekJS并不是您现在需要的工具,即使它是我的小工具",我还是建议您使用Karma(以前称为Testacular)-最初是为了测试AngularJS应用程序而开发的: http://karma-runner.github.io/0.12/index.html

I fear DalekJS is not the tool you need right now, even if it is "my little tool" I suggest to use Karma (former called Testacular) - which was originally developed to test AngularJS applications: http://karma-runner.github.io/0.12/index.html

您可以将其与量角器 https://github.com/angular/protractor 一起使用 它取决于硒,但相对于其他工具而言,安装起来相当容易.

You could use it together with Protractor https://github.com/angular/protractor It depends on selenium, but is fairly easy (compared to some other tools) to set up.

还有一本有关如何与Ember结合使用的手册: http ://karma-runner.github.io/0.10/plus/emberjs.html

There is also a manual on how to use it in combination with Ember: http://karma-runner.github.io/0.10/plus/emberjs.html

这篇关于如何使用Dalek自动进行Ember测试(特定Ember组件的设置/拆卸)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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