简体   繁体   English

将Java .jar包含到RobotFramework中

[英]Including Java .jar into RobotFramework

I am new at testing. 我是测试新手。 I have a jar-file. 我有一个jar文件。 There are two classes. 有两节课。 First class A which has method f(), second has class Main where I have main method and in this method I create the instanse of A and can use method f. 第一个类A具有方法f(),第二个类Main具有我的main方法,在这种方法中,我创建了A的实例并可以使用方法f。 I want to write test for this method, but I don't know how to use this method in RobotFramework. 我想为此方法编写测试,但我不知道如何在RobotFramework中使用此方法。 I want to make it with command line, without plugins. 我想用命令行,没有插件。 Can you advice something? 你能建议些什么吗? PS Also I have Test.robot PS也我有Test.robot

Yes, I'll try to explain. 是的,我会尽力解释。 As example of my case. 以我的情况为例。 I have .jar where in package "my.package" I have class A with public method ' 我有.jar包“ my.package”中的类,带有公共方法的类A

public String f(String name){
       return ("Hello " + name);
}

' And with robotframework I need to make simple test. 通过机器人框架,我需要进行简单的测试。 There was question: How to use method in this framework. 有一个问题:如何在此框架中使用方法。 1. I need to write in 1.我需要写信

*** Settings ***
Library    my.package.A
  1. After it the "f" becomes key word and we can use it in *** Test Cases *** as f John 之后,“ f”成为关键字,我们可以在*** Test Cases ***中将其用作f John
  2. We need to write our .jar in class path as ' java -cp C:\\.....\\test-method.jar ' 我们需要在类路径中将.jar编写为' java -cp C:\\.....\\test-method.jar '
  3. Execute test.robot file. 执行test.robot文件。 P/S Sorry for my English P / S对不起,我的英语

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM