测试轨道API绑定 - 无法识别的响应代码(308)

时间:2018-04-11 06:41:24

标签: java automation testrail

测试铁路API绑定 - 无法识别的响应代码(308)

我是测试轨道的新手,我开始实施自动化基础设施,将自动化测试结果同步到Test Rail服务器。 我正在使用Java,这是代码片段......

WITH cte AS (
    SELECT NULL AS Visitors, D.DATE AS Day
    FROM Database.support.dates D
    WHERE D.DATE BETWEEN @Start_date AND @End_date

    UNION

    SELECT COUNT(V.id), DATEADD(day, 0, DATEDIFF(day, 0, V.CreateTime))
    FROM Database.Clients.Clients V
    WHERE V.CreateTime BETWEEN @Start_date AND @End_date AND
        V.WADID = @WADID AND (V.WAPID = @WAPID OR @WAPID IS NULL)
    GROUP BY DATEADD(day, 0, DATEDIFF(day, 0, V.CreateTime))
)

SELECT Day, MAX(Visitors) AS Visitors     -- filter off unwanted NULL values
FROM cte
GROUP BY Day
ORDER BY Day DESC;

我得到的例外:

package com.util.testrail;

import com.util.log.ColorLog;
import com.util.testrail.APIClient;
import com.util.testrail.APIException;
import java.util.Map;
import java.util.HashMap;
import org.json.simple.JSONObject;

public class Program
{
    public static void main(String[] args) throws Exception
    {
        APIClient client = new APIClient("http://ect.testrail.io/");
        client.setUser("asih@evercompliant.com");
        client.setPassword("asi1234$");

        Map data = new HashMap();
        data.put("status_id", new Integer(1));
        data.put("comment", "This test worked fine!");
        JSONObject r = (JSONObject) client.sendPost("add_result_for_case/1/1", 
        data);

        JSONObject c = (JSONObject) client.sendGet("get_case/1");
        System.out.println(c.get("title"));


    }
}

1 个答案:

答案 0 :(得分:0)

问题实际上是您尝试使用http://而不是https://,从而导致重定向。请确保使用正确的HTTPS地址:https://seleniumautomation.testrail.net/