机器人框架不';我看不到Groovy关键字

机器人框架不';我看不到Groovy关键字,groovy,robotframework,Groovy,Robotframework,我正在使用Robot框架测试大量Java文件,我想添加几个Groovy文件。我读到这是可能的,因为编译的Groovy文件是一个.class文件,就像编译的Java文件一样 这是我的Groovy文件 import java.io.IOException; class GroovyTest { public String t1(){ return 'PASS' } } 这是我的机器人文件 | *** Settings *** | | Lib

我正在使用Robot框架测试大量Java文件,我想添加几个Groovy文件。我读到这是可能的,因为编译的Groovy文件是一个.class文件,就像编译的Java文件一样

这是我的Groovy文件

import java.io.IOException;

class GroovyTest 
{   
    public String t1(){
        return 'PASS'   
    }
} 
这是我的机器人文件

|  *** Settings ***  |

|  Library  |  GroovyTest  |


|  *** Test Cases ***  |

|  Groovy Sanity   |  [Documentation]  |  set pass string  |
|  \  |  GroovyTest.t1       |
|  \  |  Return GROOVY state  |


|  *** Keywords ***  |

|  Return GROOVY state  |
|  \  |  ${value}=        |  GroovyTest.t1    |
|  \  |  [return]         |  ${value}              |
|  \  |  Should Be Equal  |  ${value}              |  PASS    |
这与我设置所有Java测试用例和关键字的方式相同。使用Groovy,我得到了这个错误

[ WARN ] Imported library 'GroovyTest' contains no keywords

编辑:此答案仅适用于使用类名“test”的原始帖子

问题是已经有一个名为test的模块包含Jython本身的单元测试,它由Robot框架而不是您的测试库加载。尝试使用更具描述性的类名,如TestGroovyLibrary

>>> import test >>> help(test) Help on package test: NAME test - # Dummy file to make this directory a package. FILE c:\apps\jython2.5.3\lib\test\__init__.py PACKAGE CONTENTS Graph access_protected_class access_protected_field anygui autotest bad_coding ... 行驶中的输出:

20130711 10:12:54.117 :  INFO : ${library} = <module 'test' from C:\apps\jython2.5.3\Lib\test\__init__$py.class'\>  
20130711 10:12:54.130 :  INFO : C:\apps\jython2.5.3\Lib\test\__init__$py.class

20130711 10:12:54.117:INFO:${library}=EDIT:此答案仅适用于使用类名“test”的原始帖子

问题是已经有一个名为test的模块包含Jython本身的单元测试,它由Robot框架而不是您的测试库加载。尝试使用更具描述性的类名,如TestGroovyLibrary

>>> import test >>> help(test) Help on package test: NAME test - # Dummy file to make this directory a package. FILE c:\apps\jython2.5.3\lib\test\__init__.py PACKAGE CONTENTS Graph access_protected_class access_protected_field anygui autotest bad_coding ... 行驶中的输出:

20130711 10:12:54.117 :  INFO : ${library} = <module 'test' from C:\apps\jython2.5.3\Lib\test\__init__$py.class'\>  
20130711 10:12:54.130 :  INFO : C:\apps\jython2.5.3\Lib\test\__init__$py.class

20130711 10:12:54.117:INFO:${library}=很抱歉,我简化了我正在使用的类和方法的名称,使它们更易于阅读。我实际上并没有使用一个名为test的类,但在将来知道这一点很好。我已经更新了我的问题。很抱歉,我简化了我正在使用的类和方法的名称,使它们更易于阅读。我实际上并没有使用一个名为test的类,但在将来知道这一点很好。我已经更新了我的问题。