Timothy Wall | 3 Oct 2007 15:34
Gravatar

Re: abbot support for Java 2D shape.


On Oct 2, 2007, at 8:59 PM, Bill Liu wrote:

> Hi Timothy,
>
> I have a set of Java 2D shapes drawn on a JPanel and I would like  
> to test them using Abbot and Costello, can you give me some  
> suggestions on how to approach the task? I have the following  
> specific questions:
> 1. Do I have to provide my own finder, tester, recorder, matcher,  
> location classes and my shape Hierarchy? If the question is 'no' to  
> this question, then
> 2. What is the minimum classes I have to provide to start off, If I  
> want to approach the task incrementally? For example,
> 3. What do I have to do to resize and move my shapes?

Abbot's data model is based on things derived from Component and  
locations within those components.  The only interaction it has with  
the Java 2D drawing pipeline is the Robot.sample() method.

You need to ask yourself what aspects of your Java2D shapes you wish  
to test.

* are you concerned about proper movement (animation) of a shape over  
time?
* are you concerned with the proper appearance of a given shape?
* are you concerned about proper compositing of multiple shapes?
* are you concerned only that *something* is drawn?

The simplest test for having drawn something is to verify that a  
(Continue reading)

Bill Liu | 3 Oct 2007 19:49
Picon
Favicon

Re: abbot support for Java 2D shape.

Hi Timothy,

I do not need animating the shape, but I need to DnD the shape around. 
The shapes can show up in different mode, say, compact or expanded. 
Also, the proper compositing of multiple shapes is required. Please note 
the aforementioned features have been implemented, what I want is to 
automatically test them. Suppose I have a class named Java2DShape, Do I 
have to have to change the abbot.editro.ScriptEditor in order to record 
the mouse-click or other events happened upon the Java2DShape, or I can 
play with the JPanel that contains the Java2DShape to get the events 
properly recorded?

Thanks,
Bill

Timothy Wall wrote:
>
> On Oct 2, 2007, at 8:59 PM, Bill Liu wrote:
>
>> Hi Timothy,
>>
>> I have a set of Java 2D shapes drawn on a JPanel and I would like to 
>> test them using Abbot and Costello, can you give me some suggestions 
>> on how to approach the task? I have the following specific questions:
>> 1. Do I have to provide my own finder, tester, recorder, matcher, 
>> location classes and my shape Hierarchy? If the question is 'no' to 
>> this question, then
>> 2. What is the minimum classes I have to provide to start off, If I 
>> want to approach the task incrementally? For example,
>> 3. What do I have to do to resize and move my shapes?
(Continue reading)

Timothy Wall | 3 Oct 2007 20:14
Gravatar

Re: abbot support for Java 2D shape.

If you're testing whether the enclosing component properly responds  
to drag/drop of your Java2DShape, you should consider a code-based  
test that runs through the permutations you'd like to test.  For  
convenience, you'll want to write a custom XXXTester class which  
provides methods for all user actions supported by your custom  
component.  If the shapes in your component are readily identifiable,  
you might also write a custom ComponentLocation which converts a  
String or some other easy mnemonic into the pixel location of your  
shape.  I've done this for graph/map editing components, where the  
elements of substructure (vertices and nodes) have names, so I make  
classes for  VerticeLocation(String name) and NodeLocation(String  
name).   If you find it hard to strip down to just your component and  
its data model, that's probably telling you there's too much  
interdependency in your application.

Once you've got some "drag from here to there" tests, you should be  
able to insert some checks during the drag to ensure the drag image  
is showing properly.

If you want to do smoke tests or acceptance tests with Costello  
scripts, then you'll at least need to code up a XXXTester.  The  
script editor will pick up the custom tester automatically if you  
follow the instructions for writing a custom Tester class, which may  
or may not require custom ComponentLocations.

You can also customize recording by writing a custom Recorder class  
that pieces together a script fragment when events are directed at  
your custom component, but I'd only do that if you plan to do a lot  
of recording-based tests.

(Continue reading)

Przemysław Szkudlarek | 4 Oct 2007 12:02
Picon
Favicon

Test-Driven Development

Hello 

Did you create Abbot using Test-Driven Development? 

Definition from wikipedia.org: "Test-Driven Development (TDD) is a software development technique
that involves repeatedly first writing a test case and then implementing only the code necessary to pass
the test" 

Best regards,
Przemek

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
Bill Liu | 3 Oct 2007 20:22
Picon
Favicon

Re: abbot support for Java 2D shape.

Great! I will start with the Tester. I appreciate your help.

Bill

Timothy Wall wrote:
> If you're testing whether the enclosing component properly responds to 
> drag/drop of your Java2DShape, you should consider a code-based test 
> that runs through the permutations you'd like to test.  For 
> convenience, you'll want to write a custom XXXTester class which 
> provides methods for all user actions supported by your custom 
> component.  If the shapes in your component are readily identifiable, 
> you might also write a custom ComponentLocation which converts a 
> String or some other easy mnemonic into the pixel location of your 
> shape.  I've done this for graph/map editing components, where the 
> elements of substructure (vertices and nodes) have names, so I make 
> classes for  VerticeLocation(String name) and NodeLocation(String 
> name).   If you find it hard to strip down to just your component and 
> its data model, that's probably telling you there's too much 
> interdependency in your application.
>
> Once you've got some "drag from here to there" tests, you should be 
> able to insert some checks during the drag to ensure the drag image is 
> showing properly.
>
> If you want to do smoke tests or acceptance tests with Costello 
> scripts, then you'll at least need to code up a XXXTester.  The script 
> editor will pick up the custom tester automatically if you follow the 
> instructions for writing a custom Tester class, which may or may not 
> require custom ComponentLocations.
>
(Continue reading)

Vishal Jain | 8 Oct 2007 11:59
Picon
Favicon

How to write an expression involving component references

Hi,

In one of the tests, I need to check if a particular Check Box is 
checked or not.And if it is unchecked, then I need to check it.I guess 
the way to go about this would be to write an Expression Step.The 
definition of the checkbox is recorded like:
.
<component class="javax.swing.JCheckBox" 
id="SelectDBObjectsPanel.AutoQuery" index="2" 
name="SelectDBObjectsPanel.AutoQuery" parent="JPanel Instance 17" 
text="Auto-Query" window="Create Business Components from Tables - Step 
1 of 6" />
.
How Can I add a expression to achieve the above mentioned task.I tried 
using the Sample Step, like:
   <sample component="SelectDBObjectsPanel.AutoQuery" 
method="isSelected" property="stateCheckBox" />
   <expression desc="Check the option if it is unchecked 
"><![CDATA[if(stateCheckBox==false)
{
SelectDBObjectsPanel.AutoQuery.setSelected(true);
}]]></expression>

But this does not seems to be doing anything as the property 
stateCheckBox is having the value "void" in the expression step.

If I try to use an expression like:
if(!(SelectDBObjectsPanel.AutoQuery).isEnabled())
{
(SelectDBObjectsPanel.AutoQuery).setSelected(true);
(Continue reading)

Timothy Wall | 8 Oct 2007 18:30
Gravatar

Re: How to write an expression involving component references

There is a beanshell function "component(id)" defined in abbot/script/ 
init.bsh to convert a string ID to a component.

On Oct 8, 2007, at 5:59 AM, Vishal Jain wrote:

> Hi,
>
> In one of the tests, I need to check if a particular Check Box is
> checked or not.And if it is unchecked, then I need to check it.I guess
> the way to go about this would be to write an Expression Step.The
> definition of the checkbox is recorded like:
> .
> <component class="javax.swing.JCheckBox"
> id="SelectDBObjectsPanel.AutoQuery" index="2"
> name="SelectDBObjectsPanel.AutoQuery" parent="JPanel Instance 17"
> text="Auto-Query" window="Create Business Components from Tables -  
> Step
> 1 of 6" />
> .
> How Can I add a expression to achieve the above mentioned task.I tried
> using the Sample Step, like:
>    <sample component="SelectDBObjectsPanel.AutoQuery"
> method="isSelected" property="stateCheckBox" />
>    <expression desc="Check the option if it is unchecked
> "><![CDATA[if(stateCheckBox==false)
> {
> SelectDBObjectsPanel.AutoQuery.setSelected(true);
> }]]></expression>
>
> But this does not seems to be doing anything as the property
(Continue reading)

