top button

How to test database procedures and triggers?

0 votes
posted Mar 9 by Sheetal Gawade

Share this question
Facebook Share Button Twitter Share Button Google+ Share Button LinkedIn Share Button Multiple Social Share Button

1 Answer

0 votes

The following is the process to test triggers and procedures:

  1. Open the database project in Solution Explorer.

  2. Click on Database Schema View from View menu

  3. Open the project folder from Schema View menu, which contains the objects that are need to be tested.

  4. Right click on the object that is to be tested, and Create Unit Tests is to be clicked.
    A dialog box by name Create Unit Tests appears. It displays all the folders and objects in the database project and the check box for the selected object is checked.

  5. Select the Create a new Language Test Project

  6. Choose to either insert the unit test in an existing test class or create a new test class and click on OK

  7. For the project to be configured, Project configuration dialog box appears. Using this dialog box, the test project settings can be configured.
    This requires the information like database connection for executing test results, data generation plan that is to be run before unit tests are run is to be specified.

  8. Configure the project and click on OK.

The input parameters and output parameters must be known. EXEC statement can be used to run the procedure to examine the behaviour of the database. The event due to which the trigger is fired should be called or performed to check the behaviour of the tables.

answer Mar 14 by Arunkumaarts