English 中文(简体)
如何创建适当的拆解脚本
原标题:How to create a proper teardown script

我的问题是: 我们在工作中使用 eleum IDE 和 RC 测试我们网站的功能。 我们的网站有一个列表, 每当您添加一个项目时, 都会保存在服务器上 。 它也允许用户登录 。

当我的套房在中途失败(例如,由于站点有误), 它可能会留下一些项目, 它可能会留下用户登录等。 拆卸脚本( 列出, 清除列表) 现在已经是套房的一部分, 但是当套房在中途失败时, 它们将不会执行 。 所以当下一次测试开始的时候, 它不会像应该的那样从零开始。 这当然会使套房中的一些步骤失败, 导致整个测试运行崩溃和燃烧 。

我提出的解决办法之一是,在每个测试套房之后,运行几个较小的拆卸套房,这些套房被允许倒闭。

Example: Big Main Suite Fail Log out Fail clear list Success

如果测试中途失败,把一些项目留在名单上,就会发生这种情况。

Big Main Suite Success Log out Fail clear list Fail

这是成功运行时会发生的事情。

尽管这个解决方案可能有效,但对于你的报告来说,它确实非常可怕。

所以我基本上有两个问题:

  1. What is the most elegant way of making sure that a suite starts from scratch, even though the suite before it failed?
  2. Is it possible to suppress "failure"messages of suites and cases that you don t mind failing?
问题回答

问题1. 确保套房从零开始的最优雅方式是什么? 即使前套房失败前的套房也从零开始?

我建议您使用测试 GNG 或 JUnit 框架。 这两种框架都有说明, 有助于您在测试完成时写出应该发生的事情, 不管测试结果如何 。 我仅使用测试 GNG 。 测试 GN 提供了更多的听众, 您可以在其中定义当方法通过、 跳过或失败时应该发生的事情 。

您也可以定义在引用任何方法或类之前要执行的方法(@ beforeMethod un注)。

我不知道你现在如何处理你的报告, 但测试NG有一个好的HTML报告, 显示基本的细节。

使用测试NG 就可以实现“ 强度” 问题2 < / 强度” 中所说的内容。 测试NG 允许您将测试组合起来, 并一起运行测试。 您可以添加所有您不介意将失败添加到一个组并运行的测试 。

学习曲线相对较少,会方便你的工作。您可以找到更多关于测试及其与的整合的详细信息 < a href="http://testng.org" rel="no follow">这里





相关问题
Running automated Web browser tests under Hudson

I m running Hudson for my automated builds and love it. I d now like to create automated Web browser tests using either WaTiN (preferred) or Selenium. As my Hudson runs as a Windows service (under ...

What approach should I use to test a VBScript?

I ve been asked to help out with a project which has made extensive use of VBScript to process a whole bunch of text files and generate certain outputs - sanitized files, SQL entries etc.. The script ...

Integration Testing for a Web App

I want to do full integration testing for a web application. I want to test many things like AJAX, positioning and presence of certain phrases and HTML elements using several browsers. I m seeking a ...

Best practice approach for automated testing

This is a very strange request for advice for which I truly feel there is no real answer. In my project I have archiving routines on various objects that have been consumed for logical calculations, I ...

Jython exception handling within loops

I am using Marathon 2.0b4 to automate tests for an application. A shortcoming of wait_p, one of the script elements provided by Marathon, is that its default timeout is hardcoded to be 60 seconds. I ...

Is there any error checking web app cralwers out there?

Wondering if there was some sort of crawler we could use to test and re-test everything when changes are made to the web app so we know some new change didn t error out any existing pages. Or maybe a ...

热门标签