gotests icon indicating copy to clipboard operation
gotests copied to clipboard

Support for generating test cases

Open emou opened this issue 8 years ago • 1 comments

Hi,

I've been thinking of modifying gotests to support using the testing/quick package to generate test cases and optimize them for code coverage.

Have you thought about something similar before and is this something you would accept as a feature in the project, or is it better to fork it?

My high-level idea is to:

  • Use gotests to generate tests
  • Use testing/quick to generate test inputs
  • Measure the code coverage while running each test inputs
  • Shrink the test inputs to a minimal set that provides high coverage

Not sure how complex generating test cases for complex/nested structs will be, but it should be fairly simple for basic types.

emou avatar Apr 07 '17 15:04 emou

@emou - I like your idea. Generating test cases fits nicely with the goal of gotests: to make writing tests easier. If you could outline a design of how this would work, I would be happy to critique it and provide guidance.

One of the core challenges is figuring out how to seamlessly get testing/quick to generate test cases and then pass them to gotests. It's not immediately clear how we can get gotests to execute test code, since it's a binary separate from your code which just performs static analysis right now.

cweill avatar Apr 08 '17 18:04 cweill