Hi ketan , I want to tell you exactly where I am stuck in
My problems are
1)      I have got a jar file of SWT Application to test. Is that
possible        to test SWT application like this ?

2)      I created a project, which have two packages one is having SWT
code and other package is having my SWTBotDemo.java . I have imported
the SWT class and wrote the code in this class to test, text for Button,
for shell, and for Labels as well as code for activate and click
something like this:

public class SWTBotButtonTest extends SWTBotTestCase
{
        private static SWTBot   bot;
        private final Class     mainClass;

        public SWTBotButtonTest(Class mainclass)
        {
                this.mainClass=mainclass;
        }

        public static void main(String args[])throws Exception
        {
                new SWTBotButtonTest(MainClass.class).start(args);
                
        }
        private void start(final String[] args) throws Exception {
                mainClass.getMethod("main", new Class[] { String[].class
}).invoke(null, new Object[] { args });
                testDoSomethingInterestingWithSWT();
        }


public static void testDoSomethingInterestingWithSWT() throws Exception
                {
                        Example e1=new Example();
                        bot.shell("SWT Example").activate();
        
                        //bot.shell("SWT Example").activate();
                        bot.button("Add").click();
                
                        // there are a lot of assertions that are very
useful
                        assertEnabled(bot.button("Add"));
                        assertTextContains("firstNumLabel12!",
bot.textWithLabel("firstNumLabel"));
                        assertTextContains("IsecondNumLabel!",
bot.textWithLabel("secondNumLabel"));

                }
MainClass's main() have SWT code.

Now the thing which I am stuck in here is, How the method
testDoSomethingInterestingWithSWT() in SWTBotDemo.java will test my SWT
application.

The following line of code is what I tried for Button's click.
I hope you got my problem. If I can solve this issue I will have a clear
picture of How actually SWTBot Class helps in testing an SWT
application?



On 21-Jul-08, at 2:01 PM, Shalini Gupta wrote:
> if yes, please help me what should I do next because now this code is
> throwing NullPointerException because I am trying to get text of 
> Button
> by using its Class Name 
> bot.button(Example.addButton.getText()).click();


Example.addButton.getText() ?

Is the button a static instance sitting inside the Example class ? Why 
would you do that ?

I'd just ask that you try out the SWTBotDemo class that I'd pointed 
out earlier, and play around it for a while.

-- Ketan


------------------------------------------------------------------------
-
This SF.Net email is sponsored by the Moblin Your Move Developer's
challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the
world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
SWTBot-users mailing list
SWTBot-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swtbot-users
http://swtbot.org/ - a functional testing tool for SWT/Eclipse


This email message and its attachments may contain CONFIDENTIAL AND PRIVILEGED 
INFORMATION intended for the sole use of the addressee(s). If you have received 
it in error, please contact the sender by return email, notify your system 
manager and destroy the original message and any copies thereof. Any review, 
use, disclosure or distribution is unlawful. Please check this email and any 
attachments for the presence of viruses. The Company accepts no  liability for 
any damage caused by any virus transmitted by this email. The views or opinions 
presented in this e-mail are solely those of the author and do not necessarily 
represent those of the company.
The Company reserves the right to monitor, review and store the content of all 
messages sent to or from this e-mail address.

www.aztecsoft.com

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
SWTBot-users mailing list
SWTBot-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/swtbot-users
http://swtbot.org/ - a functional testing tool for SWT/Eclipse

Reply via email to