Monday, March 8, 2010

Visual Studio 2010 – Testing Tools Demo with WPF

I have been “testing” the new Testing Tools for Visual Studio 2010.  This includes the new Lab Management and Test Manager.  The Lab Management piece covers the managing of Virtual Environments and Machines for testing.  The Test Manager is a GUI interface to Lab Management and a tool to manage test cases, bugs, and run tests.
In this blog entry, I want to show a demo of using the Testing Tools with a WPF application.  I will show creating a test, running the test in a virtual environment, creating a bug, fixing the bug, building and deploying to the virtual environment, and verifying the bug fix.
OK, here we go.
0. Introduction of Test Environment.
Test Environment
The screen print above is from Test Manager showing the Lab Environment.  I have created a Virtual Environment called “Xiptor Demo” and within the environment is one virtual machine, also named “Xiptor Demo”
The virtual machine (VM) is running Windows 7 with the test, lab, and build agents running.  Also, Test Manager is installed on the VM.
1. Create Test Case
image
Now, in Test Manager, I create a Test Plan and add a new Test Suite as seen in the left side of the UI.  Then, I will click on “New” to create a new test case.
image
I enter the Title and some steps to run the test case.  Then I save the test case to TFS.
2. Run Test Case from Virtual Machine
image
In Test Manager, I want to bring up the VM environment viewer to run the test case and start Test Manager.  I will select the test case and run.
image
I will start the test from the Test Runner (on left side of Environment Viewer window) and execute the test steps.  I will start the WPF application and specify the test step passed.  Then, when I click on a button, the WPF application crashes.  So, I create a screen print.  Then, I create a bug.  The Test Runner will collect all the data to include in the bug and show the New Bug Window.  After entering a title for the Bug, I will save the bug information to TFS.
3. Fix Bug in Visual Studio 2010
image
In Visual Studio 2010 using Team Explorer, I look at the bugs and find the bug just created.  Here you can the details of the bug and there are links to the screenshot, actions list, System Information, a video recording of the test session, and IntelliTrace information.
image
If you click on the IntelliTrace link, you can see the IntelliTrace information saved while running the test.  Double clicking on the Exception Data will bring me to the line of code where the exception occurred.
Now, I go ahead and fix the bug.  When I check-in the source, I associate to a work item, which is the bug created in Test Manager.
4. Queue New Build with deploy to Lab Environment
image
After making all of the changes, I queue a new Lab build.  The lab build will re-build the solution.  Then, it will deploy the new version of the application to the Virtual Machine.  Some optional items are to create a snapshot or checkpoint of the VM after deploying the build and running tests in the VM.
5. Verify Bug Fix in VM
image
I go back to the VM through Test Manager’s Environment Viewer to verify the bug fix.  This time, instead of clicking on “Run Test”, I click on “Verify Bugs”.  I select the “Resolved” bug and verify.  This will start the Test Runner and run the “linked” test case.
6. Pass Test Case and Close Bug
image
I go through the test case steps and verify the bug was fixed.  If everything was successful, I go ahead and Pass the test case and close Test Runner.  When I close Test Runner, a window pops up to close the bug.  I can enter some comments and click “Save Changes”.
Conclusion
Here are the basic steps in executing a test case, filing a bug, fixing a bug, build and deploy, and verifying bug fix.  You got to see some of the features with the new testing tools, such as IntelliTrace, Managing VM Test environments, integration to TFS and Visual Studio.  I hope this gave you a good start into understanding the new testing tools.  I will be blogging in the future more about Visual Studio 2010 Testing tools.