Skip to content

Commit 8a0664c

Browse files
committed
Merged with master. Stripping of leading context segments in randomized context derivation.
2 parents 6bb558f + d5538e2 commit 8a0664c

75 files changed

Lines changed: 3801 additions & 413 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,18 @@ for current features, their requirement descriptions and migration from junit4.
1111
See [LICENSE.txt](LICENSE.txt) to make your company's lawyer happy.
1212

1313
See [CHANGES.txt](CHANGES.txt) for API changes and updates.
14+
15+
## Snapshot artifacts and releases
16+
17+
We do not publish snapshot artifacts. If you'd like to work with a snapshot,
18+
use gradle's composite build or install maven artifacts locally with:
19+
20+
```
21+
./gradlew publishToMavenLocal
22+
```
23+
24+
## Release publishing
25+
26+
```
27+
./gradlew publishToSonatype closeSonatypeStagingRepository
28+
```

build-options.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
project.version=0.2.0-SNAPSHOT

build.gradle

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,38 @@
11
plugins {
22
alias(libs.plugins.spotless) apply false
3+
alias(libs.plugins.nexus.publish)
4+
alias(libs.plugins.opts)
5+
alias(libs.plugins.buildinfra) apply false
6+
}
7+
8+
apply plugin: com.carrotsearch.gradle.buildinfra.testing.TestingEnvPlugin
9+
apply from: file('gradle/scripts/publishing-sonatype-central.gradle')
10+
11+
buildOptions {
12+
addOption("project.version", "Project version")
313
}
414

515
allprojects {
616
group = 'com.carrotsearch.randomizedtesting'
7-
version = '0.1.0-SNAPSHOT'
17+
version = buildOptions["project.version"].get()
18+
}
19+
20+
nexusPublishing {
21+
repositories {
22+
sonatype {
23+
nexusUrl = uri("https://ossrh-staging-api.central.sonatype.com/service/local/")
24+
snapshotRepositoryUrl = uri("https://central.sonatype.com/repository/maven-snapshots/")
25+
username = findProperty("nexusUsername") ?: ""
26+
password = findProperty("nexusPassword") ?: ""
27+
}
28+
}
829
}
930

