使用DRT测试Web应用程序 [英] Testing Web Apps Using DRT

查看:195
本文介绍了使用DRT测试Web应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用DRT进行验收测试。

I'm trying to use DRT for running acceptance tests.

因为这是一个验收测试,我需要更改位置以打开被测页面。但是,当然,在我做完之后,我的测试脚本消失了。

Because it's an acceptance test I need to change the location to open the page under test. But of course, after I've done it my test script is gone.

我试图使用iFrames作为解决方法,但Dart没有提供任何获取iFrame的内容的方法。这意味着可以将测试中的页面加载到iframe中,但是无法获取其html。

I tried to use iFrames as a workaround, but Dart doesn't provide any means of getting the content of an iFrame. Which means that it's possible to load the page under test into an iframe, but it's impossible to get its html.

我已经检查了Dart仓库中的所有DRT测试:
http:/ /code.google.com/p/dart/source/browse/#svn%2Fbranches%2Fbleeding_edge%2Fdart%2Ftests%2Fhtml

I've checked all the DRT tests in the Dart repo: http://code.google.com/p/dart/source/browse/#svn%2Fbranches%2Fbleeding_edge%2Fdart%2Ftests%2Fhtml

但似乎没有人更改位置。

but it seems that none of them changes the location.

是否可以使用DRT进行验收测试?有没有解决方法我没有想到?

Is it possible to use DRT for running acceptance tests? Is there a workaround I didn't think of?

推荐答案

我们还没有想出一个好的技巧)加载应用程序,因为它是写入和运行测试代码在它的顶部。相反,您可以复制应用程序的入口点,并在其中包含测试代码,然后直接在DRT中运行修改的应用程序。

We haven't come up with a good trick (redirection or iframes) to load the app as it is written and runs the test code on top of it. Instead, you could copy the entrypoint of an app and include the test code there, then run the modified app directly in DRT.

这里是一个来自web-ui代码库的测试。此测试运行TodoMVC应用程序并与其进行交互:

Here is an example from the web-ui codebase of a test that does this. This test runs the TodoMVC app and interacts with it:

https://github.com/dart-lang/web-ui/blob/master/test/data/input/todomvc_listorder_test.html

我们所做的就是复制原始应用程序的html,添加testing.js脚本标签,并将dart脚本标签替换为测试代码。它可能创建一个脚本,自动化我们今天手工,但我们还没有这样做。

All we did is copy the original app's html, add the 'testing.js' script tag, and replace the dart script tag with the test code. It might be possible to create a script that automates what we do manually today, but we haven't done that.

这篇关于使用DRT测试Web应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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