Ask a questionAsk a question
 

Answerunit test project configuration

  • Thursday, October 29, 2009 8:48 PMLGodwin Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    In project configuration window, I did not check " Automatically deploy the database project before unit tests are run" , the unit test to to delete rows in a table, after unit test run, rows are deleted in the table? What did I miss?  Please Help!  Thank you.

Answers

  • Friday, October 30, 2009 4:00 PMGenevieve OrchardMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    The unit test executes the test script against the database, not against the project. The first connection that you supplied in the database test configuration dialog is the connection the unit tests use for execution.

    The option you mentioned (automatically deploy the database project before unit tests are run) controls whether or not the schema in the database project is deployed to the database before the unit tests are run. You might want to do that if you have changed your stored procedure in the project, for example, and you want to test the updated procedure.

    Let us know if you have any more questions about database unit testing.

    -Genevieve Orchard (VSTS Database Edition Test Team)

All Replies

  • Friday, October 30, 2009 12:24 AMGenevieve OrchardMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    I don't quite understand the question. Can you explain a little more what your unit test does? Are you generating data before the unit tests are run?
    -Genevieve Orchard (VSTS Database Edition Test Team)
  • Friday, October 30, 2009 12:24 PMLGodwin Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     

    I have a stored procedure which deletes certain rows in a table; my unit test just executes the stored procedure.  I configured the unit test NOT to “Automatically deploy the database project before unit tests are run”. I thought that after unit test runs, there are no rows deleted in the table (but it actually did delete rows in the table in the database), because it executes SP offline (in the database project, not to the database).  Am I wrong?

  • Friday, October 30, 2009 4:00 PMGenevieve OrchardMSFTUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer
    The unit test executes the test script against the database, not against the project. The first connection that you supplied in the database test configuration dialog is the connection the unit tests use for execution.

    The option you mentioned (automatically deploy the database project before unit tests are run) controls whether or not the schema in the database project is deployed to the database before the unit tests are run. You might want to do that if you have changed your stored procedure in the project, for example, and you want to test the updated procedure.

    Let us know if you have any more questions about database unit testing.

    -Genevieve Orchard (VSTS Database Edition Test Team)
  • Friday, October 30, 2009 5:05 PMLGodwin Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Ok, got it. Thank You !