|
Re: Can SWTBot be used for a SWT application with limited or no access to the source code? [message #1095185 is a reply to message #1094700] |
Mon, 26 August 2013 19:04 |
|
On 08/26/2013 03:29 PM, Mobile Tester wrote:
> I am trying out a few test automation tools and recently came across
> SWTBot! I have installed it and I've tried using the SWTBot Generator
> based on the wonderful demo on Vimeo by Mickael Istria.
Glad you like it ;)
> However, I would like to know if given an exe of an already existing SWT
> application with limited or no access to its source code, how easy is to
> write tests using SWTBot?
You do not need source code to write tests using SWTBot. All you need to
write test is to be able to identify widgets, and it is totally
achievable just by looking at the application.
However, you'll need to be able to install your test + SWTBot into the
target application in order to run it.
It can usually be done via p2 UI (Help > Install New Software) or
command-line with p2 director.
> In other words, How do I invoke an SWT application and run tests on it?
> Simple Example: Lets assume I have an SWT based calculator which has 2
> input boxes and various buttons for Add, Subtract, etc and an output box
> to display the result. How do i go about using this application? (Btw,
> this is only a sample scenario :))
You write your test like this, without requiring source code:
public class MyTest {
SWTBot bot = new SWTBot();
@Test
public void test() {
bot.button("1").click();
bot.button("+").click();
bot.button("2").click();
bot.button("=").click();
Assert.assertEquals("3", bot.text().getText());
}
}
Then you install the bundle containing your test + SWTBot dependencies
(org.eclipse.swtbot.swt.finder bundle) into the application you wish to
test; and then you launch the SWTBot test as explained in:
http://wiki.eclipse.org/SWTBot/Automate_test_execution#Command-line
HTH
--
Mickael Istria
JBoss, by Red Hat
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
|
|
|
|
Powered by
FUDForum. Page generated in 0.04256 seconds