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


Java TestNG.setVerbose方法代碼示例

本文整理匯總了Java中org.testng.TestNG.setVerbose方法的典型用法代碼示例。如果您正苦於以下問題:Java TestNG.setVerbose方法的具體用法?Java TestNG.setVerbose怎麽用?Java TestNG.setVerbose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.testng.TestNG的用法示例。


在下文中一共展示了TestNG.setVerbose方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: runTestAndAssertCounters

import org.testng.TestNG; //導入方法依賴的package包/類
@Test
public void runTestAndAssertCounters() throws Exception {
	final TrackingTestNGTestListener listener = new TrackingTestNGTestListener();
	final TestNG testNG = new TestNG();
	testNG.addListener(listener);
	testNG.setTestClasses(new Class<?>[] { this.clazz });
	testNG.setVerbose(0);
	testNG.run();

	assertEquals("Verifying number of test starts for test class [" + this.clazz + "].",
		this.expectedTestStartCount, listener.testStartCount);
	assertEquals("Verifying number of successful tests for test class [" + this.clazz + "].",
		this.expectedTestSuccessCount, listener.testSuccessCount);
	assertEquals("Verifying number of failures for test class [" + this.clazz + "].", this.expectedFailureCount,
		listener.testFailureCount);
	assertEquals("Verifying number of failed configurations for test class [" + this.clazz + "].",
		this.expectedFailedConfigurationsCount, listener.failedConfigurationsCount);
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:19,代碼來源:FailingBeforeAndAfterMethodsTestNGTests.java

示例2: runTestClassAndAssertStats

import org.testng.TestNG; //導入方法依賴的package包/類
private void runTestClassAndAssertStats(Class<?> testClass, int expectedTestCount) {
	final int expectedTestFailureCount = 0;
	final int expectedTestStartedCount = expectedTestCount;
	final int expectedTestFinishedCount = expectedTestCount;

	final TrackingTestNGTestListener listener = new TrackingTestNGTestListener();
	final TestNG testNG = new TestNG();
	testNG.addListener(listener);
	testNG.setTestClasses(new Class<?>[] { testClass });
	testNG.setVerbose(0);
	testNG.run();

	assertEquals("Failures for test class [" + testClass + "].", expectedTestFailureCount,
		listener.testFailureCount);
	assertEquals("Tests started for test class [" + testClass + "].", expectedTestStartedCount,
		listener.testStartCount);
	assertEquals("Successful tests for test class [" + testClass + "].", expectedTestFinishedCount,
		listener.testSuccessCount);
}
 
開發者ID:langtianya,項目名稱:spring4-understanding,代碼行數:20,代碼來源:ClassLevelDirtiesContextTestNGTests.java

示例3: runTestAndAssertCounters

import org.testng.TestNG; //導入方法依賴的package包/類
@Test
public void runTestAndAssertCounters() throws Exception {
	final FailureTrackingTestListener listener = new FailureTrackingTestListener();
	final TestNG testNG = new TestNG();
	testNG.addListener(listener);
	testNG.setTestClasses(new Class<?>[] { this.clazz });
	testNG.setVerbose(0);
	testNG.run();

	assertEquals("Verifying number of test starts for test class [" + this.clazz + "].",
		this.expectedTestStartCount, listener.testStartCount);
	assertEquals("Verifying number of successful tests for test class [" + this.clazz + "].",
		this.expectedTestSuccessCount, listener.testSuccessCount);
	assertEquals("Verifying number of failures for test class [" + this.clazz + "].", this.expectedFailureCount,
		listener.testFailureCount);
	assertEquals("Verifying number of failed configurations for test class [" + this.clazz + "].",
		this.expectedFailedConfigurationsCount, listener.failedConfigurationsCount);
}
 
開發者ID:deathspeeder,項目名稱:class-guard,代碼行數:19,代碼來源:FailingBeforeAndAfterMethodsTests.java

示例4: runTests

import org.testng.TestNG; //導入方法依賴的package包/類
private void runTests() {
    TestNG testNg = new TestNG();
    testNg.setOutputDirectory(testReportDir.getAbsolutePath());
    testNg.setDefaultSuiteName(options.getDefaultSuiteName());
    testNg.setDefaultTestName(options.getDefaultTestName());
    testNg.setParallel(options.getParallel());
    testNg.setThreadCount(options.getThreadCount());
    invokeVerifiedMethod(testNg, "setConfigFailurePolicy", String.class, options.getConfigFailurePolicy(), TestNGOptions.DEFAULT_CONFIG_FAILURE_POLICY);
    invokeVerifiedMethod(testNg, "setPreserveOrder", boolean.class, options.getPreserveOrder(), false);
    invokeVerifiedMethod(testNg, "setGroupByInstances", boolean.class, options.getGroupByInstances(), false);
    testNg.setUseDefaultListeners(options.getUseDefaultListeners());
    testNg.setVerbose(0);
    testNg.setGroups(CollectionUtils.join(",", options.getIncludeGroups()));
    testNg.setExcludedGroups(CollectionUtils.join(",", options.getExcludeGroups()));

    //adding custom test listeners before Gradle's listeners.
    //this way, custom listeners are more powerful and, for example, they can change test status.
    for (String listenerClass : options.getListeners()) {
        try {
            testNg.addListener(applicationClassLoader.loadClass(listenerClass).newInstance());
        } catch (Throwable e) {
            throw new GradleException(String.format("Could not add a test listener with class '%s'.", listenerClass), e);
        }
    }

    if (!options.getIncludedTests().isEmpty()) {
        testNg.addListener(new SelectedTestsFilter(options.getIncludedTests()));
    }

    if (!suiteFiles.isEmpty()) {
        testNg.setTestSuites(GFileUtils.toPaths(suiteFiles));
    } else {
        testNg.setTestClasses(testClasses.toArray(new Class[0]));
    }
    testNg.addListener((Object) adaptListener(new TestNGTestResultProcessorAdapter(resultProcessor, idGenerator, timeProvider)));
    testNg.run();
}
 
開發者ID:lxxlxx888,項目名稱:Reer,代碼行數:38,代碼來源:TestNGTestClassProcessor.java

示例5: runTest

import org.testng.TestNG; //導入方法依賴的package包/類
protected void runTest( String outputFolder, Class theTest, SuiteContainer sC )
{
    int threadCount = Integer.parseInt( System.getProperty( "xF-ThreadCount", "10" ) );
    int verboseLevel = Integer.parseInt( System.getProperty( "xF-VerboseLevel", "10" ) );
    
    TestNG testNg = new TestNG( true );
    testNg.setVerbose( verboseLevel );
    testNg.setThreadCount( threadCount );
    testNg.setDataProviderThreadCount( threadCount );
    testNg.setOutputDirectory( outputFolder + System.getProperty( "file.separator" ) + "testNg" );
    testNg.setTestClasses( new Class[] { theTest } );
    testNg.run();

}
 
開發者ID:xframium,項目名稱:xframium-java,代碼行數:15,代碼來源:AbstractConfigurationReader.java

示例6: new_TestNG_with_failure_recorder_for

import org.testng.TestNG; //導入方法依賴的package包/類
private TestNG new_TestNG_with_failure_recorder_for(Class<?>... testNGClasses) {
    TestNG testNG = new TestNG();
    testNG.setVerbose(0);
    testNG.setUseDefaultListeners(false);
    testNG.addListener(failureRecorder);

    testNG.setTestClasses(testNGClasses);
    return testNG;
}
 
開發者ID:SpoonLabs,項目名稱:astor,代碼行數:10,代碼來源:TestNGShouldFailWhenMockitoListenerFailsTest.java

示例7: execute

import org.testng.TestNG; //導入方法依賴的package包/類
/**
 * Executes a test suite using the supplied test run arguments. The test run
 * arguments are expected to be contained in an XML properties document
 * structured as shown in the following example.
 * 
 * <pre>
 * {@code
 * <!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
 * <properties version="1.0">
 *   <comment>Test run arguments</comment>
 *   <entry key="arg1">atom-feed.xml</entry>
 *   <entry key="arg2">L2</entry>
 * </properties>
 * }
 * </pre>
 * 
 * <p>
 * <strong>Note:</strong>The actual arguments (key-value pairs) are
 * suite-specific.
 * </p>
 * 
 * @param testRunArgs
 *            A DOM Document node that contains a set of XML properties.
 * @return A Source object that provides an XML representation of the test
 *         results.
 */
@Override
public Source execute(Document testRunArgs) {
    if (null == testRunArgs) {
        throw new IllegalArgumentException("No test run arguments were supplied.");
    }
    TestNG driver = new TestNG();
    setTestSuites(driver, this.testngConfig);
    driver.setVerbose(0);
    driver.setUseDefaultListeners(this.useDefaultListeners);
    UUID runId = UUID.randomUUID();
    File runDir = new File(this.outputDir, runId.toString());
    if (!runDir.mkdir()) {
        runDir = this.outputDir;
        LOGR.config("Created test run directory at " + runDir.getAbsolutePath());
    }
    driver.setOutputDirectory(runDir.getAbsolutePath());
    AlterSuiteParametersListener listener = new AlterSuiteParametersListener();
    listener.setTestRunArgs(testRunArgs);
    listener.setTestRunId(runId);
    driver.addAlterSuiteListener(listener);
    driver.run();
    Source source = null;
    try {
        File resultsFile = getResultsFile(getPreferredMediaType(testRunArgs), driver.getOutputDirectory());
        InputStream inStream = new FileInputStream(resultsFile);
        InputSource inSource = new InputSource(new InputStreamReader(inStream, StandardCharsets.UTF_8));
        source = new SAXSource(inSource);
        source.setSystemId(resultsFile.toURI().toString());
    } catch (IOException e) {
        LOGR.log(Level.SEVERE, "Error reading test results: " + e.getMessage());
    }
    return source;
}
 
開發者ID:opengeospatial,項目名稱:teamengine,代碼行數:60,代碼來源:TestNGExecutor.java

示例8: create

import org.testng.TestNG; //導入方法依賴的package包/類
private TestNG create() {
    final TestNG result = new TestNG();
    result.setUseDefaultListeners(false);
    result.setVerbose(0);
    return result;
}
 
開發者ID:sskorol,項目名稱:webdriver-supplier,代碼行數:7,代碼來源:ListenerTests.java

示例9: create

import org.testng.TestNG; //導入方法依賴的package包/類
private static TestNG create() {
    final TestNG result = new TestNG();
    result.setUseDefaultListeners(false);
    result.setVerbose(0);
    return result;
}
 
開發者ID:sskorol,項目名稱:test-data-supplier,代碼行數:7,代碼來源:BaseTest.java

示例10: create

import org.testng.TestNG; //導入方法依賴的package包/類
public static TestNG create() {
  TestNG result = new TestNG();
  result.setUseDefaultListeners(false);
  result.setVerbose(0);
  return result;
}
 
開發者ID:testng-team,項目名稱:testng-remote,代碼行數:7,代碼來源:SimpleBaseTest.java


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