On May 17, 2010, at 11:13 AM, Sergiu Dumitriu wrote:
On 05/17/2010 08:13 AM, Vincent Massol wrote:
On May 17, 2010, at 2:34 AM, sdumitriu (SVN) wrote:
Author: sdumitriu Date: 2010-05-17 02:34:18 +0200 (Mon, 17 May 2010) New Revision: 28901
Modified: enterprise/trunk/distribution-test/ui-tests/src/test/it/org/xwiki/it/ui/EscapeTest.java Log: [misc] Added a test.
Modified: enterprise/trunk/distribution-test/ui-tests/src/test/it/org/xwiki/it/ui/EscapeTest.java
[snip]
+ /** + * Go to a working page after each test run to prevent failures in {@link #setUp()} + */ + @After + public void tearDown() + { + TestUtils.gotoPage("Main", "WebHome", getDriver()); + }
It's a little bit better to do this in setUp rather than in tearDown, for performance (Each test is responsible to set up a working state).
It's not about setting up for the tests in this class, but leaving a working page for the next (whatever, unknown) test. It's not a common requirement, but this particular test might leave a broken page, like a missing header, thus causing the is logged in check to fail.
Yes, but it's better that the next test ensures that the environment is ok for its tests IMO. This allows to run tests in any order and even to work if a test is stopped midway.
Why do you say it's bad for performance?
It's actually good in the sense that the next test doesn't necessarily have to do a set up (but this means that the tests can only be executed in a given order). The reason I was saying it's a bit less good re perf is because you're going to do extra work (the last tearDown executed) even if the next tests doesn't care about what you did in the tear down. -Vincent