Timothy Wall | 8 Oct 2007 18:32
Gravatar

Re: Problem with using ScriptFixture.

You should be able to use the older version with Abbot.  Just  
recompile the abbot jars using your jdom; at most you'll have to  
tweak one or two lines to use the older-style API.

On Oct 8, 2007, at 7:51 AM, Теличко Павел wrote:

> You are right.
> My application and Abbot use different version of jdom.jar.
>
> I receive evidence that later version of Element.class have not  
> some methods that exists in earlier version.
> Unfortunately, I have to use old version of jdom.jar for my  
> application.
> So, I have coped jdom.jar from myApplication in abbot/lib.
>
> I get exception at using  ScriptFixture:
>
> java.lang.NoClassDefFoundError: org/jdom/Content
>      at junit.extensions.abbot.ScriptFixture.runTest 
> (ScriptFixture.java:56)
>      at junit.framework.TestCase.runBare(TestCase.java:127)
>      at junit.framework.TestResult$1.protect(TestResult.java:106)
>      at junit.framework.TestResult.runProtected(TestResult.java:124)
>      at junit.framework.TestResult.run(TestResult.java:109)
>      at junit.framework.TestCase.run(TestCase.java:118)
>      at junit.framework.TestSuite.runTest(TestSuite.java:208)
>      at junit.framework.TestSuite.run(TestSuite.java:203)
>      at  
> org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run 
> (JUnit3TestReference.java:128)
(Continue reading)

Timothy Wall | 9 Oct 2007 13:46
Gravatar

Re: How to write an expression involving component references

You'll just need to verify that the reference is something that will  
match (the most reliable way is to name the component via  
Component.setName).

If the component is not yet showing, you'll need to wait for it.

On Oct 9, 2007, at 3:34 AM, Vishal Jain wrote:

> Hi,
>
> Thanks for the reply.
> So when I try something like component 
> ("SelectDBObjectsPanel.AutoQuery"), this should be OK, I guess.But  
> instead it throws me the error:
> No component found that matches
> <component class="javax.swing.JCheckBox"  
> id="SelectDBObjectsPanel.AutoQuery" index="2"  
> name="SelectDBObjectsPanel.AutoQuery" parent="JPanel Instance 17"  
> text="Auto-Query" window="Create Business Components from Tables -  
> Step 1 of 6" />
>
> Am I doing something wrong here?
> Thanks for your help.
>
> Regards,
> Vishal
>
> Timothy Wall wrote:
>> There is a beanshell function "component(id)" defined in abbot/ 
>> script/init.bsh to convert a string ID to a component.
(Continue reading)

Vishal Jain | 9 Oct 2007 09:34
Picon
Favicon

Re: How to write an expression involving component references

Hi,

Thanks for the reply.
So when I try something like 
component("SelectDBObjectsPanel.AutoQuery"), this should be OK, I 
guess.But instead it throws me the error:
No component found that matches
<component class="javax.swing.JCheckBox" 
id="SelectDBObjectsPanel.AutoQuery" index="2" 
name="SelectDBObjectsPanel.AutoQuery" parent="JPanel Instance 17" 
text="Auto-Query" window="Create Business Components from Tables - Step 
1 of 6" />

Am I doing something wrong here?
Thanks for your help.

Regards,
Vishal

Timothy Wall wrote:
> There is a beanshell function "component(id)" defined in 
> abbot/script/init.bsh to convert a string ID to a component.
>
> On Oct 8, 2007, at 5:59 AM, Vishal Jain wrote:
>
>> Hi,
>>
>> In one of the tests, I need to check if a particular Check Box is
>> checked or not.And if it is unchecked, then I need to check it.I guess
>> the way to go about this would be to write an Expression Step.The
(Continue reading)


Gmane