Friday, March 25, 2011

CodedUI Test Close Browser

I am testing a web application and some error messages are generated through JavaScript. I created a Coded UI test that verified the error messages when the user attempts to login with an empty username or an empty password. I couldn't use a Web Performance Test because the JavaScript is not executed during playback.

I forgot to record closing the browser, so I added it under TestCleanup.

Here is what I changed in the CodedUI Test:

1) click + to expand the Additional test attributes region
2) Un-comment the TestCleanup method
3) add a line to close the browser: ";"

        public void MyTestCleanup()
            // To generate code for this test, select "Generate Code for Coded UI Test" from the shortcut menu and select one of the menu items.
            // For more information on generated code, see

Wednesday, March 2, 2011

Rename Virtual PC

I have some virtual machines used for testing. I am writing down what I do when we make a copy of the Virtual PC. Sometimes I make a copy of a virtual machine or give a copy to someone else to use. Then I have to rename the virtual PC, so there are not conflicts; rename the machine in Windows, assign a new MAC address to both network adapters, rename the SQL Server, and change the database connection strings in used by services and applications.

1) login to the Virtual PC; select Control Panel> System> Computer Name> Change... and enter a new name

2) restart Windows when it prompts you to reboot

3) open SQL Query Analyzer and rename the SQL Server instance
sp_addserver , local
4) close virtual machine and commit changes to hard disk
5) edit the .vmc file to change the MAC address; there is one line for each network adapter, 
so in a laptop I had to change two lines one for the wireless adapter and one for the wired connection
6) reconfigure any applications that use the machine name or IP address