Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Test and Performance Tools Platform (TPTP) » AGR: How to locate one widget in EditorPart when setting verfiy point
AGR: How to locate one widget in EditorPart when setting verfiy point [message #62582] Thu, 30 March 2006 10:41 Go to next message
Cliff Liang is currently offline Cliff LiangFriend
Messages: 24
Registered: July 2009
Junior Member
Hi,

I have one tree in EditorPart, and want to verify one node is added into
this tree when I click one button. So I add one verify point to check
whether this tree has new node with known name. But I found the verify
method take IEditorPart as input parameter. My question is how to access the
tree in EditotPart?

Thanks in advance!

Cliff Liang
Re: How to locate one widget in EditorPart when setting verfiy point [message #63290 is a reply to message #62582] Sat, 01 April 2006 16:39 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 404
Registered: July 2009
Senior Member
Hi Cliff,

Check out the following plug-in from TPTP's cvs:
test-results/platform/org.eclipse.hyades.use.cases.
Look under src/org.eclipse.hyades.us.cases.auto.common.VerifyHookUtil.j ava
This calss provides convinient methods for extracting controls from a
verification hook target. You might want to do something like:

Composite editorComposite = VerifyHookUtil.getWorkbenchPartControl(editor);
Control[] trees = VerifyHookUtil.findAllControl(editorComposite ,
VerifyHookUtil.TREE_CONTROL_TYPE, null);
boolean isTreeNodeFound = false;
for (int i = 0; i < trees.length; i++)
{
if (VerifyHookUtil.findChild(trees[i], "tree-node-label");
{
isTreeNodeFound = true;
break;
}
}
assertTrue(isTreeNodeFound);


"Cliff Liang" <cliff.liang@benisoft.com> wrote in message
news:e0gckv$f3u$1@utils.eclipse.org...
> Hi,
>
> I have one tree in EditorPart, and want to verify one node is added into
> this tree when I click one button. So I add one verify point to check
> whether this tree has new node with known name. But I found the verify
> method take IEditorPart as input parameter. My question is how to access
the
> tree in EditotPart?
>
> Thanks in advance!
>
> Cliff Liang
>
>
Re: How to locate one widget in EditorPart when setting verfiy point [message #64194 is a reply to message #63290] Wed, 05 April 2006 02:23 Go to previous messageGo to next message
simoom chen is currently offline simoom chenFriend
Messages: 14
Registered: July 2009
Junior Member
Thank u.
I have tried it.
It works well
Re: How to locate one widget in EditorPart when setting verfiy point [message #66366 is a reply to message #63290] Thu, 13 April 2006 17:14 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mvjaibharatreddy.yahoo.com

Hi Ali,

I have tried your suggestion to locate the widget in the Editor part. But
while playing back the test runner is not able to locate the editor and it
is rising the coreException. I think i am doing some thing wrong while
recording .. I have followed the exactly the same instructions from the user
manual of AGR.

Below is java code

Which almost similar to your example one
public void testCheck(org.eclipse.ui.IEditorPart arg0) throws Exception
{
Composite editorComposite = VerifyHookUtil.getWorkbenchPartControl(arg0);
Control[] trees = VerifyHookUtil.findAllControl(editorComposite,
VerifyHookUtil.TREE_CONTROL_TYPE, null);
boolean isTreeNodeFound = false;
for (int i = 0; i < trees.length; i++) {
if (VerifyHookUtil.findChild((Tree) trees[i], "MyName") != null)
{
isTreeNodeFound = true;
break;
}
}
assertTrue(isTreeNodeFound);
}

It would be great help if you can explain how to locate or tell our runner
about the EditorPart while recording. An example would be much better.

Thanks
Jai



"Ali Mehregani" <amehrega@ca.ibm.com> wrote in message
news:e0mabu$kov$1@utils.eclipse.org...
> Hi Cliff,
>
> Check out the following plug-in from TPTP's cvs:
> test-results/platform/org.eclipse.hyades.use.cases.
> Look under src/org.eclipse.hyades.us.cases.auto.common.VerifyHookUtil.j ava
> This calss provides convinient methods for extracting controls from a
> verification hook target. You might want to do something like:
>
> Composite editorComposite =
> VerifyHookUtil.getWorkbenchPartControl(editor);
> Control[] trees = VerifyHookUtil.findAllControl(editorComposite ,
> VerifyHookUtil.TREE_CONTROL_TYPE, null);
> boolean isTreeNodeFound = false;
> for (int i = 0; i < trees.length; i++)
> {
> if (VerifyHookUtil.findChild(trees[i], "tree-node-label");
> {
> isTreeNodeFound = true;
> break;
> }
> }
> assertTrue(isTreeNodeFound);
>
>
> "Cliff Liang" <cliff.liang@benisoft.com> wrote in message
> news:e0gckv$f3u$1@utils.eclipse.org...
>> Hi,
>>
>> I have one tree in EditorPart, and want to verify one node is added into
>> this tree when I click one button. So I add one verify point to check
>> whether this tree has new node with known name. But I found the verify
>> method take IEditorPart as input parameter. My question is how to access
> the
>> tree in EditotPart?
>>
>> Thanks in advance!
>>
>> Cliff Liang
>>
>>
>
>
Re: How to locate one widget in EditorPart when setting verfiy point [message #66404 is a reply to message #66366] Thu, 13 April 2006 19:17 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 404
Registered: July 2009
Senior Member
Where are you getting the CoreException?
When doing the verification, make sure

- The tree is fully expanded to the node that you wish to verify
- There are two versions of VerifyHookUtil.findChild. The version that
you're using doesn't do a recursive search on the tree. Try using
VerifyHookUtil.findChild((Tree) trees[i], "MyName", true)



"Jai9999" <mvjaibharatreddy@yahoo.com> wrote in message
news:e1m0tp$gio$1@utils.eclipse.org...
> Hi Ali,
>
> I have tried your suggestion to locate the widget in the Editor part.
But
> while playing back the test runner is not able to locate the editor and it
> is rising the coreException. I think i am doing some thing wrong while
> recording .. I have followed the exactly the same instructions from the
user
> manual of AGR.
>
> Below is java code
>
> Which almost similar to your example one
> public void testCheck(org.eclipse.ui.IEditorPart arg0) throws Exception
> {
> Composite editorComposite =
VerifyHookUtil.getWorkbenchPartControl(arg0);
> Control[] trees = VerifyHookUtil.findAllControl(editorComposite,
> VerifyHookUtil.TREE_CONTROL_TYPE, null);
> boolean isTreeNodeFound = false;
> for (int i = 0; i < trees.length; i++) {
> if (VerifyHookUtil.findChild((Tree) trees[i], "MyName") != null)
> {
> isTreeNodeFound = true;
> break;
> }
> }
> assertTrue(isTreeNodeFound);
> }
>
> It would be great help if you can explain how to locate or tell our runner
> about the EditorPart while recording. An example would be much better.
>
> Thanks
> Jai
>
>
>
> "Ali Mehregani" <amehrega@ca.ibm.com> wrote in message
> news:e0mabu$kov$1@utils.eclipse.org...
> > Hi Cliff,
> >
> > Check out the following plug-in from TPTP's cvs:
> > test-results/platform/org.eclipse.hyades.use.cases.
> > Look under
src/org.eclipse.hyades.us.cases.auto.common.VerifyHookUtil.j ava
> > This calss provides convinient methods for extracting controls from a
> > verification hook target. You might want to do something like:
> >
> > Composite editorComposite =
> > VerifyHookUtil.getWorkbenchPartControl(editor);
> > Control[] trees = VerifyHookUtil.findAllControl(editorComposite ,
> > VerifyHookUtil.TREE_CONTROL_TYPE, null);
> > boolean isTreeNodeFound = false;
> > for (int i = 0; i < trees.length; i++)
> > {
> > if (VerifyHookUtil.findChild(trees[i], "tree-node-label");
> > {
> > isTreeNodeFound = true;
> > break;
> > }
> > }
> > assertTrue(isTreeNodeFound);
> >
> >
> > "Cliff Liang" <cliff.liang@benisoft.com> wrote in message
> > news:e0gckv$f3u$1@utils.eclipse.org...
> >> Hi,
> >>
> >> I have one tree in EditorPart, and want to verify one node is added
into
> >> this tree when I click one button. So I add one verify point to check
> >> whether this tree has new node with known name. But I found the verify
> >> method take IEditorPart as input parameter. My question is how to
access
> > the
> >> tree in EditotPart?
> >>
> >> Thanks in advance!
> >>
> >> Cliff Liang
> >>
> >>
> >
> >
>
>
Re: How to locate one widget in EditorPart when setting verfiy point [message #66914 is a reply to message #66404] Tue, 18 April 2006 12:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mvjaibharatreddy.yahoo.com

Hi ali,

When doing the verification it is rising CoreException. It is not able to
find the contextID.

Tree is fully expanded while making the verification .

I had the same problem while doing the example which was stated in the
UserGuide of AGR. I have the all needed dependencies in my manifest file.

I don't know what I am missing with. If you have any other examples I would
like to try.

Cheers
Jai

"Ali Mehregani" <amehrega@ca.ibm.com> wrote in message
news:e1m84q$lk$1@utils.eclipse.org...
> Where are you getting the CoreException?
> When doing the verification, make sure
>
> - The tree is fully expanded to the node that you wish to verify
> - There are two versions of VerifyHookUtil.findChild. The version that
> you're using doesn't do a recursive search on the tree. Try using
> VerifyHookUtil.findChild((Tree) trees[i], "MyName", true)
>
>
>
> "Jai9999" <mvjaibharatreddy@yahoo.com> wrote in message
> news:e1m0tp$gio$1@utils.eclipse.org...
>> Hi Ali,
>>
>> I have tried your suggestion to locate the widget in the Editor part.
> But
>> while playing back the test runner is not able to locate the editor and
>> it
>> is rising the coreException. I think i am doing some thing wrong while
>> recording .. I have followed the exactly the same instructions from the
> user
>> manual of AGR.
>>
>> Below is java code
>>
>> Which almost similar to your example one
>> public void testCheck(org.eclipse.ui.IEditorPart arg0) throws Exception
>> {
>> Composite editorComposite =
> VerifyHookUtil.getWorkbenchPartControl(arg0);
>> Control[] trees = VerifyHookUtil.findAllControl(editorComposite,
>> VerifyHookUtil.TREE_CONTROL_TYPE, null);
>> boolean isTreeNodeFound = false;
>> for (int i = 0; i < trees.length; i++) {
>> if (VerifyHookUtil.findChild((Tree) trees[i], "MyName") != null)
>> {
>> isTreeNodeFound = true;
>> break;
>> }
>> }
>> assertTrue(isTreeNodeFound);
>> }
>>
>> It would be great help if you can explain how to locate or tell our
>> runner
>> about the EditorPart while recording. An example would be much better.
>>
>> Thanks
>> Jai
>>
>>
>>
>> "Ali Mehregani" <amehrega@ca.ibm.com> wrote in message
>> news:e0mabu$kov$1@utils.eclipse.org...
>> > Hi Cliff,
>> >
>> > Check out the following plug-in from TPTP's cvs:
>> > test-results/platform/org.eclipse.hyades.use.cases.
>> > Look under
> src/org.eclipse.hyades.us.cases.auto.common.VerifyHookUtil.j ava
>> > This calss provides convinient methods for extracting controls from a
>> > verification hook target. You might want to do something like:
>> >
>> > Composite editorComposite =
>> > VerifyHookUtil.getWorkbenchPartControl(editor);
>> > Control[] trees = VerifyHookUtil.findAllControl(editorComposite ,
>> > VerifyHookUtil.TREE_CONTROL_TYPE, null);
>> > boolean isTreeNodeFound = false;
>> > for (int i = 0; i < trees.length; i++)
>> > {
>> > if (VerifyHookUtil.findChild(trees[i], "tree-node-label");
>> > {
>> > isTreeNodeFound = true;
>> > break;
>> > }
>> > }
>> > assertTrue(isTreeNodeFound);
>> >
>> >
>> > "Cliff Liang" <cliff.liang@benisoft.com> wrote in message
>> > news:e0gckv$f3u$1@utils.eclipse.org...
>> >> Hi,
>> >>
>> >> I have one tree in EditorPart, and want to verify one node is added
> into
>> >> this tree when I click one button. So I add one verify point to check
>> >> whether this tree has new node with known name. But I found the verify
>> >> method take IEditorPart as input parameter. My question is how to
> access
>> > the
>> >> tree in EditotPart?
>> >>
>> >> Thanks in advance!
>> >>
>> >> Cliff Liang
>> >>
>> >>
>> >
>> >
>>
>>
>
>
Re: How to locate one widget in EditorPart when setting verfiy point [message #66941 is a reply to message #66914] Tue, 18 April 2006 14:06 Go to previous message
No real name is currently offline No real nameFriend
Messages: 404
Registered: July 2009
Senior Member
This can happen if you don't have the editor opened before doing the
verification. Make sure the editor is opened and has focus before the
verification fragment.
Try performing the following sequence of tasks in the order outlined below:

- Open the editor
- Expand the tree
- Perform the verification.

This worked fine for me when I tested a verification hook on a Java editor.
Your problem isn't coming from what you have in your verification method.
The problem is that the editor is not anywhere to be found before even doing
the verification.

Thanks.

"Jai9999" <mvjaibharatreddy@yahoo.com> wrote in message
news:e22m2a$sjg$1@utils.eclipse.org...
> Hi ali,
>
> When doing the verification it is rising CoreException. It is not able to
> find the contextID.
>
> Tree is fully expanded while making the verification .
>
> I had the same problem while doing the example which was stated in the
> UserGuide of AGR. I have the all needed dependencies in my manifest file.
>
> I don't know what I am missing with. If you have any other examples I
would
> like to try.
>
> Cheers
> Jai
>
> "Ali Mehregani" <amehrega@ca.ibm.com> wrote in message
> news:e1m84q$lk$1@utils.eclipse.org...
> > Where are you getting the CoreException?
> > When doing the verification, make sure
> >
> > - The tree is fully expanded to the node that you wish to verify
> > - There are two versions of VerifyHookUtil.findChild. The version that
> > you're using doesn't do a recursive search on the tree. Try using
> > VerifyHookUtil.findChild((Tree) trees[i], "MyName", true)
> >
> >
> >
> > "Jai9999" <mvjaibharatreddy@yahoo.com> wrote in message
> > news:e1m0tp$gio$1@utils.eclipse.org...
> >> Hi Ali,
> >>
> >> I have tried your suggestion to locate the widget in the Editor part.
> > But
> >> while playing back the test runner is not able to locate the editor and
> >> it
> >> is rising the coreException. I think i am doing some thing wrong while
> >> recording .. I have followed the exactly the same instructions from the
> > user
> >> manual of AGR.
> >>
> >> Below is java code
> >>
> >> Which almost similar to your example one
> >> public void testCheck(org.eclipse.ui.IEditorPart arg0) throws
Exception
> >> {
> >> Composite editorComposite =
> > VerifyHookUtil.getWorkbenchPartControl(arg0);
> >> Control[] trees = VerifyHookUtil.findAllControl(editorComposite,
> >> VerifyHookUtil.TREE_CONTROL_TYPE, null);
> >> boolean isTreeNodeFound = false;
> >> for (int i = 0; i < trees.length; i++) {
> >> if (VerifyHookUtil.findChild((Tree) trees[i], "MyName") != null)
> >> {
> >> isTreeNodeFound = true;
> >> break;
> >> }
> >> }
> >> assertTrue(isTreeNodeFound);
> >> }
> >>
> >> It would be great help if you can explain how to locate or tell our
> >> runner
> >> about the EditorPart while recording. An example would be much better.
> >>
> >> Thanks
> >> Jai
> >>
> >>
> >>
> >> "Ali Mehregani" <amehrega@ca.ibm.com> wrote in message
> >> news:e0mabu$kov$1@utils.eclipse.org...
> >> > Hi Cliff,
> >> >
> >> > Check out the following plug-in from TPTP's cvs:
> >> > test-results/platform/org.eclipse.hyades.use.cases.
> >> > Look under
> > src/org.eclipse.hyades.us.cases.auto.common.VerifyHookUtil.j ava
> >> > This calss provides convinient methods for extracting controls from a
> >> > verification hook target. You might want to do something like:
> >> >
> >> > Composite editorComposite =
> >> > VerifyHookUtil.getWorkbenchPartControl(editor);
> >> > Control[] trees = VerifyHookUtil.findAllControl(editorComposite ,
> >> > VerifyHookUtil.TREE_CONTROL_TYPE, null);
> >> > boolean isTreeNodeFound = false;
> >> > for (int i = 0; i < trees.length; i++)
> >> > {
> >> > if (VerifyHookUtil.findChild(trees[i], "tree-node-label");
> >> > {
> >> > isTreeNodeFound = true;
> >> > break;
> >> > }
> >> > }
> >> > assertTrue(isTreeNodeFound);
> >> >
> >> >
> >> > "Cliff Liang" <cliff.liang@benisoft.com> wrote in message
> >> > news:e0gckv$f3u$1@utils.eclipse.org...
> >> >> Hi,
> >> >>
> >> >> I have one tree in EditorPart, and want to verify one node is added
> > into
> >> >> this tree when I click one button. So I add one verify point to
check
> >> >> whether this tree has new node with known name. But I found the
verify
> >> >> method take IEditorPart as input parameter. My question is how to
> > access
> >> > the
> >> >> tree in EditotPart?
> >> >>
> >> >> Thanks in advance!
> >> >>
> >> >> Cliff Liang
> >> >>
> >> >>
> >> >
> >> >
> >>
> >>
> >
> >
>
>
Previous Topic:[AGR] Capturing odd selection in workbench
Next Topic:[AGR] Verification hooks in position based recording
Goto Forum:
  


Current Time: Tue Dec 23 00:18:40 GMT 2014

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

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