Skip to content

Install

proptastic is a library your tests call, so adding it is one test dependency. There’s no runner of its own to set up: your test framework runs the properties, and your build tool reports their failures as it reports any other.

  • JDK 17 or later.
  • Gradle or Maven.
  • A test framework: JUnit 5, JUnit 4, TestNG, Kotest or Spock, or Kotlin’s tests on JUnit 5. With your test framework shows the setup for each, and how a failure looks in it.
build.gradle.kts
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
plugins {
java
}
repositories {
mavenCentral()
}
dependencies {
testImplementation("io.proptastic:proptastic:1.0.0")
testImplementation(platform("org.junit:junit-bom:5.12.2"))
testImplementation("org.junit.jupiter:junit-jupiter")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
}
tasks.test {
useJUnitPlatform()
testLogging {
exceptionFormat = TestExceptionFormat.FULL
showStackTraces = false
}
}

Gradle prints only the type of a failed test’s exception unless told otherwise, and proptastic’s report is in its message, so exceptionFormat = FULL shows it. showStackTraces = false keeps the output to the message and its cause.

To assert with AssertJ, as the Quickstart’s AssertJ tabs do, add it beside JUnit:

testImplementation("org.assertj:assertj-core:3.27.3")

The library is Java and needs no Kotlin. Kotlin’s own ways in, such as .with(…) naming a data class’s property, are in a jar of their own, on Maven Central beside the library:

build.gradle.kts
dependencies {
testImplementation("io.proptastic:proptastic-kotlin:1.0.0")
}

It brings the library with it, and Kotlin’s standard library, which a Kotlin project has already.

Your build runs your properties without anything else. The jobs around them, making a setting reach the tests, searching for longer, keeping a counterexample once you say so, are proptastic’s commands, and a Java project runs them from its own build, with nothing else to install: the Gradle plugin io.proptastic and the Maven plugin io.proptastic:proptastic-maven-plugin, at the library’s version, both on Maven Central. Build plugins shows both, and how each command is spelled there.

build.gradle.kts
plugins {
java
id("io.proptastic") version "1.0.0"
}

Then ./gradlew proptasticRun runs the properties and summarises them.

For a build that isn’t Java’s, or to run the commands outside a build, there’s the proptastic command. Your build runs your properties without anything else. The proptastic command runs them through that same build and does the jobs around them: making a setting reach the tests, searching for longer, and keeping a counterexample once you say so (proptastic run). It needs nothing installed beside it: the build fetches the library, at the version your project names.

Terminal window
curl -fsSL https://proptastic.io/install.sh | sh

That installs the latest release for this machine: macOS on Apple silicon or Intel, or Linux on x86-64 or Arm64. The Linux builds are static, so one archive runs on any distribution. It needs curl and tar.

It checks the download against the release’s SHA256SUMS, and refuses one that doesn’t match. It keeps the release in ~/.proptastic/native-<version> and links proptastic into ~/.local/bin. If ~/.local/bin isn’t on your PATH, it prints the line to add for your shell. It writes nowhere else, so removing those two directories uninstalls it.

Run it again to update. These variables change what it does, named as mutastic’s installer names its own:

Variable Effect
PROPTASTIC_NATIVE_VERSION The release to install, such as 0.1.0: the latest unless set
PROPTASTIC_HOME Where releases are kept: ~/.proptastic unless set
PROPTASTIC_BIN_DIR Where the command goes: ~/.local/bin unless set, or on Windows the bin folder in PROPTASTIC_HOME
PROPTASTIC_NATIVE_RELEASES Where releases are downloaded from, for a mirror: GitHub’s releases of proptastic/proptastic-rs unless set

To try a change before it’s released, build proptastic from a clone and install it in your local Maven repository:

Terminal window
git clone https://github.com/proptastic/proptastic.git
cd proptastic
just install

just install builds the jar and puts it in ~/.m2/repository, with the one library it needs, opentest4j, for its failure type, and the Kotlin jar and the agent beside it. Without just, run sh scripts/install.sh, which is what the recipe runs. The build downloads the JDKs it needs, so all it asks of your machine is a JDK to start Gradle with. Maven looks in your local repository first; under Gradle, add mavenLocal() above mavenCentral() in repositories.

Quickstart: write a property, watch it fail, and pin the input it found, in five minutes.

Privacy