https://github.com/tonicsoft/timebomb
Simple test utility for ignoring a unit test for a limited period of time.
https://github.com/tonicsoft/timebomb
ignore java junit testing-tools testng unit-testing
Last synced: 6 months ago
JSON representation
Simple test utility for ignoring a unit test for a limited period of time.
- Host: GitHub
- URL: https://github.com/tonicsoft/timebomb
- Owner: tonicsoft
- License: apache-2.0
- Created: 2017-02-26T18:30:05.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-03-04T21:27:27.000Z (over 9 years ago)
- Last Synced: 2025-07-09T23:36:28.424Z (12 months ago)
- Topics: ignore, java, junit, testing-tools, testng, unit-testing
- Language: Java
- Size: 25.4 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# timebomb
[](https://travis-ci.org/tonicsoft/timebomb)
Simple test utility for ignoring a unit test for a limited period of time.
# download
`timebomb` is available from the [Maven Central Repository](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.tonicsoft.timebomb%22). Junit and TestNG are the supported test frameworks. To use timebomb, simply declare a dependency on one of the following:
- Junit: [org.tonicsoft.timebomb:timebomb-junit](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.tonicsoft.timebomb%22%20AND%20a%3A%22timebomb-junit%22)
- TestNG: [org.tonicsoft.timebomb:timebomb-testng](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.tonicsoft.timebomb%22%20AND%20a%3A%22timebomb-testng%22)
## What is a Time Bomb?
The obvious drawback of using your test framework's "ignore" functionality directly is that the test may be forgotten about and remain ignored indefinitely. A Time Bomb will allow the test to be ignored until a specified time, after which the test will fail, reminding you to return to it.
## Usage
The Time Bomb comes in two main flavours:
- `TimeBomb.blowUpAfter(...)` - Run the test normally until the given point in time, after which the test will fail.
- `TimeBomb.ignoreUntil(...)` - Ignore the test (i.e. code will not execute) until the given point in time, after which the test will fail.
## Example
```java
@Test
public void myTest() {
// This will do nothing until 2018-01-01, after which it will
// throw a RuntimeException, causing the test to fail
TimeBomb.blowUpAfter(new LocalDate(2018,1,1));
//This code will continue to run until 2018-01-01
...
assertThat(...)
}
@Test
public void anotherTest() {
// This will throw an exception (depending on test framework)
// until 2018-01-01 causing the test to be ignored, after which
// it will throw a RuntimeException causing the test to fail.
TimeBomb.ignoreUntil(new LocalDate(2018,1,1));
//This code will not run until the TimeBomb is removed
...
assertThat(...)
}
```