Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 2
    Option 2 is correct. You first test GenerateFilled using ValidateBoard which is absolutely fine. When it comes to testing validateBoard method you need to create many scenarios, both for valid and invalid boards. You can try to identify all cases or at least try to group them to test significantly different scenarios, edge cases, etc. Commented Feb 2, 2018 at 20:30
  • @kadiii I actually have 4 or 5 tests covering a variety of error cases for ValidateBoard. I had intended to call GenerateFilled then modify the result in ways to match the particular error case I'm testing for. I was hoping to not have to hardcode boards for each case, but I suppose in thinking about it that's more a code management issue than a test logic issue, since calling GenerateFilled is effectively creating sample data anyway. I'm going to leave the question open for a few days, but if you repost your comment as an answer I'll consider it as the solution if no superior answers come in. Commented Feb 2, 2018 at 22:09
  • 1
    @ShaunHamman: if you write a test for ValidateBoard using Board.GenerateFilled() in the shown way, this will be just one sample data case as well. Commented Feb 3, 2018 at 10:20