Hands-On Lab Authoring and Running Automated GUI Tests using Microsoft Test Manager 2012 and froglogic Squish Lab version: 1.0.5 Last updated: 27/03/2013 Overview This hands-‐on lab is part two out of a series of two labs showing how to use Microsoft Visual Studio 2012 and Microsoft Test Manager 2012 to run an automated Squish GUI tests. Squish is a cross-‐platform, cross-‐device GUI test automation tool allowing to automate GUIs on a variety of platforms based on several different GUI technologies. The Squish for MS ALM plugin allows to centrally manage Squish GUI tests in TFS and to run them from Visual Studio, via TFS scheduled builds and continuous integration and via Microsoft Test Manager. In this lab, you will learn how to author and run an automated GUI test using the Squish IDE. You will run the same test from Microsoft Visual Studio 2012 and Microsoft Test Manager 2012 and review the test results. For the setup and configuration that has to be completed before, please refer to the first lab of this series: Setup Microsoft Test Manager 2012 and froglogic Squish for Automated GUI Testing. This hands-‐on lab is one out of a number of labs that deal with Microsoft Test Manager 2012. It focuses on running automated tests with Squish GUI Tester. To learn more about Microsoft Test Manager 2012 features that are unrelated to Squish GUI Tester, please refer to this this blog post. Prerequisites In order to complete this lab you will need the Visual Studio 2012 virtual machine provided by Microsoft. For more information on acquiring and using this virtual machine, please see this blog post. Besides, you need to complete the exercises in the previous lab, Setup Microsoft Test Manager 2012 and froglogic Squish for Automated GUI Testing, before being able to continue with this lab. Exercises This Hands-‐On Lab comprises the following exercises: 1. Authoring a Manual Test 2. Authoring and Running an Automated Test using Squish GUI Tester 3. Running a Squish GUI Test from Microsoft Visual Studio 2012 4. Running a Squish GUI Test as Part of a Microsoft Test Manager 2012 Test Plan Estimated time to complete this lab: 60 minutes. Exercise 1: Authoring a Manual Test In this exercise, you will learn how to create a manual test plan and populate it with steps. The plan can later be run to confirm the expected behavior of your software. 1. Start the virtual machine and log in as Julia. All user passwords are P2ssw0rd. 2. Open Microsoft Test Manager from Start | All Programs | Microsoft Visual Studio 2012 | Microsoft Test Manager. 3. Switch to Testing Center by clicking on Lab Center and selecting Testing Center. 4. If you are not in the test plan view already, click on Plan from the main menu. Microsoft Test Manager will connect to the most recently loaded test plan, which in this case is the test plan Default that we used in the previous lab. To be able to create a new test plan for the manual test, click on the test plan name Default in the upper right-‐corner. Figure 1 Currently opened test plan 5. Click on the Add button, enter the name AddressbookTestPlan into the field Plan name and click on Add to create the plan. Finally, click on Select plan to open it in Testing Center. Figure 2 Creating a new test plan 6. In the left pane, select AddressbookTestPlan and click on the New button in the right pane. Figure 3 Creating a new manual test 7. This creates a new Microsoft Test Manager test case and displays the configuration view for it. In the Title box, enter AddressbookTest. Figure 4 Entering the name of the test 8. At this point, we’re ready to add steps to this manual test. Each step includes an Action, which describes the action the tester needs to perform. Optionally, a step can include an Expected Result, which describes the expected result of the given action. 9. In the Steps panel, create a step for each of the following Actions, only one of which has an Expected Result. The steps are shown in the table below. Action Expected Result Start Address Book application Create a new address book Add an address book entry Verify data entry Verify that the address book entry shows up in the list of addresses Figure 5 Insert the steps of the manual test 10. Save test case by clicking on the Save icon in the upper-‐right corner. Figure 6 Location of the save button Note: The test case is saved as a project work item. 11. Now you are ready to run the test manually as it is described in the Lab Authoring and Running Manual Tests using Microsoft Test Manager 2012. Once the manual test has passed on a regular basis, it makes sense to automate this test allowing us to e.g. re-‐execute this test as part of our nightly regression test plan. Therefor, in this Lab, we want to execute the same test as an automated test. Thus we are skipping the manual execution. As the next step, we are going to prepare the automated test execution. Exercise 2: Authoring and Running an Automated Test using Squish GUI Tester In this exercise, you will learn how to use the Squish GUI Tester to author and run an automated GUI test. The example test that you are going to execute automates an address book application that has been developed in the programming language Java. The application under test, the Java Runtime Environment and the Squish test suite were already installed as part of the Squish installation in the previous lab. This exercise focuses on running the test cases that are contained in the example test suite. If you are interested in learning more about recording and authoring tests with Squish GUI Tester, please refer to the online manual at http://doc.froglogic.com/squish/latest/tutorial-‐getting-‐started-‐java.html. 1. Start the Squish IDE by the clicking on the Squish for Java icon on the desktop. The example test for this Lab is called suite_js and it will already be opened in the Test Suites view. The test suite contains three test cases, which you can open by double-‐clicking. This will open a script editor with the JavaScript source code of the test. Please note that Squish also supports many more scripting languages when authoring tests. Figure 7 Squish IDE and location of the test suite and test cases of the example test 2. As the next step, you are going to execute the complete test suite. This will automatically start the application under test and perform all the interaction that is defined in the three test cases. 3. To start execution of the test suite, click on the Play button in the Test Suites view. To execute a single test case instead of the complete test suite, you can click on the Play button right beside the test cases in the Test Cases list. Figure 8 Location of the play button in the Test Suites view 4. The Squish IDE will be hidden and the Control Bar will show up while the test runs. Squish will automatically start the address book application and automate it. 5. Once the test run is finished, the Squish IDE will show up again. You can find the results of the test run in the Test Results view of the IDE. Figure 9 Test Results view displaying the results of the test run Exercise 3: Running a Squish GUI Test from Microsoft Visual Studio 2012 After having created and executed the GUI tests in Squish, the next step would be to integrate this test into a Visual Studio project. This would, for example, allow developers to run the Squish tests directly from Visual Studio while working on code changes of the application. Or, this can be used to put the Squish tests into TFS version controls. In this exercise, you will learn how to create a Microsoft Visual Studio 2012 project that contains the Squish GUI test that we already executed in the last exercise. You will execute the same test in Microsoft Visual Studio 2012 and without the Squish IDE. 1. Open Microsoft Visual Studio from Start | All Programs | Microsoft Visual Studio 2012 | Microsoft Visual Studio. 2. First, we need to create a Visual Studio project that we will use to import the Squish GUI test to. Select menu File | New | Project… and open Installed | Visual C# | Test | Unit Test Project. Figure 10 Create a new Unit Test Project 3. Enter the name SquishTestProject and click on OK to create the project. Figure 11 Entering the name and creating the project 4. Once the project has been created, a Unit Test file will show up. As we do not want to create a Unit Test, but run a Squish GUI test instead, we can safely delete the file. To do so, open Solution Explorer and select the file UnitTest1.cs in the solution. Right-‐click the file and select Delete from the context menu. You will be asked to prompt the deletion. Figure 12 Deleting the Unit Test file 5. Next, we need to add a new item to our project that will contain the Squish GUI test. Right-‐click the SquishTestProject in Solution Explorer and select Add | New Item…. Figure 13 Adding a new item 6. Select Installed | Visual C# Items | Squish Test. Just leave the name its default of SquishTest1.st and click on Add. Figure 14 Squish Test type selection 7. The Squish Test will be created and opened as shown in the screenshot below. Figure 15 Squish Test in Visual Studio
Description: