请告诉我如何将以下机器人(txt)代码转换为 Python 代码。机器人代码。
*** Settings ***
Library OperatingSystem
*** Keywords ***
nik_key_1
[Arguments] ${arg1_str}
log to console ${arg1_str}
*** Variables ***
${var1} "variable1"
*** Test Cases ***
First Test Case
${output}= run "hostname"
log to console ${output}
${str1}= catenate "nikhil" "gupta"
nik_key_1 "NikArg1"
log to console ${var1}
log to console ${str1}
Run Code Online (Sandbox Code Playgroud)
以下是我尝试的代码:
from robot.api import TestSuite
from robot.running.model import Keyword
from robot.libraries.BuiltIn import BuiltIn
from robot.api.deco import keyword
bi = BuiltIn()
@keyword(name='nik_key_1')
def nik_key_1(username):
bi.log_to_console(message=username,stream='STDOUT',no_newline=False)
suite = TestSuite('Activate Skynet')
suite.resource.imports.library("OperatingSystem") …
Run Code Online (Sandbox Code Playgroud)