Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

Guava has unit test cases automatically generated:

Guava has staggering numbers of unit tests: as of July 2012, the guava-tests package includes over 286,000 individual test cases. Most of these are automatically generated, not written by hand, but Guava's test coverage is extremely thorough, especially for com.google.common.collect.

How they were generated? What techniques and technologies were used to design and generate them?

share|improve this question
    
I remember seeing a talk by some google dude that touched this subject. No clue about the name though, the talk was at some java convention I think –  Zavior Nov 1 '12 at 15:08
3  
package com.google.common.collect.testing has a lot of classes with "Generator" in their names - making it look like a framework for tests generation. There are also sub-packages with classes documented as "skeletons" or "base classes" for tests... –  gnat Nov 1 '12 at 16:01
1  
@gnat Yes, I was sure I've seen it somewhere. com.google.common.collect.testing.features for instance shows tfeatures/constrains a collection class should satisfy, and a test case is a combination of them. This way they can parametrize testing –  dzieciou Nov 1 '12 at 16:44
    
You may have more luck on Software Quality Assurance and Testing.SX –  Martin Schröder Nov 2 '12 at 18:57
    
The question got much attention from the community but no reasonable answer so far, so I've followed Martin's suggestion and put it here: sqa.stackexchange.com/questions/5214/…. –  dzieciou Nov 15 '12 at 8:30

1 Answer 1

There are unit test generators. For example, in the .NET world, something like Microsoft Pex could do this.

For example, Microsoft Pex tries based on code analysis all possible values as arguments for a method. Some arguments are expected to let the method throw an exception. Such things can automatically tests created for. Static values like an empty string that is returned in certain cases can also be automatically be tested.

share|improve this answer
2  
That's a random testing useful only for negative path testing (exceptions, invalid input, crash-es, timeout). I believe they generated tests also for happy path, and this requires more design, not just launching static analysis tool. –  dzieciou Nov 1 '12 at 13:18
    
And I know there are ways and tools for generating test for happy path (e.g., see this answer), but I'm interested how this was done in particular case of Guava –  dzieciou Nov 1 '12 at 13:34

Your Answer

 
discard

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.