문제

Has anyone out there used the RobotFramework and the Java Remote Server?

I'm having a problem getting my java keywords to work with the remote server. To get a keyword to fail I threw an exception, which cause robot to fail but instead of getting the message I supplied to show up in the log I get an "Processing XML-RPC return value failed" message.

So my next attempt was to try using Assertions but that cause the server to throw a Null Pointer Exception.

Here is the method I created.

Public void filesShouldBeEqual(String path1, String path2){
     File f1 = new File(path1);
     File f2 = new File(path2);
     int value = f1.compareTo(f2);

     if(value > 0 || value < 0){
        Assert.assertFalse("Files are not equal", false);
     } else if (value == 0){
        Assert.assertTrue("Files are equal", true);
     }
 }
도움이 되었습니까?

해결책

You would have gotten better response posting to the robot framework user group on Google Groups.

It would help if you posted information about your original code where you threw exception that caused "Processing XML-RPC return value failed" message.

FYI, the latest release/changes to the remote server should make it easier to create your remote libraries:

https://github.com/ombre42/jrobotremoteserver

And for some background to your issue, there's a list of known issues that may be related like

http://code.google.com/p/jrobotremoteserver/issues/detail?id=2

and the remote libraries must follow some guidelines for implementation as mentioned here:

http://code.google.com/p/jrobotremoteserver/wiki/RemoteServerDetails#Java_remote_library_interface_with_the_generic_remote_server

And last, the server's included example library presents a good example of how to properly implement a Java remote library using that server.

Your example code is probably best implemented this way:

Public static void filesShouldBeEqual(String path1, String path2) throws Exception{
 File f1 = new File(path1);
 File f2 = new File(path2);
 int value = f1.compareTo(f2);

 if(value > 0 || value < 0){
    throw new Exception("Files are not equal");
 }// else if (value == 0)
   //"Files are equal", automatically = pass by the framework after executing keyword
 System.out.println("Files are equal");
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top