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

On 24/10/2013 11:00, Mickael Istria wrote:
> On 10/23/2013 07:29 PM, Lorenzo Bettini wrote:
>> I'm also trying to "debug" what's going wrong by inserting println
>>
>> 	@Test
>> 	public void getsAllShells() throws Exception {
>> 		for (SWTBotShell s : bot.shells())
>> 			System.out.println("shell: " + s.getText());
>> 		assertEquals(2, bot.shells().length);
>> 	}
> You can debug by setting a "-DdebugPort=8000" property and then use
> Eclipse to bind debugger on port 8000.
> 
> -- 
> Mickael Istria
> Eclipse developer at JBoss, by Red Hat <http://www.jboss.org/tools>
> My blog <http://mickaelistria.wordpress.com> - My Tweets
> <http://twitter.com/mickaelistria>

OK, I'll try that as well... in the meantime I managed to get some
feedback by using

	protected void assertNumberOfShells(int expected) {
		StringBuffer buffer = new StringBuffer();
		for (SWTBotShell s : bot.shells())
			buffer.append("shell: " + s.getText() + "; ");
		assertEquals("current shells: " + buffer.toString(),
				expected, bot.shells().length);
	}

and while in success situations there should be only two shells:

shell: Address Book - Untitled; shell: Find;

when the test fails, I get:

java.lang.AssertionError: current shells: shell: Resource - ; shell: ;
shell: Address Book - Untitled; shell: Find;  expected:<2> but was:<4>

So there seem to be two additional shells: shell: Resource - ; shell: ;

I wonder where they come from...

Note that in the test case containing the failing test, getsAllShells, I
added this setup method

	private boolean firstTest = false;
	
	@Before
	public void setUp() throws Exception {
		super.setUp();
		bot = new SWTBot();
		
		if (firstTest) {
			for (SWTBotShell s : bot.shells()) {
				closeTestShell(s.widget);
				bot.waitUntil(Conditions.shellCloses(s));
			}
			firstTest = false;
		}
	}

which should close all possible shells on the first execution (does it
sound correct?)... still that test keeps on failing during the build...

any clue/suggestion?

cheers
	Lorenzo


-- 
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book



Back to the top