Property testing extension for Protobuf using kotest-property. You can generate random protobuf messages using
Arb.protobufMessage<...>() call and customize the generation properties.
Include the dependency inside build.gradle.kts.
dependencies {
testImplementation("io.github.dogacel:kotest-property-protobuf:LATEST")
}Use the Arb generators provided by the module to generate random protobuf classes.
import dogacel.kotest.ProtobufMessageArb.protobufMessage
class SampleProtobufTest : FunSpec({
test("should convert without errors") {
val settings = ProtobufMessageArbSettings(fieldPresenceProbability = 0.80)
Arb.protobufMessage<FooMessage>(settings).forAll { protoMessage ->
val sut = convert(protoMessage)
// Do some validation
sut.id == protoMessage.id && sut.name == (protoMessage.firstName + protoMessage.lastName)
}
}
})For configuring the generation settings, check ProtobufMessageArbSettings class.
- Allow generation of random protobuf messages.
- Generate realistic well-known types. (I.e. generate timestamps in ±50 years)
- Allow customizing generation settings per field.
- Support protovalidate rules.
Note
This section is applicable to official maintainers only.
- Update
versionunder rootbuild.gradle.kts. - Make sure you set
SONATYPE_USERNAME,SONATYPE_PASSWORD,GPG_SIGNING_KEYandGPG_SIGNING_PASSPHRASE. ./gradlew publishToSonatype./gradlew findSonatypeStagingRepository closeSonatypeStagingRepository./gradlew findSonatypeStagingRepository releaseSonatypeStagingRepository
For any errors, visit https://s01.oss.sonatype.org/#stagingRepositories.
After you release a -SNAPSHOT version, you need the following block to import it.
repositories {
maven {
this.url = uri("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
}For starters, start by checking issues.
Linting can be done via
``./gradlew ktlintFormatBuilding the whole project,
./gradlew buildCheck coverage of the code,
./gradlew koverHtmlReportPlease feel free to open issues and PRs.