Java 当我的测试运行时,我可以将信息发送到selenium的testrail吗

Java 当我的测试运行时,我可以将信息发送到selenium的testrail吗,java,selenium,testing,automated-tests,testrail,Java,Selenium,Testing,Automated Tests,Testrail,我试图将测试从selenium发送到testrail,但我没有使用断言来结束测试,我只是希望它在运行到完成时通过?这可能吗?代码中是否也有这样的例子?我目前有: public class login_errors extends ConditionsWebDriverFactory { public static String TEST_RUN_ID = "R1713"; public static String TESTRAIL_USERNAME

我试图将测试从selenium发送到testrail,但我没有使用断言来结束测试,我只是希望它在运行到完成时通过?这可能吗?代码中是否也有这样的例子?我目前有:

public class login_errors extends ConditionsWebDriverFactory {

    public static String TEST_RUN_ID                = "R1713";
    public static String TESTRAIL_USERNAME          = "f2009@hotmail.com";
    public static String TESTRAIL_PASSWORD          = "Password100";
    public static String RAILS_ENGINE_URL           = "https://testdec.testrail.com/";
    public static final int TEST_CASE_PASSED_STATUS = 1;
    public static final int TEST_CASE_FAILED_STATUS = 5;


    @Test
    public void login_errors() throws IOException, APIException {
        Header header = new Header();
        header.guest_select_login();
        Pages.Login login = new Pages.Login();
        login.login_with_empty_fields();
        login.login_with_invalid_email();
        login.email_or_password_incorrect();
        login.login_open_and_close();
        login_errors.addResultForTestCase("T65013",TEST_CASE_PASSED_STATUS," ");

    }
    public static void addResultForTestCase(String testCaseId, int status,
                                            String error) throws IOException, APIException {

        String testRunId = TEST_RUN_ID;

        APIClient client = new APIClient(RAILS_ENGINE_URL);
        client.setUser(TESTRAIL_USERNAME);
        client.setPassword(TESTRAIL_PASSWORD);
        Map data = new HashMap();
        data.put("status_id", status);
        data.put("comment", "Test Executed - Status updated automatically from Selenium test automation.");
        client.sendPost("add_result_for_case/"+testRunId+"/"+testCaseId+"",data );

    }

}

我从这段代码中获得401状态。

只需将addResultForTestCase方法放在运行结束时。确保使用的是测试用例而不是运行id。您当前使用的id不正确