Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [swtbot-dev] problems running swtbot test suite in some configurations

I think that the issue can be caused by the order in which one tests are run (which is not guaranteed by JUnit and can depend on the JVM implementation). If SWTBotShellTest runs first, the Workbench is still open and confuses the test. I can reproduce the same issue as yours simply by running the SWTBotShellTest

On 10/24/2013 01:01 PM, Lorenzo Bettini wrote:
I think that an alternative way of writing that specific test is as follows:

	@Test
	public void getsAllShells() throws Exception {
		//assertEquals(2, bot.shells().length);
		bot.shell("Address Book - Untitled");
		bot.shell("Find");
	}

Does it sound reasonable?
I think the purpose of this test is to test the bot.shells() method, so your suggestion reduces relevance of this test. It would probably be better to have all shells closed in a setUp or setUpBeforeClass method to make sure the test is well isolated.
Still, I think that there's something wrong in the way those tests are
executed somehow...  it really looks like the problem shows up on my
fast machine because of the workbench which is fast enough to come up
and spoil things for that specific test (which is the first one that is
being executed)... 
As explained about, the difference from a machine to the other can be caused by different JVM implementations that can affect the order in which one JUnit runs the tests.

but the workbench should not be there at all when
tests are executed in this very project...
It's the default Tycho behaviour: surefire starts a host application and then runs the test. As it used to work, I didn't investigate further. Tycho allows setting ths <application> and <product> to host the tests, there might be a way to not start anything, and if there is not, it could be a valid enhancement request.

--
Mickael Istria
Eclipse developer at JBoss, by Red Hat
My blog - My Tweets

Back to the top