← Back to team overview

sikuli-driver team mailing list archive

Re: [Question #157108]: [Java] JUnit: How create assertTrue: Image exists or not ?

 

Question #157108 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/157108

Vince requested more information:
I'm using Sikuli in Eclipse to simply double click on an icon and verify
the application launches. I've purposely set it up to verify a
completely incorrect image comes up as I want to see it fail but it
never does. It launches the application correctly but always passes the
ensureExists method no matter what image I try to match.

I created the following method to verify the failure as the following:

public boolean ensureExists(String image) {

	Match m = s.exists(image);
	System.out.println("Result of m is " + s.exists(image));

	if (s.exists(image) != null) {
		return true;
	}
	return false;
}

This is the test that pulls in that method

Screen s = new Screen();

@Test
public void testLaunchApp() throws FindFailed {
	s.doubleClick(img, 0);
	Assert.assertTrue(ensureExists(screenshot));	
}

-- 
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.