0
請考慮下面的代碼,休息保證的JIRA的Java無法得到響應
import org.junit.Test;
import org.omg.CORBA.Request;
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.response.Response;
import static com.jayway.restassured.RestAssured.*;
import static org.hamcrest.Matchers.*;
public class App
{
@Test
public void loginAuthentication()
{
RestAssured.authentication = basic("username", "password");
Response resp = given().
contentType("application/x-www-form-urlencoded").
when().
post("https://unitrends.atlassian.net/login?username=Gayatri.londhe&password=GayatriA4");
System.out.println(resp.prettyPrint());
}
}
我得到如下回應,
<div class="aui-message error">
<span class="aui-icon icon-error"/>
<span class="error" id="error-authentication_failure_invalid_credentials">
Sorry, we didn't recognize that username and password combination. Please double-check and try again.
</span>
</div>
如何使用驗證休息,放心,我我可以使用REST控制檯(chrome插件)做休息發佈請求。 我在做什麼錯?
我希望能在這方面得到一些幫助。我是新來的放心測試。
測試運行成功, 我想從響應中提取atl_Token。我怎樣才能做到這一點? –
以及爲什麼我沒有看到這個api打到小提琴手? –
'String output = response.getBody()。asString(); System.out.println(輸出); JSONObject obj = new JSONObject(output); String status = String.valueOf(obj.get(「」)); } ' 你可以使用這個..這個令牌是作爲頭髮送? –