We've been through the test automation framework build in Building a Test Automation Framework with TestComplete – Part 2. Now we're ready to start building out the automated tests. The following steps walk you through the creation of the test cases, building the folder structure and adding those checkpoints. And just for a final bit of entertainment we're going to look at some refactoring.
Following on from the last post then…
19. Add Test Folders for all the Features
20. Add Tests to the FeatureOrderEntry Folder Add new Keyword tests (you don’t need to add test steps yet) for the scenarios you plan to test.
21. Create Your ‘EnterOrderValid’ Test In the workspace for the ‘EnterOrderValid’ test drag across all the Keyword functions into your Test to create an end to end order entry test process…
Note that it’s important to get the order correct so that you …. Notice how easy it is to build out your Keyword tests now.
22. Add A Checkpoint Now complete this action on the page and identify the object/property that you can use to confirm that the test case was successful…
Create a checkpoint around this object/property
23. Update the Execution Plan Update your Execution Plan to include the new Keyword Test you’ve created.
24. Add Parameters to the Execution Plan and the Test Case Initially (back on step 17) we created our ‘Product Information’ entry Function ‘PageOrdersEnterProdInfo with Parameters…
And we’ve continued to build on this by connection our Execution plan to the Test Case which calls the ‘PageOrdersEnterProdInfo’ function. What we haven’t done is parametize the Test Case and the Execution Plan so that it feeds these parameters through end-to-end. In the ‘EnterOrderValid’ test configure the parameters as follows
Then configure the test steps to use those parameters
Go back to the ‘Execution Plan’ and you’ll be able to configure the parameters on the Execution
You now have the end-to-end Page Object Model tests configured fully
25. Add a New Test to the Execution Plan Update your Execution Plan to include a 2nd instance of the EnterOrderValidTest with different parameters:
26. Refactor the Navigation We now have 3 main menu navigation routines that pretty much do the same thing. We want to refactor these so that we have one routine that accepts different parameters (the parameter we pass in will control which main menu item we select).
a. Create a Project Variable called ‘MenuItem’
b. Configure the name map to use that Project Variable
c. Create a new keyword test / function in the Common Components folder
d. Add a parameter to this new key word test
e. Define the ‘Test Steps’ for this keyword test as follows:
Now we can update our Tests to use this common Main Menu navigation function…