Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Test and Performance Tools Platform (TPTP) » Using wait command in AGR script
Using wait command in AGR script [message #125720] Fri, 07 March 2008 02:07 Go to next message
Pushparaj is currently offline PushparajFriend
Messages: 62
Registered: July 2009
Member
Hi All,

In my application i am building the project using ant. So i written AGR
script to test by build process.

My AGR script contains commands to build the project and at the end it has
verification hook to verify whether my project is building or not. In the
verification method i written the code to verify the console messages
which are the output of project build.

These are the two commands i am using in my script:

<command descriptive="SampleModel" type="item-select"
resolverId="org.eclipse.tptp.test.auto.gui.adaptive"
contextId="view/com.clovis.cw.workspace.clovisWorkspaceView "
widgetId="{{/}}-{{1.0}}">
<item path="{{/SampleModel}}-{{1.0}}"
resolverId="org.eclipse.tptp.test.auto.gui.adaptive"/>
</command>

<command type="verification"
contextId="view/org.eclipse.ui.console.ConsoleView"
location="/IDETestContainer/src"
resource=" com.clovis.ide.test.automation.verifications.IDETestVerifica tion "
hook="verifyResult:Qorg.eclipse.ui.IViewPart;"/>

While running the script it is building the project properly. but before
completing the first command(build process) it is going to second commad
(verification method). So i am not able verify my result. Because i will
get the console messages at the end of the build process.

So i insert the wait command between these two commands. But after that it
is not even going to the verification method.



Thanks,
Pushparaj
Re: Using wait command in AGR script [message #125948 is a reply to message #125720] Mon, 10 March 2008 19:56 Go to previous messageGo to next message
DuWayne Morris is currently offline DuWayne MorrisFriend
Messages: 36
Registered: July 2009
Member
Hi,

Perhaps you could post the portion of the AGR script that includes the
portion that is not working. It is difficult to know why this is not
working without the details.

Thanks,
DuWayne
Re: Using wait command in AGR script [message #126077 is a reply to message #125948] Tue, 11 March 2008 17:07 Go to previous messageGo to next message
Pushparaj is currently offline PushparajFriend
Messages: 62
Registered: July 2009
Member
Hi,

In our application we are having option to create/build the projects which
contains our own project natures. For building we are using eclipse's
project -> build menu. Our builder class is extending
IncrementalProjectBuilder. we has overwriten the build method like this,

protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
throws CoreException {

AntRunner ant = new AntRunner();
try {
ant.setCustomClasspath(getClassPathURL());
ant.addBuildLogger(MyBuilderLogger.class.getName());
} catch (Exception e) {
ant.addBuildLogger("org.apache.tools.ant.DefaultLogger");
}

StringBuffer buff=""
.........
.........
ant.setBuildFileLocation(project.getLocation().append("build.xml ")
.toOSString());
ant.setArguments(buff.toString());
ant.setMessageOutputLevel(org.apache.tools.ant.Project.MSG_I NFO);

AntBuildThread thread = new AntBuildThread(ant, project);
Display.getDefault().syncExec(thread);
}

class AntBuildThread implements Runnable {
public void run() {
............
............
try {
ProgressMonitorDialog pmDialog = null;
pmDialog = new ProgressMonitorDialog(Display.getDefault()
.getActiveShell());
pmDialog.run(true, true, new RunnableCode(ant, project));
} catch (InterruptedException ie) {
ie.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}

class RunnableCode implements IRunnableWithProgress, Runnable {

..............
..............
..............
public void run(IProgressMonitor monitor)
throws InvocationTargetException, InterruptedException {
try {
if (monitor.isCanceled()) {
monitor.done();
return;
}
monitor.beginTask("Building source code for : "
+ project.getName(), IProgressMonitor.UNKNOWN);
ant.run(monitor);
} catch (Exception e) {
e.printStackTrace();
}
}
}


While recording AGR script i captured the following events,
1. I select one of the project(SampleModel) in the workspace

2. I click project->build menu. so the build process is started and all
the ouput messages are displayed in the console view. finally 'BUILD
SUCCESSFUL/BUILD FAILED' is displayed in the console(normally it take more
than one minute to complete the build process).

3. After the completion of build action, I insert the verification
hook(verifyResult). In the verification method i written the code to
verify the BUILD SUCCESSFUL/BUILD FAILED message in console view.


While running the AGR script, (1)It selects the project, (2) It click the
project -> build menu. then immediately it goes to the verification
method(3).
At that time my console view is empty So i am not able to verify the
SUCCESSFUL/FAILED messages.

This is my AGR script

<command descriptive="SampleModel" type="item-select"
resolverId="org.eclipse.tptp.test.auto.gui.adaptive"
contextId="view/com.clovis.cw.workspace.clovisWorkspaceView "
widgetId="{{/}}-{{1.0}}">
<item path="{{/SampleModel}}-{{1.0}}"
resolverId="org.eclipse.tptp.test.auto.gui.adaptive"/>
</command>

<command descriptive="Build Project" type="select"
resolverId="org.eclipse.tptp.test.auto.gui.nontrivial" contextId="menus"
widgetId="{{Project-Build Project}}-{{1.0}}"/>
<command descriptive="SampleModel" type="item-select"
resolverId="org.eclipse.tptp.test.auto.gui.adaptive"
contextId="view/com.clovis.cw.workspace.clovisWorkspaceView "
widgetId="{{/}}-{{1.0}}">
<item path="{{/SampleModel}}-{{1.0}}"
resolverId="org.eclipse.tptp.test.auto.gui.adaptive"/>
</command>

<command type="verification"
contextId="view/org.eclipse.ui.console.ConsoleView"
location="/IDETestContainer/src"
resource="automation.verifications.TestVerification"
hook="verifyResult:Qorg.eclipse.ui.IViewPart;"/>


Thanks,
Pushparaj
Re: Using wait command in AGR script [message #126132 is a reply to message #125720] Wed, 12 March 2008 10:43 Go to previous messageGo to next message
Jimmy Jin is currently offline Jimmy JinFriend
Messages: 32
Registered: July 2009
Member
Hello, Pushparaj,

I think if you insert wait command with time-to-wait attribute
correctly, it should wait for that length of time and then continue. Can
you give the AGR script in which you inserted the wait command? Also is
there any error after running this script (with the wait command)?

Regards,
Jimmy Jin

Pushparaj wrote:
> Hi All,
>
> In my application i am building the project using ant. So i written AGR
> script to test by build process.
>
> My AGR script contains commands to build the project and at the end it
> has verification hook to verify whether my project is building or not.
> In the verification method i written the code to verify the console
> messages which are the output of project build.
>
> These are the two commands i am using in my script:
>
> <command descriptive="SampleModel" type="item-select"
> resolverId="org.eclipse.tptp.test.auto.gui.adaptive"
> contextId="view/com.clovis.cw.workspace.clovisWorkspaceView "
> widgetId="{{/}}-{{1.0}}">
> <item path="{{/SampleModel}}-{{1.0}}"
> resolverId="org.eclipse.tptp.test.auto.gui.adaptive"/>
> </command>
>
> <command type="verification"
> contextId="view/org.eclipse.ui.console.ConsoleView"
> location="/IDETestContainer/src"
> resource=" com.clovis.ide.test.automation.verifications.IDETestVerifica tion "
> hook="verifyResult:Qorg.eclipse.ui.IViewPart;"/>
>
> While running the script it is building the project properly. but before
> completing the first command(build process) it is going to second commad
> (verification method). So i am not able verify my result. Because i will
> get the console messages at the end of the build process.
>
> So i insert the wait command between these two commands. But after that
> it is not even going to the verification method.
>
>
>
> Thanks,
> Pushparaj
>
Re: Using wait command in AGR script [message #126155 is a reply to message #126132] Wed, 12 March 2008 18:05 Go to previous messageGo to next message
Pushparaj is currently offline PushparajFriend
Messages: 62
Registered: July 2009
Member
Hi Jimmy Jin,
I am getting the following error message if i am using wait command,

org.eclipse.core.runtime.CoreException
A time-out occurred while running command MacroCommand [wait, line 105].
This is likely caused by the presence of an unexpected dialog or the
absence of an expected dialog.
org.eclipse.core.runtime.CoreException: A time-out occurred while running
command MacroCommand [wait, line 105]. This is likely caused by the
presence of an unexpected dialog or the absence of an expected dialog.
at
org.eclipse.tptp.test.auto.gui.internal.commands.MacroComman dShell$1$WakeUpOperaion.run(MacroCommandShell.java:929)
at org.eclipse.swt.widgets.Display.timerProc(Display.java:3603)
at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Na tive
Method)


I am using the wait command like this

<command type="wait" time-to-wait="120000"/>

I am expecting this command will wait for 2 minutes. But it is waiting for
only 25 seconds after that it is comming out.

then i tied with wait command like this

<command type="wait"/>

But i am getting the same result.


Thanks,
Pushparaj
Re: Using wait command in AGR script [message #126446 is a reply to message #126155] Sun, 16 March 2008 10:14 Go to previous messageGo to next message
Jimmy Jin is currently offline Jimmy JinFriend
Messages: 32
Registered: July 2009
Member
Hello, Pushparaj,

I guess that this is a problem of AGR, that maybe the default timeout
for a command is not longer then the time your set for the wait command.
But I need to double check the source code to confirm this.

If it is a problem, I will try to think about how to fix it.

Maybe you can try to break the wait command into several ones, so that
each of time will not be waiting for so long?

Jimmy Jin

Pushparaj wrote:
> Hi Jimmy Jin,
> I am getting the following error message if i am using wait command,
>
> org.eclipse.core.runtime.CoreException
> A time-out occurred while running command MacroCommand [wait, line
> 105]. This is likely caused by the presence of an unexpected dialog or
> the absence of an expected dialog.
> org.eclipse.core.runtime.CoreException: A time-out occurred while
> running command MacroCommand [wait, line 105]. This is likely caused by
> the presence of an unexpected dialog or the absence of an expected dialog.
> at
> org.eclipse.tptp.test.auto.gui.internal.commands.MacroComman dShell$1$WakeUpOperaion.run(MacroCommandShell.java:929)
>
> at org.eclipse.swt.widgets.Display.timerProc(Display.java:3603)
> at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Na tive
> Method)
>
>
> I am using the wait command like this
>
> <command type="wait" time-to-wait="120000"/>
>
> I am expecting this command will wait for 2 minutes. But it is waiting
> for only 25 seconds after that it is comming out.
>
> then i tied with wait command like this
>
> <command type="wait"/>
>
> But i am getting the same result.
>
>
> Thanks,
> Pushparaj
>
Re: Using wait command in AGR script [message #126549 is a reply to message #126155] Mon, 17 March 2008 08:36 Go to previous messageGo to next message
Jimmy Jin is currently offline Jimmy JinFriend
Messages: 32
Registered: July 2009
Member
Hello, Pushparaj,

Just find that in the behavior tab of the test suite, you can set the
timeout for each invocation of test case. You can try to give a big
timeout for the invocation of test case which contains the long wait
command.

In current AGR, no matter the command is a "wait" or others, the timeout
are all the same.

Jimmy Jin


Pushparaj wrote:

> Hi Jimmy Jin,
> I am getting the following error message if i am using wait command,

> org.eclipse.core.runtime.CoreException
> A time-out occurred while running command MacroCommand [wait, line 105].
> This is likely caused by the presence of an unexpected dialog or the
> absence of an expected dialog.
> org.eclipse.core.runtime.CoreException: A time-out occurred while running
> command MacroCommand [wait, line 105]. This is likely caused by the
> presence of an unexpected dialog or the absence of an expected dialog.
> at
>
org.eclipse.tptp.test.auto.gui.internal.commands.MacroComman dShell$1$WakeUpOperaion.run(MacroCommandShell.java:929)
> at org.eclipse.swt.widgets.Display.timerProc(Display.java:3603)
> at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Na tive
> Method)


> I am using the wait command like this

> <command type="wait" time-to-wait="120000"/>

> I am expecting this command will wait for 2 minutes. But it is waiting for
> only 25 seconds after that it is comming out.

> then i tied with wait command like this

> <command type="wait"/>

> But i am getting the same result.


> Thanks,
> Pushparaj
Re: Using wait command in AGR script [message #126603 is a reply to message #126549] Mon, 17 March 2008 18:04 Go to previous messageGo to next message
Pushparaj is currently offline PushparajFriend
Messages: 62
Registered: July 2009
Member
Hi Jimmy Jin,

In my test script i don't want to specify the time-out for all the
commands. I want to specify some specific commands which will take more
time to complete. Also i don't know how much time it will take sometimes
it takes 2 minutes sometimes more than 3 or 4 minutes. So i can't specify
the exact time-out.

Also i am not able to find out the place to specify the time-outs in the
behavior tab.

Is it available in TPTP4.3?


Thanks,
Pushparaj.
Re: Using wait command in AGR script [message #126891 is a reply to message #126603] Wed, 19 March 2008 10:02 Go to previous messageGo to next message
Jimmy Jin is currently offline Jimmy JinFriend
Messages: 32
Registered: July 2009
Member
Hi, Pushparaj,

For the time-outs in behavior tab, you can see
http://www.eclipse.org/tptp/test/documents/userguides/auto-g ui-images-4-3-0/behaviour-pane-4-3-0.png.
It's at the right bottom corner, just above the User Input.

I also think, at least for the "wait" command, if the time-to-wait is
specified, then within this period of time, this command should not
timeout. This can be a bug or an enhancement. But even we can get a fix
for it, it will not be available on 4.3.x version, which you are using now
(unless you apply the patch and recreate the plug-in yourself). So I
suggest you split the "wait" command into several ones, with each of them
not longer than 30s. This maybe can help to workaround this issue.

Regards,
Jimmy Jin


Pushparaj wrote:

> Hi Jimmy Jin,

> In my test script i don't want to specify the time-out for all the
> commands. I want to specify some specific commands which will take more
> time to complete. Also i don't know how much time it will take sometimes
> it takes 2 minutes sometimes more than 3 or 4 minutes. So i can't specify
> the exact time-out.

> Also i am not able to find out the place to specify the time-outs in the
> behavior tab.

> Is it available in TPTP4.3?


> Thanks,
> Pushparaj.
Re: Using wait command in AGR script [message #130775 is a reply to message #126891] Tue, 03 June 2008 15:07 Go to previous message
DuWayne Morris is currently offline DuWayne MorrisFriend
Messages: 36
Registered: July 2009
Member
This is a late reply. You may edit the macro and specify a timeout, using
the wait command as follows:

<command type="wait" time-to-wait="5000"/>

You may also add a verification hook and write arbitrary Java code to
execute until the desired actions have been completed.

There was a defect filed that is not being addressed where the timeout
command did not work properly in quick mode,
https://bugs.eclipse.org/bugs/show_bug.cgi?id=203981.

As a reminder, the AGR is continuing on an as-is basis only.
Contributions in the form of defects fixes or enhancements are welcome and
the AGR is used internally for our test passes.
Previous Topic:functional testing of a web application using TPTP?
Next Topic:tptp execuation task issue
Goto Forum:
  


Current Time: Fri Mar 29 13:38:17 GMT 2024

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

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

Back to the top