Remote Agent - Silk4Test

You can integrate TestOptimal with Silk4Test through InvokeJava feature in Silk4Test. The solution described below was contributed by Kgan Varsha of Intuit:

Step 1 InvokeJava calls the constructor method of the Java class to create a new instance of the specified Java GUI object to manipulate. So, say, my java class is MyRemoteAgent.java, then InvokeJava in silk calls the constructor of MyRemoteAgent.java.

Example: [] xCheckBox.TheCheckBox.InvokeJava (MyRemoteAgent,“….”,“….”)

Hence, The control goes back to the constructor instead of the source execute() function and the remote command and toagent are lost.

So, instead of doing toagent.run() and execute, here is what I did:

   Invoke silk via command line first time with the first command from getNextCmd(..) as argument.
   Once response is received in the constructor, set the result by {nextRemoteCmd.setExecCompleted("exec results here");}
   Get the next command nextRemoteCmd = agent.getNextCmd(nextRemoteCmd);
   Return this new command as a result to silk.
   Added code in silk to process that result as if it were a command.
   Break this loop if agent.getNextCmd(..) returns null. So, Java and Silk talked to each other till there were no more topics left.

tep 2 InvokeJava only works for Java GUI objects. So, it would throw an error 1 for the browser or any of the other objects.

So, I tricked it by creating another Java application to trigger InvokeJava and then onwards to switch over to my browser application.

Step 3 Synchronize between receiving TestOptimal command and response from Silk's InvokeJava by creating the handshake between them to wait till response is received before processing.