當前位置: 首頁>>代碼示例>>Java>>正文


Java Reporter類代碼示例

本文整理匯總了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"));
}
 
開發者ID:eclipse,項目名稱:microprofile-jwt-auth,代碼行數:19,代碼來源:ProviderInjectionTest.java

示例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());
	}
}
 
開發者ID:AnujDasari,項目名稱:Actitime-Framework,代碼行數:27,代碼來源:ReportNGReport.java

示例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"));
}
 
開發者ID:eclipse,項目名稱:microprofile-jwt-auth,代碼行數:19,代碼來源:ClaimValueInjectionTest.java

示例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"));
}
 
開發者ID:eclipse,項目名稱:microprofile-jwt-auth,代碼行數:19,代碼來源:ClaimValueInjectionTest.java

示例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;
}
 
開發者ID:Nordstrom,項目名稱:Selenium-Foundation,代碼行數:13,代碼來源:TestNgBase.java

示例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"));
}
 
開發者ID:eclipse,項目名稱:microprofile-jwt-auth,代碼行數:20,代碼來源:ClaimValueInjectionTest.java

示例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);
}
 
開發者ID:eclipse,項目名稱:microprofile-jwt-auth,代碼行數:20,代碼來源:RolesAllowedTest.java

示例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"));
}
 
開發者ID:eclipse,項目名稱:microprofile-jwt-auth,代碼行數:19,代碼來源:ClaimValueInjectionTest.java

示例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"));
}
 
開發者ID:eclipse,項目名稱:microprofile-jwt-auth,代碼行數:19,代碼來源:ClaimValueInjectionTest.java

示例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"));
}
 
開發者ID:eclipse,項目名稱:microprofile-jwt-auth,代碼行數:19,代碼來源:JsonValueInjectionTest.java

示例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"));
}
 
開發者ID:eclipse,項目名稱:microprofile-jwt-auth,代碼行數:19,代碼來源:JsonValueInjectionTest.java

示例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"));
}
 
開發者ID:eclipse,項目名稱:microprofile-jwt-auth,代碼行數:19,代碼來源:ClaimValueInjectionTest.java

示例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"));
}
 
開發者ID:eclipse,項目名稱:microprofile-jwt-auth,代碼行數:19,代碼來源:JsonValueInjectionTest.java

示例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"));
}
 
開發者ID:eclipse,項目名稱:microprofile-jwt-auth,代碼行數:19,代碼來源:JsonValueInjectionTest.java

示例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"));
}
 
開發者ID:eclipse,項目名稱:microprofile-jwt-auth,代碼行數:19,代碼來源:JsonValueInjectionTest.java


注:本文中的org.testng.Reporter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。