Thread: [SWTBot-users] Performance optimization for SWTBot
Brought to you by:
kpadegaonkar
|
From: Ketan P. <ket...@gm...> - 2008-10-25 18:36:01
|
Hi, I'm working on improving the performance of SWTBot, and am looking for ideas or areas where SWTBot could be made faster. Not that it is very slow, but hey turning a few knobs to get a little extra does not hurt! If you have something that'll help optimize the performance for the better, then I'm all ears. It may even be a single statement that you think will slow down SWTBot, or things that make you say: "why is this thing so very complicated?" I have a few ideas like removing unnecessary log statements etc. My mind is clearly out of ideas, since I know most of the code base inside out. So a fresh pair of eyes would help. -- Ketan |
|
From: Ketan P. <ket...@gm...> - 2008-10-26 14:18:36
|
Hi, I've uploaded the latest 2.0 with some performance optimizations, there were a few tests that locked up and froze the UI but that has been fixed. I'm not sure if this was the only freezing issue. If anyone is using 2.0, I'd like to hear of any issues with the latest available at http://swtbot.sourceforge.net/artifacts/2.0-dev/ . -- Ketan On 26-Oct-08, at 12:05 AM, Ketan Padegaonkar wrote: > Hi, > > I'm working on improving the performance of SWTBot, and am looking > for ideas or areas where SWTBot could be made faster. Not that it is > very slow, but hey turning a few knobs to get a little extra does > not hurt! > > If you have something that'll help optimize the performance for the > better, then I'm all ears. It may even be a single statement that > you think will slow down SWTBot, or things that make you say: "why > is this thing so very complicated?" > > I have a few ideas like removing unnecessary log statements etc. My > mind is clearly out of ideas, since I know most of the code base > inside out. So a fresh pair of eyes would help. > > -- Ketan > |
|
From: Hans S. <han...@ya...> - 2008-10-27 12:23:50
|
For performing tests (manual or automated) one needs test data. How can creation of test data be automated?
I think it is possible to automate this by analysing the model with its validation rules. This would save a lot of time.
A little example: A business object Article which contains an attribute "name" and the rule that the name must not be longer than 40 characters. The automation could then create a Article with a name containing 39 characters, one which contains an empty String and one where name is NULL.
Does someone know any tool for this, ideally free and open source?
|
|
From: Somesh S. <som...@gm...> - 2008-10-27 15:28:17
|
You could use the concept of theories in junit 4 to crate multiple datasets for 1 test. But you would still need to create the dataset. Jmock is another way of creating mock objects that you can pass around. HTH. Sent from my iPhone On Oct 27, 2008, at 3:36 AM, Hans Schwaebli <han...@ya...> wrote: > For performing tests (manual or automated) one needs test data. How > can creation of test data be automated? > > I think it is possible to automate this by analysing the model with > its validation rules. This would save a lot of time. > > A little example: A business object Article which contains an > attribute "name" and the rule that the name must not be longer than > 40 characters. The automation could then create a Article with a > name containing 39 characters, one which contains an empty String > and one where name is NULL. > > Does someone know any tool for this, ideally free and open source? > > --- > ---------------------------------------------------------------------- > 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 > SWT...@li... > https://lists.sourceforge.net/lists/listinfo/swtbot-users > http://swtbot.org/ - a functional testing tool for SWT/Eclipse > |
|
From: Hans S. <han...@ya...> - 2008-10-27 15:38:43
|
I meant it to persist the data for integration tests. It is not meant for module or unit tests.
--- On Mon, 10/27/08, Somesh Sasalatti <som...@gm...> wrote:
From: Somesh Sasalatti <som...@gm...>
Subject: Re: [SWTBot-users] Automate creating test data
To: "SWTBot" <swt...@li...>
Cc: "SWTBot" <swt...@li...>
Date: Monday, October 27, 2008, 11:27 AM
You could use the concept of theories in junit 4 to crate multiple datasets for 1 test. But you would still need to create the dataset.
Jmock is another way of creating mock objects that you can pass around.
HTH.
Sent from my iPhone
On Oct 27, 2008, at 3:36 AM, Hans Schwaebli <han...@ya...> wrote:
For performing tests (manual or automated) one needs test data. How can creation of test data be automated?
I think it is possible to automate this by analysing the model with its validation rules. This would save a lot of time.
A little example: A business object Article which contains an attribute "name" and the rule that the name must not be longer than 40 characters. The automation could then create a Article with a name containing 39 characters, one which contains an empty String and one where name is NULL.
Does someone know any tool for this, ideally free and open source?
-------------------------------------------------------------------------
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
SWT...@li...
https://lists.sourceforge.net/lists/listinfo/swtbot-users
http://swtbot.org/ - a functional testing tool for SWT/Eclipse
-------------------------------------------------------------------------
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
SWT...@li...
https://lists.sourceforge.net/lists/listinfo/swtbot-users
http://swtbot.org/ - a functional testing tool for SWT/Eclipse
|
|
From: Somesh S. <som...@gm...> - 2008-10-27 16:01:30
|
Ah ok. I've heard of FIT.never explored it though. That might help. On Oct 27, 2008, at 8:38 AM, Hans Schwaebli <han...@ya...> wrote: > I meant it to persist the data for integration tests. It is not > meant for module or unit tests. > > > > --- On Mon, 10/27/08, Somesh Sasalatti <som...@gm...> > wrote: > From: Somesh Sasalatti <som...@gm...> > Subject: Re: [SWTBot-users] Automate creating test data > To: "SWTBot" <swt...@li...> > Cc: "SWTBot" <swt...@li...> > Date: Monday, October 27, 2008, 11:27 AM > > You could use the concept of theories in junit 4 to crate multiple > datasets for 1 test. But you would still need to create the dataset. > > Jmock is another way of creating mock objects that you can pass > around. > > HTH. > > Sent from my iPhone > > On Oct 27, 2008, at 3:36 AM, Hans Schwaebli > <han...@ya...> wrote: > >> For performing tests (manual or automated) one needs test data. How >> can creation of test data be automated? >> >> I think it is possible to automate this by analysing the model with >> its validation rules. This would save a lot of time. >> >> A little example: A business object Article which contains an >> attribute "name" and the rule that the name must not be longer than >> 40 characters. The automation could then create a Article with a >> name containing 39 characters, one which contains an empty String >> and one where name is NULL. >> >> Does someone know any tool for this, ideally free and open source? >> >> --- >> --- >> ------------------------------------------------------------------- >> 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 >> SWT...@li... >> https://lists.sourceforge.net/lists/listinfo/swtbot-users >> http://swtbot.org/ - a functional testing tool for SWT/Eclipse >> > > --- > ---------------------------------------------------------------------- > 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 > SWT...@li... > https://lists.sourceforge.net/lists/listinfo/swtbot-users > http://swtbot.org/ - a functional testing tool for > SWT/Eclipse > > > --- > ---------------------------------------------------------------------- > 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 > SWT...@li... > https://lists.sourceforge.net/lists/listinfo/swtbot-users > http://swtbot.org/ - a functional testing tool for SWT/Eclipse > |
|
From: Hans S. <han...@ya...> - 2008-11-07 13:19:39
|
I have a suggestion for improving performance. I have seen that finding widgets by label collects all widgets it can find and then it returns the widget by index. Often the index is 0. So SWTBot could stop searching as soon as it finds the first widget matching the criteria. Or if its the second widget which needs to be found by label, it could stop searching as soon as it finds the second. --- On Sun, 10/26/08, Ketan Padegaonkar <ket...@gm...> wrote: From: Ketan Padegaonkar <ket...@gm...> Subject: Re: [SWTBot-users] Performance optimization for SWTBot To: swt...@li... Date: Sunday, October 26, 2008, 10:15 AM Hi, I've uploaded the latest 2.0 with some performance optimizations, there were a few tests that locked up and froze the UI but that has been fixed. I'm not sure if this was the only freezing issue. If anyone is using 2.0, I'd like to hear of any issues with the latest available at http://swtbot.sourceforge.net/artifacts/2.0-dev/ . -- Ketan On 26-Oct-08, at 12:05 AM, Ketan Padegaonkar wrote: > Hi, > > I'm working on improving the performance of SWTBot, and am looking > for ideas or areas where SWTBot could be made faster. Not that it is > very slow, but hey turning a few knobs to get a little extra does > not hurt! > > If you have something that'll help optimize the performance for the > better, then I'm all ears. It may even be a single statement that > you think will slow down SWTBot, or things that make you say: "why > is this thing so very complicated?" > > I have a few ideas like removing unnecessary log statements etc. My > mind is clearly out of ideas, since I know most of the code base > inside out. So a fresh pair of eyes would help. > > -- 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 SWT...@li... https://lists.sourceforge.net/lists/listinfo/swtbot-users http://swtbot.org/ - a functional testing tool for SWT/Eclipse |
|
From: Ketan P. <ket...@gm...> - 2008-11-07 18:44:21
|
Hans Schwaebli wrote: > I have a suggestion for improving performance. > > I have seen that finding widgets by label collects all widgets it can > find and then it returns the widget by index. Often the index is 0. So > SWTBot could stop searching as soon as it finds the first widget > matching the criteria. Or if its the second widget which needs to be > found by label, it could stop searching as soon as it finds the second. Yes, that is quite correct. In fact SWTBot does that for all matchers, it always finds all the widgets that matched a particular widget and the selection based on the index is done at the end. This was done earlier to keep the API clean and simple, I'm however convinced that this is a good place to optimize, and can infact be scaled up to any number of finds. So we could stop looking after say 2 matches, if the user requested the 2nd widget. -- Ketan |
|
From: Hans S. <han...@ya...> - 2008-11-10 09:19:05
|
Yes, that would be good. Performance is one advantage. The other advantage is logging output. It was confusing for me to see that SWTBot searched after it already found a matching widget. Thats how I knew that it continues searching. Now a bit of something else, which has nothing to do with this topic. A bit of design philosophy. I am not yet familiar with all the patterns used in SWTBot. The logic jumps across different methods and classes in different hierarchies. Thats good usage of design patterns but sometimes harder to understand than a method (or a few of them, mostly in the same class) where all the logic is implemented. In a former project some co-workers were in my mind too fascinated of design patterns and for example used a state pattern where a simple if-else-if-else-if-else would have been sufficient and more easy to understand, document (UML and Javadoc), debug etc. Well its not yet too difficult to understand what happens inside SWTBot. But I just mean this as a kind of personal opinion that sometimes design patterns can be overused (which is not yet the case here I think). --- On Fri, 11/7/08, Ketan Padegaonkar <ket...@gm...> wrote: From: Ketan Padegaonkar <ket...@gm...> Subject: Re: [SWTBot-users] Performance optimization for SWTBot To: swt...@li... Date: Friday, November 7, 2008, 1:43 PM Hans Schwaebli wrote: > I have a suggestion for improving performance. > > I have seen that finding widgets by label collects all widgets it can > find and then it returns the widget by index. Often the index is 0. So > SWTBot could stop searching as soon as it finds the first widget > matching the criteria. Or if its the second widget which needs to be > found by label, it could stop searching as soon as it finds the second. Yes, that is quite correct. In fact SWTBot does that for all matchers, it always finds all the widgets that matched a particular widget and the selection based on the index is done at the end. This was done earlier to keep the API clean and simple, I'm however convinced that this is a good place to optimize, and can infact be scaled up to any number of finds. So we could stop looking after say 2 matches, if the user requested the 2nd widget. -- 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 SWT...@li... https://lists.sourceforge.net/lists/listinfo/swtbot-users http://swtbot.org/ - a functional testing tool for SWT/Eclipse |
|
From: Hans S. <han...@ya...> - 2008-11-11 10:35:58
|
I may have to add SWTBot support for two Nebula widgets soon: DateChooserCombo and FormattedText.
Currently I am estimating the effort.
I think two new classes would need to be added: SWTBotDateChooserCombo and SWTBotFormattedText.
Do you want to add methods in SWTBot class for them? Or a bot class just for Nebula widgets ("SWTNebulaBot")? Do you want a new plugin and test plugin for Nebula? What are your plans and ideas?
Of course we also need test cases for them. Nebula provides an example plugin, which can be used for these tests. Is it okay to use it?
I need to know this in order to write a patch the way you agree with.
|
|
From: Ketan P. <ket...@gm...> - 2008-11-11 12:21:41
|
Great to know that someone is starting off with nebula.
Hans Schwaebli wrote:
> I may have to add SWTBot support for two Nebula widgets soon:
> DateChooserCombo and FormattedText.
>
> Currently I am estimating the effort.
>
> I think two new classes would need to be added: SWTBotDateChooserCombo
> and SWTBotFormattedText.
That is correct.
> Do you want to add methods in SWTBot class for them? Or a bot class just
> for Nebula widgets ("SWTNebulaBot")? Do you want a new plugin and test
> plugin for Nebula? What are your plans and ideas?
SWTBot 2.0 takes a different approach to this problem. It generates, yes
generates the SWTBot class based on annotations provided on the
individual widgets.
See the annotations on SWTBotButton and SWTBotCheckBox for examples on
how these are used.
SWTBotGeneratorMain generates the SWTBot class based on the types
provided in a widgets.xml file.
> Of course we also need test cases for them. Nebula provides an example
> plugin, which can be used for these tests. Is it okay to use it?
For the sake of nebula, I'd suggest a separate net.sf.swtbot.nebula and
a corresponding .test plugin. This would help avoid a nebula dependency
on the net.sf.swtbot.finder project, and keep the footprint small.
In case you need to write a matcher for a nebula widget, you'll need to
generate a WidgetMatcherFactory using MatcherGeneratorMain.
-- Ketan
|
|
From: Hans S. <han...@ya...> - 2008-11-11 14:17:31
|
Hi Ketan,
here is one idea which I think about for a while.
It is not so easy to modify SWTBot's behavior by not changing SWTBot code itself.
Sometimes I might need a different behavior, like a different matching strategy. Or I'd like to use a own implementation of SWTBotTreeItem (or extending the original and just overwriting one method).
The solution would be to use dependency injection and inversion of control. I haven't worked awful lot with this concept, but it adds a lot of flexibility without code change of 3rd party components.
This would mean that for example SWTBotTable would be an interface and there would be a SWTBotTableImpl concrete class. People could change the class used by SWTBot by setting it with bot.setTableImpl(new MySWTBotTableImpl()) for instance.
It would also provide a good workaround until a bug has been solved in SWTBot or so.
|
|
From: Ketan P. <ket...@gm...> - 2008-11-11 16:56:47
|
Hi Hans,
Providing an implementation of widgets using the way you recommend seems
to be an overkill and potential problems for the following reasons:
1. If there is a new api in the interface, then your implementation of
the interface will break. Which happens very often.
2. Creates unnecessary complications in the code where classes are
instantiated via reflection, and the actual widget is constructor
injected into your implementation.
The other alternative which we're doing is to override SWTBotTestCase
and provide another implementation of the "bot" instance:
public abstract class MySWTBotTestCase extends SWTBotTestCase {
protected MySWTBot bot = new MySWTBot();
}
Your test cases could extend from MySWTBotTestCase instead.
Also if you need to provide an alternative implementation for say table,
you'd override the table api to return MySWTBotTable instead of SWTBotTable
MySWTBotTable could extend from SWTBotTable, to override API that is
broken, or you wish to provide an alternative implementation.
It's a bit of a workaround, but is not very difficult to implement once
you have the basic infrastructure in place.
Alternatively you could provide a patch for another implementation of
SWTBot, that's completely API compatible with the existing one, and
users could use either implementations.
-- Ketan
Hans Schwaebli wrote:
> Hi Ketan,
>
> here is one idea which I think about for a while.
>
> It is not so easy to modify SWTBot's behavior by not changing SWTBot
> code itself.
>
> Sometimes I might need a different behavior, like a different matching
> strategy. Or I'd like to use a own implementation of SWTBotTreeItem (or
> extending the original and just overwriting one method).
>
> The solution would be to use dependency injection and inversion of
> control. I haven't worked awful lot with this concept, but it adds a lot
> of flexibility without code change of 3rd party components.
>
> This would mean that for example SWTBotTable would be an interface and
> there would be a SWTBotTableImpl concrete class. People could change the
> class used by SWTBot by setting it with bot.setTableImpl(new
> MySWTBotTableImpl()) for instance.
>
> It would also provide a good workaround until a bug has been solved in
> SWTBot or so.
>
|
|
From: Jain, A. <ank...@ca...> - 2008-11-12 06:41:37
|
Hi Ketan,
You said it right way to extend SWTBot functionality, Even I am also
doing the same. But I have concern with the existing API.
Let's take an example of SWTBotTable. Here the method getTableItem() is
private. So Again one has to write the same method in Extending
class(e.g MySWTBotTable extends SWTBotTable). I think these method
should be made protected so that code reusability remains.
Almost all classes in SWTBot I have extended, and I am copying many
private methods to the extended class, which is not good.
Ankit
-----Original Message-----
From: Ketan Padegaonkar [mailto:ket...@gm...]
Sent: Tuesday, November 11, 2008 10:26 PM
To: swt...@li...
Subject: Re: [SWTBot-users] Dependency Injection and Inversion of
Control
Hi Hans,
Providing an implementation of widgets using the way you recommend seems
to be an overkill and potential problems for the following reasons:
1. If there is a new api in the interface, then your implementation of
the interface will break. Which happens very often.
2. Creates unnecessary complications in the code where classes are
instantiated via reflection, and the actual widget is constructor
injected into your implementation.
The other alternative which we're doing is to override SWTBotTestCase
and provide another implementation of the "bot" instance:
public abstract class MySWTBotTestCase extends SWTBotTestCase {
protected MySWTBot bot = new MySWTBot();
}
Your test cases could extend from MySWTBotTestCase instead.
Also if you need to provide an alternative implementation for say table,
you'd override the table api to return MySWTBotTable instead of
SWTBotTable
MySWTBotTable could extend from SWTBotTable, to override API that is
broken, or you wish to provide an alternative implementation.
It's a bit of a workaround, but is not very difficult to implement once
you have the basic infrastructure in place.
Alternatively you could provide a patch for another implementation of
SWTBot, that's completely API compatible with the existing one, and
users could use either implementations.
-- Ketan
Hans Schwaebli wrote:
> Hi Ketan,
>
> here is one idea which I think about for a while.
>
> It is not so easy to modify SWTBot's behavior by not changing SWTBot
> code itself.
>
> Sometimes I might need a different behavior, like a different matching
> strategy. Or I'd like to use a own implementation of SWTBotTreeItem
(or
> extending the original and just overwriting one method).
>
> The solution would be to use dependency injection and inversion of
> control. I haven't worked awful lot with this concept, but it adds a
lot
> of flexibility without code change of 3rd party components.
>
> This would mean that for example SWTBotTable would be an interface and
> there would be a SWTBotTableImpl concrete class. People could change
the
> class used by SWTBot by setting it with bot.setTableImpl(new
> MySWTBotTableImpl()) for instance.
>
> It would also provide a good workaround until a bug has been solved in
> SWTBot or so.
>
------------------------------------------------------------------------
-
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
SWT...@li...
https://lists.sourceforge.net/lists/listinfo/swtbot-users
http://swtbot.org/ - a functional testing tool for SWT/Eclipse
|
|
From: Ketan P. <ket...@gm...> - 2008-11-12 07:03:22
|
Jain, Ankit wrote: > Hi Ketan, > > You said it right way to extend SWTBot functionality, Even I am also > doing the same. But I have concern with the existing API. > Let's take an example of SWTBotTable. Here the method getTableItem() is > private. So Again one has to write the same method in Extending > class(e.g MySWTBotTable extends SWTBotTable). I think these method > should be made protected so that code reusability remains. Making methods protected would mean additional API that needs to be maintained. Also the getTableItem() is actually public api. What version of SWTBot are you using ? > Almost all classes in SWTBot I have extended, and I am copying many > private methods to the extended class, which is not good. Doing this may not work in the long run, esp as SWTBot api evolves. I'd recommend asking on the mailing list, and perhaps filing a bug. -- Ketan |
|
From: S. W. <wi...@gm...> - 2008-12-05 12:45:37
|
Hi, I'm trying to write some new test cases with swtbot 2.0. We now have a Nebula CDateTime Widget, that's opened by a Combo Button. How can I write a Matcher to get access to this widget? It wasn't necessary to do something like that for our tests, until now... so I don't know where to start! Thanks, Winseth -- View this message in context: http://www.nabble.com/Performance-optimization-for-SWTBot-tp20166739p20853094.html Sent from the SWTBot Users List mailing list archive at Nabble.com. |
|
From: Ketan P. <ket...@gm...> - 2008-12-05 14:18:28
|
You could write a matcher as follows: ofType(CDateTime.class, any_other_matchers...) The resolvers helps to drill down the UI to find all possible widgets. Since the CDateTime is a composite, you'll need to ensure that the CompositeResolver does not drill through the widget and find controls within CDateTime. You may also need to hack into the CompositeResolver to resolve Composites and not instances of Composites, and the matcher above should find you the widget. Reg sending notifications to event handlers, it's a matter of writing a SWTBotCDateTime class to send notifications to the control _within_ -- Ketan On 5/12/08 18:15, S. Winseth wrote: > Hi, > I'm trying to write some new test cases with swtbot 2.0. > > We now have a Nebula CDateTime Widget, that's opened by a Combo Button. > > How can I write a Matcher to get access to this widget? It wasn't necessary > to do something like that for our tests, until now... so I don't know where > to start! > > Thanks, > Winseth |