Unit test framework

From OpenPetra Wiki
Revision as of 06:59, 12 Mayıs 2011 by Wolfganguhr (talk | contribs) (→‎N/A)
Jump to navigation Jump to search

General

Requirements

  • Tests execution should be controllable through nant
  • Tests execution should be done by build server
  • For writing tests it should be possible to execute separate test cases

How do we want to get test peripherals?

  • Write test data into database
    • Set up new, additional test data for each test run
    • Delete database and set up a database snapshot
  • Write mock ups, so that database is not needed for the test
  • Mixed way of test data in database and mock up

Intuitive feeling: Test data in database by adding test data for each test run, perhaps mixed with some mock ups

kind of tests we want to write

  • Tests, which are testing the server code
    • by calling the server functionality directly (in the same process)
    • by connecting as client to the server
  • Tests, the client code without UI
  • Tests, which are testing by interacting with the UI?

Usage in the past

  • Calls a function directly
    • no database
      • Test of TFileDiffMerge
      • Test for parts of ICT.Common
      • Pseudo-Test of some controls
      • yml writer test
    • with database
      • rudimentary sequencer test and db constraint test
  • Dialogs automated and asserts rudimentary only on dialogs
    • With database and server
      • reset database and Import Data through nant
        • Import/Export Gift batches
        • GL Tests
      • generates data through GUI with minimal random string
        • GL Forms
      • Expects certain data exists / does not exists
        • MFinance.server.gift
        • Partner import (assert on the number of imported partners only)
  • A first concept of some dialog tester classes which can be generated automatically by the yaml files

How to write a test

  1. Sit down and think, what functionality you have implemented
  2. Write down the different use cases - each use case generates more than one test
  3. Write down, what needs to be tested. There are always following cases:
    1. Good case in middle range of the possible values
    2. Good case next to the limits of the possible values in all directions
    3. Bad Case in middle range of the not allowed values
    4. Bad Case next to the limits of the not allowed values
  4. Write down, on what outcome you should assert (Remember: We are doing white box tests and look INTO the software!)
    1. in the database
    2. in the state of the server (if in the same process)
    3. in the state of the client (if client is used)
  5. Write down, which test data you need and how you could generate it
  6. Implement the test. Do the test in three stages:
    Testing through Client GUI should be avoided, if possible. It is better to change the client, so that this is possible
    Always ensure, that you on later stages you do not re-test earlier stages. Sometimes it is sufficient to show, that the function is correctly called!
    1. Test without DB, whenever possible
    2. Test inside the server process
    3. Test like a client without GUI
  7. Get your test working

Need to look into

Interesting concepts

xUnit like frameworks

Mock Up

(Ok, Thias a mock up can be used to implement a non existing partner module if the routines are required in the financial modul. But I recommend a discussion "mock up yes or no" before we decide to select one of them. I think a mock up is a good idea if you are in the design phase of one module while you are realizing the other. But here? Wolfganguhr 06:45, 12 May 2011 (UTC))

Validates test quality

  • http://ncover.sourceforge.net/
    • ChristianK uses the version of NCover that is integrated in SharpDevelop 3.2. It works well and is nicely integrated. Combined with the integrated NUnit application it is very handy!
Thias we have actually decided not to run tests with full code coverage ... Wolfganguhr 06:48, 12 May 2011 (UTC)

Integration test framework

N/A

May be that is something that will solve our problems. In our test cases we allways have to integreate test data depending on the situation and even wrong test data in order to create an error message. Actually this is a sql file created by the data base and imported by nant. But this only works for one database and the actual realization is something tricky. Wolfganguhr 06:59, 12 May 2011 (UTC)
  • http://nbehave.org/ (Write test in almost human English language and map the steps to C# classes)

Unsorted List of Links:

Overview pages

http://www.google.co.uk/search?q=test+case+management+system+opensource+nunit - a Goole search which returned rather good results

http://requirementsandtestinghub.wordpress.com/ - overview of and link to following PDF article

http://www.testingexperience.com/testingexperience12_12_10.pdf - Article 'More for less: the growth of open source testing tools' (page 6)

http://www.testingexcellence.com/15-open-source-test-management-tools/ - 15+ Open Source Test Management Tools

http://www.jayphilips.com/2009/08/04/100-open-source-free-functional-testing-tools/ - 100+ Open Source/Free Functional Testing Tools

http://www.opensourcetesting.org/ - Open source software testing tools, news and discussion website

http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks - WikiPedia article on Unit Testing Frameworks

Tools

https://sourceforge.net/projects/qamanager/ - qaManager

https://sourceforge.net/projects/rth/ - RTH - Requirements and Testing Hub

http://code.google.com/p/rth-turbo/ - RTH Turbo

https://wiki.ow2.org/salome-tmf/ - Salome-TMF

https://sourceforge.net/projects/tcw/ - Test Case Web

http://tesly.sourceforge.net/ - Tesly

http://www.majordojo.com/testitool/ - Testitool

http://testlink.sourceforge.net/docs/testLink.php - TestLink

http://www.xqual.com/ - XStudio

http://www.automatedtestinginstitute.com/home/index.php?option=com_content&view=article&id=1344:ati-automation-honors&catid=125:award-honorees&Itemid=1000#OpenSourceTools - ATI Automation Honors - NUnit came 1st, csunit 2nd in the .NET category

http://www.automatedtestinginstitute.com/home/index.php?option=com_content&task=view&id=584&Itemid=185 - Info on csUnit

http://www.csunit.org/ - csUnit