English 中文(简体)
单位测试一个模块式的 Java字网络应用
原标题:Unit testing a modular Javascript web-app

I am building a web app using BackboneJS and RequireJS and need to implement some form of unit testing for UI interaction and data retrieval via AJAX. I have come across QUnit and Jasmine but don t really know how I can integrate this into my app.

如果我正在测试诸如:

  • Is the user logged in alright?
  • Has the data been received from the server ok?
  • Does clicking a button trigger the expected response?
  • Do click events work on dynamically loaded html content?
  • Does the app respond correctly to changes in hash/push-state urls?

我想,这一试验必须直接纳入我的手头,以便接触具体的联合材料目标,与届会的具体数据合作,并应对推力状态的变化。

How can I integrate QUnit or Jasmine (or other suggestions) into my modular app to unit test such features?

问题回答

单位测试确实很简单。

页: 1 页: 1

然后,你使用需要JS,并装上你的java书写模块之一。

并且你只是测试出口物品或功能。 这意味着测试你的模块的有效投入,并坚持产出是正确的。

您可能不得不 mo笑,并写上超声望 mo。

Dojo Objective Harness (DOH) is a very good unit test framework, which is browser agnostic and supports testing asynchronous functions, see here for a walkthrough guide.

However, from your test cases it looks like you want something more like an integration test? If so Selenium is a good browser automation tool.

极为重要的是,这些工具都不要求你修改你的法典(除非你发现有点:)

如果你想看到一个需要的例子 基础材料单元是用QUnit测试的单位,下载了

申斥: 页: 1





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签