Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've seen not so many examples of testing with automatic tools, i.e. serializing/deserializing of JSON (which was paired in the following way: val actual = deserialize(serialize(string))), checking that appending symbols to string was done properly (and that's imho silly, cause it extremely hard to made a mistake in such plain operations).

Can you provide really useful examples/use cases for automatic testing with ScalaCheck that will unveil it advantages? Does it meant to be used mostly in paired style (straight/inverse functions like in JSON example above)?

share|improve this question
up vote 3 down vote accepted

You can take a look at the tests that Scala itself is using at the moment.

To be honest, I had never seen the kind of paired test you mention. The scope of ScalaCheck is pretty simple: if there's a rule, property, invariant or condition your code must observe, then ScalaCheck is a great fit for it.

I'll state this in reverse to make it even clearer. The only place where you don't use ScalaCheck is for code that is composed solely of exceptions -- that is, there is no rule that apply over inputs which will tell you something about the outputs.

There's very few places I can think of where such a thing would happen.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.