Skip to content

Ideas 2011:Unit tests

Chris Oelmueller edited this page Feb 16, 2013 · 1 revision

implementation of unit tests

Our problem

  • we break stuff all the time and notice months later :)
  • adding unit tests to our current code is really cumbersome and might be not worth it everywhere, but they should pay of at certain locations

Our idea

Well, you can probably imagine our idea here ;-)

  • Restructure the code to allow unit tests in the first place where you think it makes sense
  • Write several tests as proof of concept, and try to make them maintainable
  • The unit test system has to be really flexible - we frequently change the behavior of our code
  • Usage of a unit testing frame work such as PyUnit or nose

What you need

  • Good python skills
  • Testing experience
  • Difficulty: Hard, a big part of our code is very difficult to test, as it needs an almost entirely running game to work
  • Areas: Testing, Refactoring
  • Estimated difficulties: Finding a way to test without running most parts of UH

What we provide

  • Very few basic unit tests which can be used as a reference: directory tests/
  • A lot of code to refactor ;-)
  • A list of the most urgent parts:
    • Production code
    • Collector code
  • [PyUnit documentation] (http://docs.python.org/library/unittest.html)
  • Summary of Unit Test Workflow:
    1. Write a module test suite.
    2. Write a class TestCase for each class in the module.
    3. Write a method TestCase for each method of each class. 4: Write method tests for each method TestCase.
    4. Tests can be grouped in the same test method. Do not be afraid to use inheritance to simplify things

As a pre-GSoC task you could work on this ticket: [#806] (http://trac.unknown-horizons.org/t/ticket/806).

What we expect

You can shift around release goals and target dates in the planning stage as you like. Once your mentor and you agreed on a rough timetable, only light modifications should occur if there happens nothing unforeseeable.

  • There are no milestones set so far. You might want to put thoughts into them and ask your mentor though!
  • SoC Deadline: You implemented and documented standalone tests for a large part of our code. It needs to be maintainable by everybody in case you do not want to stay with UH.

What you can add

In general: If your mentor agrees, you can change almost everything in our descriptions. They are just meant to provide guidance if you are not sure where to start or which way to choose.

You are especially free to alter the following parts:

  • Integration testing?
  • Speed testing/refactoring for speed

Who looks after you

Your mentor for this task will probably be: totycro

These devs have experience with PyUnit: nihathrael, totycro

Clone this wiki locally