나는 2 개의 클래스를 갖는 파이썬 모듈을 가지고있다. 각 클래스에는 일련의 함수 또는 메소드가 정의되어 있습니다. 어떻게 ROBOT 프레임 워크의 클래스에서 특정 메소드를 호출 할 수 있습니까? 나는 아래의 방법을 시도하지만, 그 다음과 같은 오류를주는. 누군가가 나를 통해 문제를 파악하는 데 도움을 줄 수 있습니까? 파이썬 모듈과 로봇 파일은 같은 경로에 있습니다. 라이브러리 문을 CheckCode.employee WITH_NAME xyz로 변경하려고했습니다. 이것은 도움이되지 못했습니다. 감사.ROBOT 프레임 워크의 파이썬 모듈에서 특정 메소드 호출하기
ERRORS
==============
[ WARN ] Imported library '/homes/user/New/CheckCode.py' contains no keywords.
==============================================================================
CheckCode :: Checking small built in code
==============================================================================
Verify we can call a particular class from a Python Module in Robot | FAIL |
No keyword with name 'my_code.employee.staff info' found.
------------------------------------------------------------------------------
CheckCode :: Checking small built in code | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Python Module File output
******************************
import re
import collections
import math
class person():
def __init__(self,first,last):
self.firstname = first
self.lastname = last
def emp_name(self):
return self.firstname + " " + self.lastname
class employee(person):
def __init__(self,first,last,empId):
person.__init__(self,first,last)
self.staffId = empId
def staff_info(self):
return self.Name() + " " + self.staffId
ROBOT FILE
******************************
*** Settings ***
Documentation Checking small built in code
Library BuiltIn
Library Collections
Library CheckCode.py WITH NAME my_code
*** Test Cases ***
Verify we can call a particular class from a Python Module in Robot
Log Hello World
${var} = my_code.employee.staff info Maggi Nestle 20000
*** Keywords ***
Init
Set Log Level DEBUG
답변 해 주셔서 감사합니다. PYTHONPATH 메서드를 좀 더 살펴보고 질문이 있으면 다시 돌아 오도록하겠습니다. – user2905950
질문에 대답하려고했지만 Bryan의 답변을 살펴 보시기 바랍니다. 나는 코드가 어떻게 구성되어야하는지에 대한 그의 평가에 동의한다. – ombre42