DEV Community

Adam Luzsi
Adam Luzsi

Posted on

testcase testing framework v0.42+

GitHub repository link


Race is a test helper that allows you to create a race situation easily. This is useful when you work on a component that requires thread-safety. By using the Race helper, you can write an example use of your component, and run the testing suite with go test -race. The race detector then should be able to notice issues with your implementation.


T.Random is a random generator that uses the Spec seed. When a test fails with random input from Random generator, the failed test scenario can be recreated simply by providing the same TESTCASE_SEED as you can read from the console output of the failed test.

testcase.Var Thread Safety

testcase.Var.Get and testcase.Var.Set now thread-safe.


Syntax sugar for appending elements to slice variables.


Contract meant to represent a Role Interface Contract. A role interface is a static code contract that expresses behavioral expectations as a set of method signatures. A role interface used by one or many consumers. These consumers often use implicit assumptions about how methods of the role interface behave. Using these assumptions makes it possible to simplify the consumer code. In testcase convention, instead of relying on implicit assumptions, the developer should create an explicit interface testing suite, in other words, a Contract. The code that supplies a role interface then able to import a role interface Contract, and confirm if the expected behavior is fulfilled by the implementation.

further references:

Top comments (0)