1031
subprojects {
1132
apply plugin: 'java-library'
1233
apply plugin: 'com.diffplug.spotless'
34+
apply plugin: libs.plugins.opts.get().getPluginId()
35+
apply plugin: com.carrotsearch.gradle.buildinfra.testing.TestingEnvPlugin
1336

1437
repositories {
1538
mavenCentral()

etc/junit4-missing-features.txt

Lines changed: 20 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,34 @@
11
[ai generated overview of junit4 features]
22

3-
4. Shuffled test execution order and seed annotations
4-
- @Seed on a class fixes the main seed, making execution fully deterministic
5-
- @Seeds / @Seed on a method pins a per-method seed for regression coverage
6-
while still running once with a fresh random seed
7-
8-
6. Repeating tests with @Repeat
9-
- @Repeat(iterations = N, useConstantSeed = true) reruns a test N times with
10-
the same seed (verifies determinism or checks if failure is consistent)
11-
- @Repeat(iterations = N, useConstantSeed = false) reruns with a new
12-
pseudo-random seed each time (measures failure frequency)
13-
14-
8. Timeouts
15-
- Standard JUnit @Test(timeout=N) is honoured
16-
- @Timeout(millis=N) annotation provides an explicit alternative
17-
- Termination sequence: Thread.interrupt() → Thread.stop() → zombie
18-
detection; all attempts are logged with stack traces
19-
20-
9. Thread-leak detection
21-
- Threads that escape a test's ThreadGroup boundary are killed and cause
22-
a test failure
23-
- Encourages explicit Thread.join() before a test method returns
24-
25-
10. Lingering threads and advanced thread-leak control
26-
- @ThreadLeakLingering(linger=N) waits up to N ms for stray threads to
27-
finish naturally (useful for Executor pools or other uncontrolled threads)
28-
- Additional annotations for fine-grained policy:
29-
@ThreadLeakScope – suite vs. test scope
30-
@ThreadLeakAction – warn vs. fail
31-
@ThreadLeakZombies – ignore vs. fail on zombie threads
32-
333
11. Nightly / scaled tests
344
- @Nightly marks a test that only runs when nightly mode is active
355
(-Dtests.nightly=true)
36-
- scaledRandomIntBetween() and multiplier() scale input sizes based on
6+
- scaledrandomIntInRange() and multiplier() scale input sizes based on
377
nightly vs. daily mode
388

399
2. RandomizedTest base class and RandomizedContext
4010
- Extend RandomizedTest for convenient access to a per-test Random instance
4111
- Access the context directly via RandomizedContext.current()
12+
- Utility methods on RandomizedTest: randomInt(), randomIntInRange(),
4213

4314
3. Randomized input generation
44-
- Utility methods on RandomizedTest: randomInt(), randomIntBetween(),
4515
randomBoolean(), randomFloat(), etc.
4616
- Encourages testing over a broad input domain rather than fixed values
17+
18+
* utility rules (require assertions, etc.)
19+
20+
* reproduce-failure line info listener?
21+
22+
[possibly doable with a custom test engine]
23+
24+
- predictably shuffled test execution order
25+
- blowing up test reps using tests.iters
26+
27+
[to check/ add tests of]
28+
29+
- is the seed stack trace frame injected for leaked threads + randomized testing ext?
30+
- can we enforce the order of extensions (randomized testing > leaked threads)
31+
- how are jupiter timeouts working together with leaked threads ext.?
32+
- maybe bring back thread leak zombies annotation (if we can't cleanly terminate leaked threads, ignore all remaining tests).
33+
- maybe move some of the implementation details to a non-exposed package?
34+
- regenerate the javadocs with public API only.

etc/problems-thoughts.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

gradle/libs.versions.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
assertj = "3.27.7"
33
googleJavaFormat = "1.34.1"
44
junit = "6.0.3"
5-
spotless = "8.2.1"
5+
nexus-publish = "2.0.0"
6+
spotless = "8.4.0"
67

78
[libraries]
89
assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" }
@@ -12,4 +13,7 @@ junit-platform-launcher = { module = "org.junit.platform:junit-platform-launcher
1213
junit-platform-testkit = { module = "org.junit.platform:junit-platform-testkit", version.ref = "junit" }
1314

1415
[plugins]
16+
nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "nexus-publish" }
1517
spotless = { id = "com.diffplug.spotless", version.ref = "spotless" }
18+
opts = { id = "com.carrotsearch.gradle.opts", version = "0.2.1" }
19+
buildinfra = "com.carrotsearch.gradle.buildinfra:0.0.21"
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
def published = [
2+
":randomizedtesting-jupiter"
3+
]
4+
5+
configure(subprojects.findAll { it.path in published }) {
6+
apply plugin: 'maven-publish'
7+
apply plugin: 'signing'
8+
9+
// Hack: do not generate or publish gradle metadata files.
10+
tasks.withType(GenerateModuleMetadata).configureEach {
11+
enabled = false
12+
}
13+
14+
plugins.withType(JavaPlugin).configureEach {
15+
java {
16+
withSourcesJar()
17+
withJavadocJar()
18+
}
19+
20+
publishing {
21+
def configurePom = {
22+
name = "${project.name}"
23+
description = "${project.name}"
24+
url = 'https://github.com/randomizedtesting/randomizedtesting-jupiter'
25+
inceptionYear = "2026"
26+
27+
licenses {
28+
license {
29+
name = 'ASL 2.0 License'
30+
url = 'https://github.com/randomizedtesting/randomizedtesting-jupiter/blob/main/LICENSE.txt'
31+
}
32+
}
33+
34+
organization {
35+
name = "Carrot Search s.c."
36+
url = "https://www.carrotsearch.com"
37+
}
38+
39+
developers {
40+
developer {
41+
id = 'dawid.weiss'
42+
name = 'Dawid Weiss'
43+
email = 'dawid.weiss@carrotsearch.com'
44+
}
45+
}
46+
scm {
47+
connection = 'scm:git:git@github.com:randomizedtesting/randomizedtesting-jupiter.git'
48+
developerConnection = 'scm:git:git@github.com:randomizedtesting/randomizedtesting-jupiter.git'
49+
url = 'https://github.com/randomizedtesting/randomizedtesting-jupiter'
50+
}
51+
}
52+
53+
publications {
54+
jars(MavenPublication) {
55+
from components.java
56+
groupId = project.group
57+
artifactId = project.base.archivesName.get()
58+
59+
pom(configurePom)
60+
}
61+
}
62+
}
63+
64+
signing {
65+
required = { !project.version.endsWith('-SNAPSHOT') }
66+
sign publishing.publications.jars
67+
}
68+
}
69+
}

gradle/wrapper/gradle-wrapper.jar

2.73 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.4.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

gradlew

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)