CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Doing Unit Testing

  1. #1
    Join Date
    Dec 2010
    Posts
    907

    Doing Unit Testing

    I am making some ids for the tiles of a grid in a game.
    And I want to make a unit test module for regression testing.
    But the data sometimes differ, I want to say test, when I give the unit test an id
    it returns me with some neighbouring tiles.
    However, when I change the program, all the ids change/shift up and down,
    What are the general techniques to make test data consistent and predictable?

    Should I make sure the bottom-up approach is used, so that I test lowest layer first.
    And don't worry about it after gurranteeing it is correct.
    Last edited by lucky6969b; December 20th, 2015 at 08:08 AM.

  2. #2
    Join Date
    Aug 2006
    Posts
    232

    Re: Doing Unit Testing

    When you say "change the program", do you mean change the code, or just the data?

    The purpose of automated tests should be to validate different use cases in an isolated environment. Each test will process some data, which must give a result that you can verify.

    So, you can prepare some data so that you already know the expected result (neighbour tiles in your case). Or if you want to test with some random/arbitrary data, you will have to compare with the result from a different algorithm that you trust will give the correct result.
    Last edited by TubularX; December 21st, 2015 at 10:01 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)