You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Next »

Tests

Where data access or integration tests can write their output data?

Tests should never write their output data into test-data/ directory. That directory is used for input data files used the tests.

Make sure that output files are deleted if your test code behaviour depends on them.

Where can I find data files which can be used in data access or integration tests?

All data files which are used in the data access or integration tests must be located in the test-data/ directory

Name the unittest class of your class xxxTest.*

Why?
To make it easy to find the tests for a class.

Unit test categories.

  • Uncategorized - unit test. Fast test to test a class in isolation.
  • TestCategory.Integration - integration test where multiple classes / components are used
    • TestCategory.DataAccess - specific integration test where file is accessed (read / write)
    • TestCategory.WindowsForms - specific integration where form is shown
  • Pefromance - unit or integration test where speed of the code is measured.
  • Jira - test describing a bug in Jira. The test should specify for which issue it was created.

When test shows forms and accesses files - use TestCategory.Integration as a category, no multiple categories!!

Build Server and Automatic Testing

What should I do before checking code in?

Always use TeamCity pre-tested commit if you make changes where others may depend on and you did not run all tests locally! Visual Studio plugin for TeamCity can be downloaded from My Settings & Tools menu on build server.

If someone checks code in that breaks build (new failing tests) - build must be reverted if it is not fixed within 30 min. Use the following script to revert specific build: ... todo

One class per .cs file

Why? Because your checkins are much clearer and it confuses because in most files this is the case
When? Nearly always
Except...you have a lot of really small classes with tight coupling to play some test scenario. Then it might be clearer to have them together.

Hibernate

Hibernate mappings next to your .cs files*

Why?
To make finding hbm files easy for everyone
When? Always.
Except..There are some 'old' mapping files (DelftTools.hbm.xml and SharpMapGis.hbm.xml). Then convention is not applied there yet.

  • No labels