Hi Parmeet,
Why not wrap each type of test step in a Command, which also implements
AsyncCallback. Then allow
them to be chained together:
public abstract class AsyncCommand<T> implements AsyncCallback<T>, Command {
private final Command next;
protected AsyncCommand(final Command next) {
this.next = next;
}
protected abstract void onSuccessImpl(T value);
public final void onSuccess(final T value) {
try {
onSuccessImpl(value);
} finally {
DeferredCommand.addCommand(next);
}
}
public void onFailure(final Throwable error) {
// generic failure code in here
}
}
The execute() method of the AsyncCommand submits itself to the RPC service, and
the AsyncCommand
will run the next step of the process, if the current one was successful. This
means you can build
up your "chain" of test steps up fron, and then just execute() the first one.
Hope that helps a bit.
//Jason.
Parmeet Kohli wrote:
> Hi All,
>
> I'm developing a web based testing tool using GWT as the
> front end. This tool allows the user to add several test steps to a
> test case. The user has the option to run these test steps
> individually or the whole test case together. The latter option seems
> to be an issue though. The problem being that these tests must get
> executed in the sequence the user has suggested (The result of the one
> might affect another). But the asynchronous nature of GWT RPC is
> making life difficult. Any suggestions ??
>
> PS: Its not as simple as placing whatever i want to do after the RPC
> call in the onSuccess method. The user might add any number of test
> steps with different parameters.
>
> Thanks,
> Parmeet
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---