Reputation: 1445
I am trying to learn how to use Robot Framework. I created simple Java project, using Eclipse. It contains one package - test
and in this package there is only one class - MyKeywords
. Here is the class content:
package test;
public class MyKeywords {
public String sayHi(String name)
{
return "Hello " +name ;
}
public String sayHi()
{
return "Hello World!";
}
public String typeOf(Object param)
{
return param.getClass().getSimpleName();
}
}
Then I created simple .txt file, whic is supposed to contain the test cases. Here is the my_suite.txt file:
*** Settings ***
Library test.MyKeywords
*** Test Cases ***
MyTestCase
${message} say hi
Log ${message}
MyTestCase2
${message} say hi my_name
Log ${message}
MyTestCase3
${message} type of 42
Log ${message}
Whenever, I try to paste the my_suite.txt file into the project directory, it goes under the bin directory.
After that, when I run pybot my_suite.txt
from the terminal (I am on Mac OS), I got the following message:
[ ERROR ] Error in file '/Users/b18/Documents/workspace/Example/my_suite.txt': Importing test library 'test.MyKeywords' failed: Module 'test' does not contain 'MyKeywords'. ============================================================================== My Suite
============================================================================== MyTestCase
| FAIL | No keyword with name 'say hi' found. ------------------------------------------------------------------------------ MyTestCase2
| FAIL | No keyword with name 'say hi' found. ------------------------------------------------------------------------------ MyTestCase3
| FAIL | No keyword with name 'type of' found. ------------------------------------------------------------------------------ My Suite
| FAIL | 3 critical tests, 0 passed, 3 failed 3 tests total, 0 passed, 3 failed ============================================================================== Output: /Users/b18/Documents/workspace/Example/output.xml Log:
/Users/b18/Documents/workspace/Example/log.html Report: /Users/b18/Documents/workspace/Example/report.html
Where is my mistake and what am I missing?
Upvotes: 2
Views: 837
Reputation: 1737
You're mixing languages here.
You are using Java keywords, with pybot (which is pure python - and doesn't support java).
You need to use jybot instead (you can download the jar and run it with java)
Jybot is based on Jython - and supports python and java code.
Upvotes: 3