当前位置: 首页>>代码示例>>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;未经允许,请勿转载。