Using wait command in AGR script [message #125720] |
Thu, 06 March 2008 21:07  |
Eclipse User |
|
|
|
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 #126077 is a reply to message #125948] |
Tue, 11 March 2008 13:07   |
Eclipse User |
|
|
|
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 #126446 is a reply to message #126155] |
Sun, 16 March 2008 06:14   |
Eclipse User |
|
|
|
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 04:36   |
Eclipse User |
|
|
|
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 #126891 is a reply to message #126603] |
Wed, 19 March 2008 06:02   |
Eclipse User |
|
|
|
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 11:07  |
Eclipse User |
|
|
|
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.
|
|
|
Powered by
FUDForum. Page generated in 0.59922 seconds