Skip to content

Improvements to existing unit tests #48

@sylvainhalle

Description

@sylvainhalle
  • Unit tests should not write output to the console. This requires manual intervention by developers to verify the output printed on the console to check if the test ran successfully or not, which defeats the purpose of automated testing in a continuous integration environment such as Travis.
  • A few tests are needlessly long. An example is GaussianFloatTest.sameValuesSameSeed(), which tests 10,000 pairs of pickers for their first 10,000 values each. This amounts to 200 million calls to pick(), which is probably overkill in the context, and makes that single test case last for almost 10 seconds. This is especially important since every build in the Travis platform consumes credits based on execution time. Reduce to 100 repetitions.
  • In that same test, the seed for the pickers is itself picked at random. This makes the test case susceptible to being non reproducible: re-running a failing test may result in a passing test, and vice versa, due to the chance of picking different seeds each time. It would be preferable to randomly pick a list of seeds, then hard-code that list into the test so that the state of each execution is identical. (Same for other tests that do the same thing.)

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions