English 中文(简体)
功能/接受测试的适当结构
原标题:Proper structure of functional/acceptance tests

目前,Im公司正在建造一个项目的自动功能/接受测试套,但我没有许多经验来撰写这些类型的测试,因此,我想就适当安排这些试验取得一些投入。 具体来说,Im与Arquillian sgramene推广合作。

例如,我有3项测试,A、B和C。

http://www.un.org。 测试在申请中输入一个账户。 因此,如果测试成功,浏览器应当放在账户的主页上。

<> 试验/strong>: 修改账户密码的测试。 这就需要将密码输入账户,然后测试密码变更功能。

http://www.un.org/Depts/? 修改账户电子邮件的测试。 这将再次要求在账户中进行伐木,然后测试电子邮件变更功能。

试验 由于标识代码存在问题,显然测试B和测试C也应当失败,因为它们要求存入一个账户。

。 自动化功能/接受测试是否每重复一个完成测试所核查的任何必要过程? 在这种情况下,测试B和测试C在做任何其它事情之前必须登录账户。 如果每次测试都明确提出这样的内容:

/* ...initial test setup code here */
LoginPage.login(username, password);
assertTrue(onCorrectAccountPage);
AccountModification.changePassword(newPassword);

或者,我是否应当利用某种方式在届会中篡改可用于测试B和C的账户,以便即使测试A(实际标识测试)确实不会失败?

Since these are user-acceptance tests, my thought was that they should do exactly what the user would do and log in whenever necessary, but I m not sure if this is unnecessary duplication that should be handled differently (i.e., treated like units of functionality, similar to a standard unit test) and I wanted to get feedback from someone with more experience in this area.

提前感谢。 希望我的问题过于复杂:

最佳回答

我亲自这样做,以便每个测试案例都尽可能重复用户的行动,但缩小需要的地方。 例如,测试A:登录到正确网站,进入行政系统,发现用户,删除部分用户信息(如姓名),测试B:登录到正确网站,进入行政系统,发现用户,并试图完全通过一个子顿删除用户。

测试A和测试 B 最后一页——用户详细页。 因此,在测试A中,我可以做得很好,确切地说,用户是如何做的,但在测试B中,我直接到该用户的详细网页上,而不是通过正确的人工导航。 为什么?

Saves time, why should I re-do the navigation in test B when test A already tests that anyway?

如果所有三次测试都因你不能作成文而失败,则检测不应相互依赖,因为你不能作成点,那么,你就不能做任何其他行动。

想把它当作用户。 每次测试都有自己的用户可观功能,但它们正在测试,但如果您不能登录,用户就无法看到其中的任何功能,或者与功能有任何关系。 如果我不能作成,我就不能改变我的密码或我的电子邮件,那么,从逻辑上讲,试验应该以同样的方式失败。

问题回答

这确实是一个每个项目的问题,因为这两种方法都是有效的,但在不同情况下,应当更加优先。 在一个大的系统中,我更喜欢从开始到完成试验,而不论这种重复步骤的频率如何(例如,我对每次测试都表示过意见)。 我认为,这正是阿尔兰已经说过的话(+1!)。 我通常这样做的原因是,有时一个国家从先前的屏幕上接过,可能会造成一个错误,而那类自动测试是很大的。 然而,我确信,测试数据对于牵头步骤来说都是有效的,目的是尽可能迅速解决问题。 例如,在核对记录成功时,日志始终应当有正确的用户和密码,要么只是假定它应该处理,要么随后处理一个例外,要么在网页上寻找一个易于识别的内容,而不是一个更为复杂的要素。

With that said, you can also write tests that are testing multiple requirements in a sort of functionality flow. If the flow breaks tests should be written to identify the area in which the overall task is failing. I would only recommend this for small projects, or if testing is not a priority due to a lack of resources. For example, running a test that logs on, selects an item, puts it into a cart, goes to check out, and pays would test all this functionality and allow a team to fix the overarching process rather than just several, potentially disconnected, bugs. Again however, I think the first approach is more thorough but also takes more time (but is worth doing often :)).

我担心我的答案会太长,我在这里胜过,但在这方面还有许多话要谈,我建议将你现在和将来在申请中试图测试的内容推倒。 这可能非常暴露,鼓励良好的测试结构和自动化写作做法。 希望这一帮助,时间太长:

In a user acceptance test you don t want to mock, but be as as close as possible to the way an end-user would use the system.

However, the unit test mantra one assert per test can be extended to acceptance testing: In TestA your verification logic is about asserting proper login: In TestB you don t need to repeat this verification, asserting just that password modification was handled correctly.

在Junnit,人们可以使用assumeTrue,而不是assertTrue 。 因此,您的测试会变成:

/* ...initial test setup code here */
LoginPage.login(username, password);
assumeTrue(onCorrectAccountPage);
AccountModification.changePassword(newPassword);

现在,如果假设失败,那么这一检验根本就被忽视了。 但是,你的测试会仍然失败,告诉你和你的最终用户真正的问题。





相关问题
Javascript communication with Selenium (RC)

My Application has a lot of calculation being done in JavaScript according to how and when the user acts on the application. The project prints out valuable information (through console calls) as to ...

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 ...

Using a Java library with Scala reserved words

I m using an external library written in Java (Selenium). One of the function calls has the signature type(String, String), and I keep getting compiler errors when trying to call it from Scala, that ...

Heightened privilege selenium browsers on Windows 7 (x64)

I make use of *firefox and *iexplore etc. within my selenium tests to get around the issue of self-signed SSL certificates on my local machine. Unfortunately, now that I ve moved from XP over to 7, ...

Selenium not working with Firefox 3.x on linux

I am using selenium-server , selenium rc for UI testing in my application . My dev box is Windows with FireFox 3.5 and every thing is running fine and cool. But when i try to run selenium tests on my ...

Selenium IDE: Incrementing values by 1 and 71

Currently I m incrementing a value called wert by 1 with the following code: getEval storedVars[ wert ]=${wert}+1; The value wert is something like 80401299. I want to add 1 to the value, if it ...