Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Can SWTBot be used for a SWT application with limited or no access to the source code?
Can SWTBot be used for a SWT application with limited or no access to the source code? [message #1094700] Mon, 26 August 2013 04:31 Go to next message
Mobile Tester is currently offline Mobile TesterFriend
Messages: 5
Registered: August 2013
Junior Member
Hello All!

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.

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?
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 Smile)

Any help is much appreciated!

Thank You!
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 Go to previous messageGo to next message
Mickael Istria is currently offline Mickael IstriaFriend
Messages: 865
Registered: July 2009
Location: Grenoble, France
Senior Member

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
Re: Can SWTBot be used for a SWT application with limited or no access to the source code? [message #1095933 is a reply to message #1094700] Tue, 27 August 2013 18:50 Go to previous message
Mobile Tester is currently offline Mobile TesterFriend
Messages: 5
Registered: August 2013
Junior Member
Thank you Mickael! Let me try that out Smile

[Updated on: Tue, 27 August 2013 18:51]

Report message to a moderator

Previous Topic:Absolute and relative positions in SWTBotGefEditor
Next Topic:How to run SWTBot tests on standalone application
Goto Forum:
  


Current Time: Tue Mar 19 07:59:14 GMT 2024

Powered by FUDForum. Page generated in 0.04256 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top