problem in importing Java class file to robot framework.

4 views
Skip to first unread message

Vin

unread,
Feb 4, 2020, 7:43:11 AM2/4/20
to robotframework-devel
My robot file name --> example.robot

code snippet as below
-------------------
*** Settings ***
Library Selenium2Library
Library Testclass.py
Library FirstJavaProgram.class


*** Test Cases ***

My Test

FirstJavaProgram.test1


**************robot file end*******************************

My Java class file name --> FirstJavaprogram.java

code snippet as below
-----------------------------

import java.io.File ;


public class FirstJavaProgram {
public static final String ROBOT_LIBRARY_SCOPE = "GLOBAL";
public void test1()
{
System.out.println("test program");
}
public static void main (String[] args) {
System.out.println("This is my first program in java");
}//End of main
}//End of FirstJavaProgram Class


when I run the above robot file it throws following error:

[ ERROR ] Error in file 'C:\Project_Folder\DAP_TEST\exampletest\javawithrobot\src\example.robot': Importing test library 'FirstJavaProgram.jar' failed: ImportError: No module named FirstJavaProgram
Traceback (most recent call last):

==============================================================================
Example                                                                       
==============================================================================
My Test                                                               | FAIL |
No keyword with name 'FirstJavaProgram.test1' found.
------------------------------------------------------------------------------
Example                                                               | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed


Reply all
Reply to author
Forward
0 new messages