【发布时间】:2016-09-22 11:22:51
【问题描述】:
请考虑下面的代码,
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-console(chrome 插件)进行休息后请求。 我做错了什么?
我希望能在这方面得到一些帮助。我是放心测试的新手。
【问题讨论】:
标签: java jira jira-rest-api rest-assured