本文整理汇总了Java中org.testng.Reporter.log方法的典型用法代码示例。如果您正苦于以下问题:Java Reporter.log方法的具体用法?Java Reporter.log怎么用?Java Reporter.log使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.testng.Reporter
的用法示例。
在下文中一共展示了Reporter.log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: verifyInjectedRawTokenStandard
import org.testng.Reporter; //导入方法依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI,
description = "Verify that the injected raw token claim using @Claim(standard) is as expected")
public void verifyInjectedRawTokenStandard() throws Exception {
Reporter.log("Begin verifyInjectedRawTokenStandard\n");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedRawTokenStandard";
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"));
}
示例2: verifyInjectedCustomDouble2
import org.testng.Reporter; //导入方法依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_PROVIDER,
description = "Verify that the injected customDouble claim is as expected")
public void verifyInjectedCustomDouble2() throws Exception {
Reporter.log("Begin verifyInjectedCustomDouble\n");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedCustomDouble";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam("value", 3.141592653589793)
.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"));
}
示例3: verifyInjectedAuthTime
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 verifyInjectedAuthTime() throws Exception {
Reporter.log("Begin verifyInjectedAuthTime\n");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedAuthTime";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.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: verifyExpiration
import org.testng.Reporter; //导入方法依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_JWT,
description = "Verify that the exp claim is as expected")
public void verifyExpiration() throws Exception {
Reporter.log("Begin verifyExpiration\n");
String uri = baseURL.toExternalForm() + "/endp/verifyExpiration";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam(Claims.exp.name(), expClaim)
.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: verifyInjectedOptionalSubject2
import org.testng.Reporter; //导入方法依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_PROVIDER,
description = "Verify that the injected sub claim is as expected")
public void verifyInjectedOptionalSubject2() 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"));
}
示例6: verifyInjectedIssuedAt2
import org.testng.Reporter; //导入方法依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_JSON,
description = "Verify that the injected iat claim is as expected from Token2")
public void verifyInjectedIssuedAt2() throws Exception {
Reporter.log("Begin verifyInjectedIssuedAt2\n");
HashMap<String, Long> timeClaims = new HashMap<>();
String token2 = TokenUtils.generateTokenString("/Token2.json", null, timeClaims);
Long iatClaim = timeClaims.get(Claims.auth_time.name());
Long authTimeClaim = timeClaims.get(Claims.auth_time.name());
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 " + token2).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"));
}
示例7: verifyIssuerClaim2
import org.testng.Reporter; //导入方法依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_PROVIDER,
description = "Verify that the injected token issuer claim is as expected")
public void verifyIssuerClaim2() 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"));
}
示例8: verifyInjectedOptionalAuthTime2
import org.testng.Reporter; //导入方法依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_PROVIDER,
description = "Verify that the injected raw token claim is as expected")
public void verifyInjectedOptionalAuthTime2() throws Exception {
Reporter.log("Begin verifyInjectedOptionalAuthTime\n");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedOptionalAuthTime";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.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: verifyInjectedUPN
import org.testng.Reporter; //导入方法依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_PROVIDER,
description = "Verify that the injected upn claim is as expected")
public void verifyInjectedUPN() throws Exception {
Reporter.log("Begin verifyInjectedUPN\n");
String uri = baseURL.toExternalForm() + "/endp/verifyInjectedUPN";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam(Claims.upn.name(), "[email protected]")
.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: 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"));
}
示例11: verifyInjectedAudience2
import org.testng.Reporter; //导入方法依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_CDI_PROVIDER,
description = "Verify that the injected aud claim is as expected")
public void verifyInjectedAudience2() 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"));
}
示例12: callHeartbeat
import org.testng.Reporter; //导入方法依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_JAXRS,
description = "Validate a request without an MP-JWT to unsecured endpoint has HTTP_OK with expected response")
public void callHeartbeat() throws Exception {
Reporter.log("callHeartbeat, expect HTTP_OK");
String uri = baseURL.toExternalForm() + "/endp/heartbeat";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam("input", "hello")
;
Response response = echoEndpointTarget.request(TEXT_PLAIN).get();
Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_OK);
String reply = response.readEntity(String.class);
Assert.assertTrue(reply.startsWith("Heartbeat:"), "Saw Heartbeat: ...");
}
示例13: echoWithToken2
import org.testng.Reporter; //导入方法依赖的package包/类
@RunAsClient
@Test(groups = TEST_GROUP_JAXRS, description = "Validate a request with MP-JWT Token2 calling echo fails with HTTP_FORBIDDEN")
public void echoWithToken2() throws Exception {
Reporter.log("echoWithToken2, expect HTTP_FORBIDDEN");
String token2 = TokenUtils.generateTokenString("/Token2.json");
String uri = baseURL.toExternalForm() + "/endp/echo";
WebTarget echoEndpointTarget = ClientBuilder.newClient()
.target(uri)
.queryParam("input", "hello")
;
Response response = echoEndpointTarget.request(TEXT_PLAIN).header(HttpHeaders.AUTHORIZATION, "Bearer "+token2).get();
String reply = response.readEntity(String.class);
Assert.assertEquals(response.getStatus(), HttpURLConnection.HTTP_FORBIDDEN);
}
示例14: retry
import org.testng.Reporter; //导入方法依赖的package包/类
@Override
public boolean retry(ITestResult result) {
if (retryCount <= maxRetryCount) {
String message = "Retry for [" + result.getName() + "] on class [" + result.getTestClass().getName() + "] Retry "
+ retryCount + " times";
logger.info(message);
Reporter.setCurrentTestResult(result);
Reporter.log("RunCount=" + (retryCount + 1));
retryCount++;
return true;
}
return false;
}
示例15: onTestFailure
import org.testng.Reporter; //导入方法依赖的package包/类
/**
* Take screenshot in case of test failure.
*/
@Override
public void onTestFailure(ITestResult tr)
{
super.onTestFailure(tr);
WebDriver webDriver = findWebDriverByReflection(tr);
if (webDriver == null)
{
LOGGER.debug(String
.format("The test class '%s' does not have any field of type 'org.openqa.selenium.WebDriver'. "
+ "ScreenshotTestListener can not continue.", tr.getTestClass().getName()));
return;
}
File f = ((TakesScreenshot) webDriver).getScreenshotAs(OutputType.FILE);
Format formatter = new SimpleDateFormat("dd_MMM_hh_mm_ss");
String timestamp = formatter.format(new Date());
String fileName = tr.getTestClass().getRealClass().getSimpleName() + "_" + timestamp + ".png";
Path screenshotPath = null;
try
{
screenshotPath = Paths.get(currentDir, "target", fileName);
LOGGER.info("copying failure screenshot file '" + fileName + "' to '" + screenshotPath + "'");
Files.copy(f.toPath(), screenshotPath, StandardCopyOption.REPLACE_EXISTING);
Reporter.log("[Console Log] Screenshot saved in " + screenshotPath);
} catch (IOException e)
{
LOGGER.debug("Error during the screenshot copy file operation:" + e.getMessage());
}
}