Lincheck 指南

Lincheck is a practical and user-friendly framework for testing concurrent algorithms on the JVM. It provides a simple and declarative way to write concurrent tests.

With the Lincheck framework, instead of describing how to perform tests, you can specify what to test by declaring all the operations to examine and the required correctness property. As a result, a typical concurrent Lincheck test contains only about 15 lines.

When given a list of operations, Lincheck automatically:

  • Generates a set of random concurrent scenarios.
  • Examines them using either stress-testing or bounded model checking.
  • Verifies that the results of each invocation satisfy the required correctness property (linearizability is the default one).

Add Lincheck to your project

To enable the Lincheck support, include the corresponding repository and dependency to the Gradle configuration. In your build.gradle(.kts) file, add the following:

【Kotlin】

repositories {
    mavenCentral()
}

dependencies {
    testImplementation("org.jetbrains.kotlinx:lincheck:%lincheckVersion%")
}

【Groovy】

repositories {
    mavenCentral()
}

dependencies {
    testImplementation "org.jetbrains.kotlinx:lincheck:%lincheckVersion%"
}

Explore Lincheck

This guide will help you get in touch with the framework and try the most useful features with examples. Learn the Lincheck features step-by-step:

  1. Write your first test with Lincheck
  2. Choose your testing strategy
  3. Configure operation arguments
  4. Use modular testing in model checking
  5. Consider popular algorithm constraints
  6. Check the algorithm for non-blocking progress guarantees
  7. Define sequential specification of the algorithm

Additional references