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


Java TestWatcher類代碼示例

本文整理匯總了Java中org.junit.rules.TestWatcher的典型用法代碼示例。如果您正苦於以下問題:Java TestWatcher類的具體用法?Java TestWatcher怎麽用?Java TestWatcher使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: getSauceLabsTestWatcher

import org.junit.rules.TestWatcher; //導入依賴的package包/類
public TestWatcher getSauceLabsTestWatcher() {
    if (!SauceLabs.useSauceLabs()) {
        return new TestWatcher() {};
    }
    String sauceUsername = System.getenv("SAUCE_USERNAME");
    String sauceAccessKey = System.getenv("SAUCE_ACCESS_KEY");
    SauceOnDemandAuthentication authentication =
            new SauceOnDemandAuthentication(sauceUsername, sauceAccessKey);
    SauceOnDemandSessionIdProvider sessionIdProvider = new SauceOnDemandSessionIdProvider() {
        @Override
        public String getSessionId() {
            return remoteWebDriverSessionId;
        }
    };
    return new SauceOnDemandTestWatcher(sessionIdProvider, authentication);
}
 
開發者ID:glowroot,項目名稱:glowroot,代碼行數:17,代碼來源:WebDriverSetup.java

示例2: getTestWatcher

import org.junit.rules.TestWatcher; //導入依賴的package包/類
/**
 * Get test watcher to manage driver instances.
 * 
 * @param obj test class instance extending {@link TestBase}
 * @return test watcher object
 */
public static TestWatcher getTestWatcher(final TestBase obj) {
    return new TestWatcher() {
        @Override
        protected void finished(Description description) {
            DriverManager.closeDriver(obj);
        }
    };
}
 
開發者ID:Nordstrom,項目名稱:Selenium-Foundation,代碼行數:15,代碼來源:DriverWatcher.java

示例3: testWatcherCreator

import org.junit.rules.TestWatcher; //導入依賴的package包/類
/**
 * This function create a TestWatcher writing on screen the names of called
 * classes and methods.
 * 
 * @return the TestWatcher created
 */
public static TestWatcher testWatcherCreator() {
	return new TestWatcher() {
		protected void starting(Description description) {
			System.out.println("\nStarting example : " + description.getMethodName() + " from : "
					+ description.getClassName() + " class.");
		}
	};
}
 
開發者ID:eclipse,項目名稱:january,代碼行數:15,代碼來源:Utils.java

示例4: newWatcher

import org.junit.rules.TestWatcher; //導入依賴的package包/類
public static TestWatcher newWatcher(final Class clazz, final long seed)
{
    return new TestWatcher()
    {
        protected void failed(final Throwable t, final Description description)
        {
            System.err.println(clazz.getName() + " failed with random seed: " + seed);
        }
    };
}
 
開發者ID:real-logic,項目名稱:aeron,代碼行數:11,代碼來源:TestUtil.java

示例5: applyTo

import org.junit.rules.TestWatcher; //導入依賴的package包/類
@Override
public TestRule applyTo(final JenkinsInstance instance) {
    return new TestWatcher() {
        @Override
        protected void starting(Description description) {
            int portNumber = anyFreeLocalPortInRange(rangeStart, rangeEnd);

            Log.info("Found a free port: {}", portNumber);

            instance.setPort(portNumber);
        }
    };
}
 
開發者ID:jan-molak,項目名稱:jenkins-build-monitor-plugin,代碼行數:14,代碼來源:FindFreePort.java

示例6: applyTo

import org.junit.rules.TestWatcher; //導入依賴的package包/類
@Override
public TestRule applyTo(final JenkinsInstance jenkins) {
    return new TestWatcher() {
        @Override
        protected void starting(Description test) {

            Path jenkinsHome = temporaryJenkinsHomeFor(test);

            Log.info("Setting jenkins home to {}", jenkinsHome);

            jenkins.setHome(jenkinsHome);
        }
    };
}
 
開發者ID:jan-molak,項目名稱:jenkins-build-monitor-plugin,代碼行數:15,代碼來源:SandboxJenkinsHome.java

示例7: applyTo

import org.junit.rules.TestWatcher; //導入依賴的package包/類
@Override
public TestRule applyTo(final JenkinsInstance jenkins) {
    return new TestWatcher() {
        @Override
        protected void starting(Description description) {
            jenkins.client().registerAccount(user.getName(), user.password());
        }
    };
}
 
開發者ID:jan-molak,項目名稱:jenkins-build-monitor-plugin,代碼行數:10,代碼來源:RegisterUserAccount.java

示例8: applyTo

import org.junit.rules.TestWatcher; //導入依賴的package包/類
@Override
public TestRule applyTo(final JenkinsInstance jenkins) {
    return new TestWatcher() {
        @Override protected void starting(Description description) {

            warmUpUpdateCenterCacheFor(jenkins);

            jenkins.client().installPlugins(requiredPlugins);
        }
    };
}
 
開發者ID:jan-molak,項目名稱:jenkins-build-monitor-plugin,代碼行數:12,代碼來源:InstallPluginsFromUpdateCenter.java

示例9: hasZeroFields

import org.junit.rules.TestWatcher; //導入依賴的package包/類
@Test
public void hasZeroFields() throws Exception {
  Field[] fields = TestWatcher.class.getDeclaredFields();
  assertThat(fields.length).as("Fields: " + Arrays.asList(fields)).isEqualTo(0);
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:6,代碼來源:SerializableTestWatcherTest.java

示例10: getSauceLabsTestWatcher

import org.junit.rules.TestWatcher; //導入依賴的package包/類
@Rule
public TestWatcher getSauceLabsTestWatcher() {
    return setup.getSauceLabsTestWatcher();
}
 
開發者ID:glowroot,項目名稱:glowroot,代碼行數:5,代碼來源:WebDriverIT.java

示例11: innerRule

import org.junit.rules.TestWatcher; //導入依賴的package包/類
@Override
protected TestWatcher innerRule() {
  return innerRule;
}
 
開發者ID:camunda,項目名稱:camunda-bpm-needle,代碼行數:5,代碼來源:ProcessEngineTestWatcher.java

示例12: createWatcher

import org.junit.rules.TestWatcher; //導入依賴的package包/類
/**
 * Create watcher for JUnit
 * @return a watcher for use with JUnit
 */
public static TestWatcher createWatcher() {
    return provider.createWatcher();
}
 
開發者ID:Microsoft,項目名稱:AppCenter-Test-Appium-Java-Extensions,代碼行數:8,代碼來源:Factory.java


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