本文整理汇总了Java中org.testng.Reporter类的典型用法代码示例。如果您正苦于以下问题:Java Reporter类的具体用法?Java Reporter怎么用?Java Reporter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Reporter类属于org.testng包,在下文中一共展示了Reporter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyInjectedJTI2
import org.testng.Reporter; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_PROVIDER,
description = "Verify that the injected jti claim is as expected")
public void verifyInjectedJTI2() throws Exception {
Reporter.log("Begin verifyInjectedJTI\n");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedJTI";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam(Claims.jti.name(), "a-123")
.queryParam(Claims.auth_time.name(), authTimeClaim);
Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
String replyString = response.readEntity(String.class);
JsonReader jsonReader = Json.createReader(new StringReader(replyString));
JsonObject reply = jsonReader.readObject();
Reporter.log(reply.toString());
Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
示例2: captureScreenshot
import org.testng.Reporter; //导入依赖的package包/类
/**
* This method captures a screenshot
**/
public static void captureScreenshot(WebDriver driver, String screenshotName) {
try {
TakesScreenshot ts = (TakesScreenshot) driver;
File source = ts.getScreenshotAs(OutputType.FILE);
FileUtils.copyFile(source, new File(dirPath + "/ " + screenshotName
+ "_" + strDateStamp
+ ".png"));
String ESCAPE_PROPERTY = "org.uncommons.reportng.escape-output";
System.setProperty(ESCAPE_PROPERTY, "false");
URL path = new File(dirPath + "/ " + screenshotName + "_"
+ strDateStamp + ".png").toURI().toURL();
String test = "<a href=" + path + "> click to open screenshot of "
+ screenshotName + "</a>";
Reporter.log(screenshotName + test + "<br>");
Reporter.log("<br>");
}
catch (Exception e) {
System.out.println("Exception while taking screenshot "
+ e.getMessage());
}
}
示例3: verifyInjectedSubjectStandard
import org.testng.Reporter; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI,
description = "Verify that the injected sub claim using @Claim(standard) is as expected")
public void verifyInjectedSubjectStandard() throws Exception {
Reporter.log("Begin verifyInjectedSubjectStandard\n");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedSubjectStandard";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam(Claims.sub.name(), "24400320")
.queryParam(Claims.auth_time.name(), authTimeClaim);
Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
String replyString = response.readEntity(String.class);
JsonReader jsonReader = Json.createReader(new StringReader(replyString));
JsonObject reply = jsonReader.readObject();
Reporter.log(reply.toString());
Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
示例4: verifyInjectedIssuedAt
import org.testng.Reporter; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI,
description = "Verify that the injected iat claim is as expected")
public void verifyInjectedIssuedAt() throws Exception {
Reporter.log("Begin verifyInjectedIssuedAt\n");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedIssuedAt";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam(Claims.iat.name(), iatClaim)
.queryParam(Claims.auth_time.name(), authTimeClaim);
Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
String replyString = response.readEntity(String.class);
JsonReader jsonReader = Json.createReader(new StringReader(replyString));
JsonObject reply = jsonReader.readObject();
Reporter.log(reply.toString());
Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
示例5: set
import org.testng.Reporter; //导入依赖的package包/类
/**
* Store the specified object in the attributes collection.
*
* @param obj object to be stored; 'null' to discard value
* @return (optional) specified object
*/
private <T> Optional<T> set(T obj) {
ITestResult result = Reporter.getCurrentTestResult();
Optional<T> val = TestBase.optionalOf(obj);
result.setAttribute(key, val);
return val;
}
示例6: verifyInjectedAudienceStandard
import org.testng.Reporter; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI,
description = "Verify that the injected aud claim using @Claim(standard) is as expected")
public void verifyInjectedAudienceStandard() throws Exception {
Reporter.log("Begin verifyInjectedAudienceStandard\n");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedAudienceStandard";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam(Claims.aud.name(), "s6BhdRkqt3")
.queryParam(Claims.auth_time.name(), authTimeClaim);
Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
String replyString = response.readEntity(String.class);
JsonReader jsonReader = Json.createReader(new StringReader(replyString));
JsonObject reply = jsonReader.readObject();
System.out.println(reply);
Reporter.log(reply.toString());
Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
示例7: callEchoBASIC
import org.testng.Reporter; //导入依赖的package包/类
@RunAsClient
@Test(groups = TCKConstants.TEST_GROUP_JAXRS,
description = "Attempting access with BASIC auth header should fail with HTTP_UNAUTHORIZED")
public void callEchoBASIC() throws Exception {
Reporter.log("callEchoBASIC, expect HTTP_UNAUTHORIZED");
byte[] tokenb = Base64.getEncoder().encode("[email protected]:password".getBytes());
String token = new String(tokenb);
System.out.printf("basic: %s\n", token);
String uri = baseURL.toExternalForm() + "/endp/echo";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam("input", "hello")
;
Response response = echoEndpointTarget.request(TEXT_PLAIN).header(HttpHeaders.AUTHORIZATION, "BASIC "+token).get();
Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_UNAUTHORIZED);
String reply = response.readEntity(String.class);
System.out.println(reply);
}
示例8: verifyInjectedJTI
import org.testng.Reporter; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI,
description = "Verify that the injected jti claim is as expected")
public void verifyInjectedJTI() throws Exception {
Reporter.log("Begin verifyInjectedJTI\n");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedJTI";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam(Claims.jti.name(), "a-123")
.queryParam(Claims.auth_time.name(), authTimeClaim);
Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
String replyString = response.readEntity(String.class);
JsonReader jsonReader = Json.createReader(new StringReader(replyString));
JsonObject reply = jsonReader.readObject();
Reporter.log(reply.toString());
Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
示例9: verifyInjectedOptionalSubject
import org.testng.Reporter; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI,
description = "Verify that the injected sub claim is as expected")
public void verifyInjectedOptionalSubject() throws Exception {
Reporter.log("Begin verifyInjectedOptionalSubject\n");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedOptionalSubject";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam(Claims.sub.name(), "24400320")
.queryParam(Claims.auth_time.name(), authTimeClaim);
Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
String replyString = response.readEntity(String.class);
JsonReader jsonReader = Json.createReader(new StringReader(replyString));
JsonObject reply = jsonReader.readObject();
Reporter.log(reply.toString());
Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
示例10: verifyIssuerClaim
import org.testng.Reporter; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_JSON,
description = "Verify that the injected token issuer claim is as expected")
public void verifyIssuerClaim() throws Exception {
Reporter.log("Begin verifyIssuerClaim");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedIssuer";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam(Claims.iss.name(), TCKConstants.TEST_ISSUER)
.queryParam(Claims.auth_time.name(), authTimeClaim);
Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
String replyString = response.readEntity(String.class);
JsonReader jsonReader = Json.createReader(new StringReader(replyString));
JsonObject reply = jsonReader.readObject();
Reporter.log(reply.toString());
Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
示例11: verifyInjectedRawToken
import org.testng.Reporter; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_JSON,
description = "Verify that the injected raw token claim is as expected")
public void verifyInjectedRawToken() throws Exception {
Reporter.log("Begin verifyInjectedRawToken\n");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedRawToken";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam(Claims.raw_token.name(), token)
.queryParam(Claims.auth_time.name(), authTimeClaim);
Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
String replyString = response.readEntity(String.class);
JsonReader jsonReader = Json.createReader(new StringReader(replyString));
JsonObject reply = jsonReader.readObject();
Reporter.log(reply.toString());
Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
示例12: verifyInjectedCustomString
import org.testng.Reporter; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI,
description = "Verify that the injected customString claim is as expected")
public void verifyInjectedCustomString() throws Exception {
Reporter.log("Begin verifyInjectedCustomString\n");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedCustomString";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam("value", "customStringValue")
.queryParam(Claims.auth_time.name(), authTimeClaim);
Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
String replyString = response.readEntity(String.class);
JsonReader jsonReader = Json.createReader(new StringReader(replyString));
JsonObject reply = jsonReader.readObject();
Reporter.log(reply.toString());
Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
示例13: verifyInjectedAudience
import org.testng.Reporter; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_JSON,
description = "Verify that the injected aud claim is as expected")
public void verifyInjectedAudience() throws Exception {
Reporter.log("Begin verifyInjectedAudience\n");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedAudience";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam(Claims.aud.name(), "s6BhdRkqt3")
.queryParam(Claims.auth_time.name(), authTimeClaim);
Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
String replyString = response.readEntity(String.class);
JsonReader jsonReader = Json.createReader(new StringReader(replyString));
JsonObject reply = jsonReader.readObject();
Reporter.log(reply.toString());
Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
示例14: verifyInjectedIssuedAt
import org.testng.Reporter; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_JSON,
description = "Verify that the injected iat claim is as expected")
public void verifyInjectedIssuedAt() throws Exception {
Reporter.log("Begin verifyInjectedIssuedAt\n");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedIssuedAt";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam(Claims.iat.name(), iatClaim)
.queryParam(Claims.auth_time.name(), authTimeClaim);
Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
String replyString = response.readEntity(String.class);
JsonReader jsonReader = Json.createReader(new StringReader(replyString));
JsonObject reply = jsonReader.readObject();
Reporter.log(reply.toString());
Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}
示例15: verifyInjectedCustomString
import org.testng.Reporter; //导入依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_JSON,
description = "Verify that the injected customString claim is as expected")
public void verifyInjectedCustomString() throws Exception {
Reporter.log("Begin verifyInjectedCustomString\n");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedCustomString";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam("value", "customStringValue")
.queryParam(Claims.auth_time.name(), authTimeClaim);
Response response = echoEndpointTarget.request(MediaType.APPLICATION_JSON).header(HttpHeaders.AUTHORIZATION, "Bearer " + token).get();
Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
String replyString = response.readEntity(String.class);
JsonReader jsonReader = Json.createReader(new StringReader(replyString));
JsonObject reply = jsonReader.readObject();
Reporter.log(reply.toString());
Assert.assertTrue(reply.getBoolean("pass"), reply.getString("msg"));
}