This project is read-only.

Test Plan

The Repository Factory is tested by automated and manual tests.
  • Automated tests were developed using NUnit and they cover unit tests and compilation of T4 templates.
  • Manual tests consist of running the Repository Factory Guidance Package using the provided test project and sample databases, and running the NUnit tests of the test project.

Automated Testing

The Repository Factory is currently using NUnit as the unit testing framework. The original source code drop from Microsoft was using Microsoft Tests (only supported in Visual Studio Team System edition). The reason to change to NUnit is to allow developers using other editions of Visual Studio to write and run their unit tests. Also, NUnit is a widely adopted testing framework and it is supported by other tools such as Resharper.

Developers and Unit Tests

  • Developers should write unit tests. This is the only way to make sure the code you write is tested and working as you intended. A good set of units tests will allow you and other developers to change and refactor existing code without breaking existing functionality.
  • Before checking in your code changes, make sure to run all unit tests and verify that they are passing.

Unit Testing Areas

The Repository Factory can be basically divided into three areas of unit testing:
  • Class Libraries: class libraries are used internally to generate the code (text template transformation) and externally by the client applications (Repository base classes). These libraries can and should be unit tested.
  • T4 Templates: T4 templates were originally manually tested. However, new unit tests were created to test that T4 files are syntax error free, e.g. they compile. When changing existing T4 files, run their unit tests to verify they have no compilation errors.
  • UI: the user interface uses the GAT recipes and are currently manually tested.

Manual Testing

Test Projects

The testing solutions are located under the Repository Factory source code at:
  • $/RespositoryFactory/Trunk/Source/RepositoryFactoryTestingSolutions/RepositoryFactoryTestCS.sln
  • $/RespositoryFactory/Trunk/Source/RepositoryFactoryTestingSolutions/RepositoryFactoryTestVB.sln
These solutions are available as of change set # 23234.

Testing Database

The following database servers are required for this test plan: We are using the Chinook Sample Database which provide scripts for SQL Server and Oracle:

Test Plan

The following test plan should be performed in 4 runs:
  • C# Project using SQL Server Database
  • C# Project using Oracle Database
  • VB Project using SQL Server Database
  • VB Project using Oracle Database

Test Plan Steps

  1. Restore the Test project.
  2. Run the Specify project responsibility Recipe.
    1. Right click on the DataAccessCS/DataAccessVB and select Specify project responsibility.
    2. Select all three responsibility options and press OK.
    3. Verify that all recipes are available on the context menu.
  3. Run the Add database connection Recipe.
    1. Name the connection as MyConnection (needed in order to run the unit tests below).
    2. Use the Chinook database created on the Testing Database section above.
    3. Verify that app.config was created with the connection string was added.
  4. Run the Create CRUD stored procedures Recipe.
    1. Select MyConnection as connection name and click on Next.
    2. Select all database tables and accept all default settings.
    3. Execute the generated SQL script in order to create the stored procedures. In SQL Server, you can execute it by opening a command prompt window and running: osql -E -S .\sqlexpress -i StoredProcedures.sql -d "Chinook".
  5. Run the Create business entities from database Recipe.
    1. Select MyConnection as connection name and click on Next.
    2. Leave the default namespace and click on Next.
    3. Select all tables available and click on Next, and then on Finish.
    4. Compile the solution to verify that there are no errors.
  6. Run the Create data repository classes from business entities Recipe.
    1. Select MyConnection as connection name and click on Next twice.
    2. Select all business entities created on the previous step and click on Next.
    3. Select the Album entity and click on Add... / Get One.
    4. Select the GetAlbumByAlbumId stored procedure, and click on Next and Finish.
    5. Click on Finish to end the recipe.
    6. Compile the solution to verify that there are no errors.
  7. Run the solution Unit Tests
    1. On the DataAccess.Test project, click on the RepositoryTests.cs file and change its property Build Action to Compile.
    2. Make sure your connection name is MyConnection, if not rename it on your app.config or change it on RepositoryTests class.
    3. Rebuild the solution and run all unit tests.

Last edited Oct 1, 2008 at 10:00 PM by lerocha, version 4


No comments yet.