/** * Visible for testing purposes only. * * @param rule the rule to disable during debugging * @param inputArguments * arguments provided to the Java runtime */ DisableOnDebug(TestRule rule, List<String> inputArguments) { this.rule = rule; debugging = isDebugging(inputArguments); }
/** * Creates the timeout rule that will be used to run the test. * * @return the rule used to check for test execution timeouts. */ protected TestRule createTestTimeoutRule() { int millisecondsTimeout = getTestTimeoutSecs() * 1000; if (isFailOnTimeout()) { return new DisableOnDebug(new Timeout(millisecondsTimeout)); } else { return new WarningTimeout(millisecondsTimeout); } }
public static TestRule timeoutRule(long timeout, TimeUnit timeUnit) { return new DisableOnDebug(Timeout.builder().withTimeout(timeout, timeUnit) .withLookingForStuckThread(true).build()); }
/** * Visible for testing purposes only. * * @param rule the rule to disable during debugging * @param inputArguments * arguments provided to the Java runtime */ DisableOnDebug(TestRule rule, List<String> inputArguments) { this.rule = rule; debugging = isDebugging(inputArguments); }
/** * Creates the timeout rule that will be used to run the test. * * @return the rule used to check for test execution timeouts. */ protected TestRule createTestTimeoutRule() { int millisecondsTimeout = getTestTimeoutSecs() * 1000; if (isFailOnTimeout()) { return new DisableOnDebug(new Timeout(millisecondsTimeout)); } else { return new WarningTimeout(millisecondsTimeout); } }
/** * Visible for testing purposes only. * * @param rule the rule to disable during debugging * @param inputArguments * arguments provided to the Java runtime */ DisableOnDebug(TestRule rule, List<String> inputArguments) { this.rule = rule; debugging = isDebugging(inputArguments); }
/** * Creates a rule (chain) out of a gateway or other rule, adding extra rules as follows:<ol> * <li> a timeout rule * <li> a rule to print console messages at the start and end of each test method and print trace level * log messages on test failure. * </ol> * @param rule Rule to startup and stop gateway * @param timeout The maximum allowed time duration of each test (including the gateway rule) * @param timeUnit The unit for the timeout * @return A TestRule which should be the only public @Rule in our robot tests */ public static RuleChain createRuleChain(TestRule gateway, long timeout, TimeUnit timeUnit) { TestRule trace = new MethodExecutionTrace(); TestRule timeoutRule = new DisableOnDebug(Timeout.builder().withTimeout(timeout, timeUnit) .withLookingForStuckThread(true).build()); return RuleChain.outerRule(trace).around(timeoutRule).around(gateway); }
/** * Creates a rule (chain) out of a k3po rule and gateway rule, adding extra rules as follows:<ol> * <li> a timeout rule * <li> a rule to print console messages at the start and end of each test method and print trace level * log messages on test failure. * </ol> * @param gateway Rule to start up and shut down the gateway (or acceptor or etc) * @param robot Rule to startup and stop k3po * @param timeout The maximum allowed time duration of each test * @param timeUnit The unit for the timeout * @return A TestRule which should be the only public @Rule in our robot tests */ public static RuleChain createRuleChain(TestRule gateway, K3poRule robot, long timeout, TimeUnit timeUnit) { TestRule trace = new MethodExecutionTrace(); TestRule timeoutRule = new DisableOnDebug(Timeout.builder().withTimeout(timeout, timeUnit) .withLookingForStuckThread(true).build()); return RuleChain.outerRule(trace).around(gateway).around(robot).around(timeoutRule); }