giovedì 15 marzo 2012 02:30
I'm looking for some tips with regards to best practice techniques when creating tests in visual studio 2010 and then using them to create test cases in
MS Test Manager. The three tests that I'm working on include unit tests, db unit test and Coded UI tests. I'm not exactly sure on all the details
but from what I know the current set up is we have MS Test Manager on a physical machine that I remote into, a build server and the lab (virtual)
environment with my configurations. The test controller is registered with the Team Foundation Server and the test agents are registered to controller. This brings me to my first
question, In the virtual enviroment configured to run my tests, I need a test agent installed and registered.That is my conclusion after trial and error. Is this correct?
I've gotten to the point where I could build the application, including all three tests and run each type of test.
Creating unit test seem straight forward, where I can create them and then run them in my virtual environment.
DB unit test are not too complicated either. The most important question that I have with regards to DB Unit tests is, If I have a dev, test and
production environment and within those enviroments I have the same database applied to different areas such as states. ie DEV_California, DEV_Texas...
how can I configure my DB Connection String to be dynamic. The thing I would be changing is the Initial Catalog in an SQL server 2008 db. I know I can change
the settings in the App.Setting file ffor the test project, but how can I do it dynamically? Any ideas?
The next issue relates to Coded UI tests. This took me some time to figure out but the way I created my coded UI tests was:
1. Created an empty test case in MS Test Manager.
2. Created a test recording with the Application.exe file which was located in the folder c:\tempTest
3. Created a Coded UI test in MS Visual Studio with the exact same set up including the c:\tempTest folder
4. Saved, Checked in and built the application.
5. Associated the Coded UI Test with the test case I had created in step 1.
6. Manually added the application.exe file to the lab (virtual) environment in the same C:\tempTest folder.
7. Associated the build with the test in Test Manager.
Ultimately the Coded UI Test executed and passed in Test Manager.
My question is, what would be a better technique when creating Coded UI Tests? It seemed that my three enviroments (VS 2010 on my machine, Test Manager on Remote Machine and Lab Enviroment) \
had to be set up the same for the Coded UI test to execute. If this is the case then how can I make sure that my Lab Environment is set up correctly?
Any feedback as to what I'm doing wrong or if there is a great tutorial out there that would enlighten me would be greatly, profoundly appreciated. I've been researching this for the past two weeks
and it seems I have an infinite amount to learn.
Tutte le risposte
sabato 17 marzo 2012 05:39
You can create a script which copies the files from build drop folder to C:\tempTest. For this, you will have to make sure that the files are build and copied in the build drop as part of build process. You can the add this script as pre script in test settings.
If you want to run the tests automatically using Build-Deploy-Test workflow, see http://social.technet.microsoft.com/wiki/contents/articles/tfs-2010-build-deploy-test.aspx