Java 为什么要打印一些变量?

Java 为什么要打印一些变量?,java,cucumber,Java,Cucumber,我是一名.net开发人员,现在对Java的了解几乎为0到0(在20年没有使用Java之后) 然而,我刚刚得到了另一个团队使用的Cumber项目(该团队不再有java开发人员,也不打算在将来雇佣任何开发人员) 我能理解Cucumber在做什么,但有些细节我无法理解 例如,对于此功能 @ChargesAPI Scenario Outline: ChargesAPI project - Compare ChargesV2 VS ChargesV3 POST JSON Message Give

我是一名.net开发人员,现在对Java的了解几乎为0到0(在20年没有使用Java之后)

然而,我刚刚得到了另一个团队使用的Cumber项目(该团队不再有java开发人员,也不打算在将来雇佣任何开发人员)

我能理解Cucumber在做什么,但有些细节我无法理解

例如,对于此功能

@ChargesAPI
 Scenario Outline: ChargesAPI project - Compare ChargesV2 VS ChargesV3 POST JSON Message
    Given As a user i want to compare sheet ChargesAPI ChargesV2VsChargesV3 POST JSON output Message
    When I POST given first <Iteration> URL DP:URI_1 and Json body DP:JSON_Message_1 content
    And I POST given second <Iteration> URL DP:URI_2 and Json body DP:JSON_Message_2 content
    Then I Compare both Output_Mess1 Output_Mess2 Output Message <Iteration>
  Examples:
 |Iteration|   
|1|
|2|
|3|
|4|
|5|
|6|
|7|
|8|
|9|
|10|
|11|
|12|
|13|
|14|
|15|
我想在out PostMethods.java中打印参数详细信息(基本上尝试打印一些调试信息)

但是,打印始终返回以下内容: strURL:DP:URI\u 1 JSONBody:DP:JSON\u Message\u 1

看来cucumber有办法将DP:URI_1和DP:JSON_Message_1替换为真实的url和消息


我只是想找到一种方法来打印这个代码发送的url和消息,有什么方法吗?

如果你需要用API付费,最好使用空手道。我想说,这不是一个真正相关的评论
public class POSTJSON_Steps {

    private ActionContainer actcontainer;

    public POSTJSON_Steps(ActionContainer actcontainer) {
        this.actcontainer = actcontainer;
    }

    private String First_Mess;
    private String Second_Mess;

    @When("^I POST given first (.*) URL (.*) and Json body (.*) content")
    public void I_POST_first_URL_and_JsonBody_content(int Itr,String strURI, String JSON) throws Exception {

        First_Mess = actcontainer.postmethods.ThunderPostMethod(Itr,strURI,JSON);
    }

    @And("^I POST given second (.*) URL (.*) and Json body (.*) content")
    public void I_POST_second_URL_and_JsonBody_content(int Itr,String strURI, String JSON) throws Exception {
        Second_Mess = actcontainer.postmethods.ThunderPostMethod(Itr,strURI,JSON);

    }

    @Then("^I Compare both (.*) (.*) Output Message (.*)$")
    public void I_Compare_QA_VS_Staging_Output_Message(String strFstJSON, String strSndJSON,int Itr) throws Exception {

        actcontainer.storedata.StoreJSONMessAsJson(Itr,strFstJSON,strSndJSON, First_Mess,Second_Mess);   
        actcontainer.comparedata.CompareJSONOutput(Itr,First_Mess, Second_Mess);    
    }

}
public class POSTMethods {

    public String ThunderPostMethod(int itr,String strURL, String JSONBody) throws Exception {

        String strContent = null;
        strContent = RESTClient.POSTREQUEST(itr, strURL, JSONBody, "Authorization/Bearer "+TokenGenerate.AuthToken());

    System.out.println("strContent:"+strContent);
    System.out.println("strURL:"+strURL);
    System.out.println("JSONBody:"+JSONBody);

        strContent = PostJSONSorting.POST_JSONValue(strContent,itr,strURL, JSONBody);
        return strContent;
    }

}