简体   繁体   English

CruiseControl.NET中C#自动Web测试的“测试艺术”

[英]“Art of Test” for C# Automated Web Testing in CruiseControl.NET

We currently use SWEA ( http://webiussoft.com ) to run automated tests of the site during our CruiseControl.NET overnight builds. 我们目前使用SWEA( http://webiussoft.com )在我们的CruiseControl.NET过夜构建期间运行网站的自动化测试。

We are looking for a more robust solution and we are looking at the "Art of Test" ( http://www.artoftest.com ) solution. 我们正在寻找更强大的解决方案,我们正在寻找“测试艺术”( http://www.artoftest.com )解决方案。

Has anyone experience with this tool? 有没有人使用过这个工具?

Most importantly, how easy is it to maintain tests using this tool? 最重要的是,使用此工具维护测试有多容易?

Or are there any other C#/NUnit/CruiseContol.NET solutions that you would recommend? 或者你会推荐其他C#/ NUnit / CruiseContol.NET解决方案吗?

I work for ArtOfTest. 我为ArtOfTest工作。 Over the past couple of days I've been researching what it takes to get our framework to play nicely with CruiseControl.NET. 在过去的几天里,我一直在研究如何让我们的框架与CruiseControl.NET很好地协作。 The main key is to run the CruiseControl.NET server in console mode (instead of as a Windows service). 主要关键是以控制台模式运行CruiseControl.NET服务器(而不是Windows服务)。 The reason for this is to allow the unit test run phase to be able to interact directly with the desktop, which is required for UI testing. 这样做的原因是允许单元测试运行阶段能够直接与桌面交互,这是UI测试所必需的。 Generally code that runs under a Windows service is not allowed to interact with the desktop (which ours requires) and thus will fail when it tries. 通常,在Windows服务下运行的代码不允许与桌面(我们需要)进行交互,因此在尝试时会失败。

TeamCity is also another good CI server. TeamCity也是另一个优秀的CI服务器。 I'm looking at that right now and have gotten it mostly figured out. 我现在正在看着它,并且已经弄明白了。

If you have any other more specific questions feel free to contact us at contact@artoftest.com. 如果您有任何其他更具体的问题,请随时通过contact@artoftest.com与我们联系。 I'll also monitor this thread as well. 我也会监视这个帖子。

WatiN is not bad. WatiN也不错。 Unfortunately it lacks any sort of VisualStudio integration and is missing many other features that we offer. 不幸的是,它缺乏任何类型的VisualStudio集成,并且缺少我们提供的许多其他功能。

Thx, Cody 谢谢,科迪

The below link is documentation on how to get WebAii working with all the popular CI servers (CC, TeamCity and TFS Build) 以下链接是有关如何使WebAii与所有流行的CI服务器(CC,TeamCity和TFS Build)配合使用的文档

http://www.artoftest.com/support/webaii/topicsindex.aspx?topic=cioverview http://www.artoftest.com/support/webaii/topicsindex.aspx?topic=cioverview

另一种选择可能是WatiN

Seems like the two big ones are Watin & Selenium. 看起来像两个大的是Watin&Selenium。 I haven't done any work with Selenium, so no opinion there. 我没有与Selenium做过任何工作,所以没有意见。

I've used Watin a fair amount, and it's pretty good, but there are many issues. 我已经使用了相当数量的Watin,它非常好,但是有很多问题。 It can be hard to deal with wildly varying response times from a browser... setting timeout durations and the like. 很难处理来自浏览器的大幅变化的响应时间......设置超时持续时间等。

The latest version of Watin supports IE & Firefox, which is pretty cool. 最新版本的Watin支持IE和Firefox,非常酷。

As far as test maintenance, in my experience the most important thing is to completely separate the "test driver" code from the "page-wrapping code". 就测试维护而言,根据我的经验,最重要的是将“测试驱动程序”代码与“页面包装代码”完全分开。 By "test driver" I mean the actual test logic (NUnit or similar) which might have code that looks like: “测试驱动程序”是指实际的测试逻辑(NUnit或类似),它可能具有如下代码:

... ...

var wrapper = new SearchPageWrapper(browser);
wrapper.ClickAdvancedSearch();
wrapper.EnterSearchPhrase("dog");
wrapper.SetSortBy(SortType.Date);
wrapper.ExecuteSearch();

... the page-wrapper exposes this logical interface to the page itself while hiding the implementation details (which can be complex and change often with the page layout): ...页面包装器将此逻辑接口公开给页面本身,同时隐藏实现细节(这可能很复杂并且经常随页面布局而改变):

public class SearchPageWrapper {
  ...
  public void ClickAdvancedSearch() {
    _browser.Buttons("advSearch").Click();
  }

  public void EnterSearchPhrase(string phrase) {
    _browser.TextBox(Find.ByName("phrase")).TypeText(phrase);
  }
  ... etc ...
}

This way you build a library of wrappers that makes it easy to add new test cases, and also makes it less painful to deal with layout changes that affect the way that Watin finds & interacts with the elements on the pages. 通过这种方式,您可以构建一个包装器库,以便于添加新的测试用例,并且可以减少处理影响Watin查找和与页面上元素交互的方式的布局更改的痛苦。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM