What are the best ways to reuse existing tests for new things?

For example, Java and C# (Mono) both have tests testing their implementations of Hashtable. If I write my own Hashtable (let's say for legitimate technical or business reasons), then is it ok to run the mono IDictionary tests against it?

I think this applies to subclasses and implementations of any public interfaces. We should be utilising the existing testing resources that are available as a baseline.

I'm keen to see other examples of how we can reuse existing publicly available test suites.

The other question is on the legalities of doing the above? As we're not shipping any of the tests I don't believe we're violating any licences, but I'd like other opinions?

2 Answers 2


You should learn from whatver sources you can, and this sounds like a great idea.

You will need to respect the license of the code, for example, mono is licensed under the MIT/Xll license or the GPL (depending on which part) it the tests are GPL, then you would need to release any derived works.

However you should really seek legal advice to know exactly what you can or can't do.


If it were me, and I did not intend to ship the test, I would use the tests without hesitation. However, I would be diligent about the following:

  1. If there were any license or ownership-related information in the comments, I would leave them intact, i.e. I would not strip them out.
  2. I would check the code's license about the implications of modifying the code.

This is the ideal use of an automated test: for testing something whose implementation has changed but whose interface remains the same.

A final thought: regarding the example you cited, if the Java/Mono licenses are too restrictive for you, keep looking. I suspect there are many, many published hash table tests available on the Internet.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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