In this chapter we will create a simple test case with only one test step. The test case will look as follows:
Follow the Steps below to create your first simple test case:
Step 1: Take an image of the Home item in the Remote Viewer
Access the Remote Viewer and draw a rectangle around the Home menu item. We will use this button to check if the Preconditions are met.
Save this image with the Default parameters in the Test Case project in a unique directory e.g.
\yourTCprojectDir\Images\TopMenu\Home\Home.png
Step 2: Change the Precondition to use the taken image
[PreconditionStep]publicvoidPreconditionStep(ITester t) {if (t.Testee.FindImage(Images.TopMenu.Home).HasSucceeded)t.Report.PassStep("The progile.ch home page is displayed in the WebBrowser");elset.Report.FailStep("The progile.ch home page is not displayed in the WebBrowser"); }
As you see we have referenced the image in the FindImage method and are looking for this image on the system under test. If the image is found we will pass the step, otherwise we will fail it and the test case will not continue.
Step 3: Take an image of the Contact us item in the Remote Viewer
Access the Remote Viewer and draw a rectangle around the Contact us menu item. We will use this button to interact with the SUT.
Save this image with the Default parameters in the Test Case project in a unique directory e.g.
Step 6: Change Step 1 in your code to use the taken images
//We define the Test Input and the Expected Results in the tag before the method[TestStep(1, TestInput ="Click on the Contact Us link in the top of the screen", ExpectedResults ="The Contact Us page is displayed")]publicvoidStep1(ITester t){ //we are clicking on the Contact Us item in the Top Menut.Testee.Mouse.Click(Images.TopMenu.ContactUs); //we are checking if the Contact Us page has been displayedif(t.Testee.FindImage(Images.Screens.ContactUs).HasSucceeded)t.Report.PassStep("The Contact Us page is displayed");elset.Report.FailStep("The Contact Us page is not displayed");}
What we have done is we have clicked on the Contact Us menu item and are checking if the correct page is displayed afterwards.
In the end our easy test case will look as follows:
usingSystem;usingProgile.ATE.Common;usingProgile.ATE.TestFramework;usingstaticTestImages.TC001_Rev1;namespaceTC001_Rev1{ [TestCase(1)]publicclassMyFirstTestCase { [SetupTest]publicboolSetup(ITester t) { returntrue; } [PreconditionStep]publicvoidPreconditionStep(ITester t) {if (t.Testee.FindImage(Images.TopMenu.Home).HasSucceeded)t.Report.PassStep("The progile.ch home page is displayed in the WebBrowser");elset.Report.FailStep("The progile.ch home page is not displayed in the WebBrowser"); } //We define the Test Input and the Expected Results in the tag before the method [TestStep(1, TestInput ="Click on the Contact Us link in the top of the screen", ExpectedResults ="The Contact Us page is displayed")]publicvoidStep1(ITester t) { //we are clicking on the Contact Us item in the Top Menut.Testee.Mouse.Click(Images.TopMenu.ContactUs); //we are checking if the Contact Us page has been displayedif(t.Testee.FindImage(Images.Screens.ContactUs).HasSucceeded)t.Report.PassStep("The Contact Us page is displayed");elset.Report.FailStep("The Contact Us page is not displayed"); } }}
This is just an example test case. More examples and ways to simplify the test cases will be described in the next chapters.
Step No.
Test Input
Expected Results
Preconditions
The progile.ch home page is displayed in the WebBrowser
none
1
Click on the Contact Us link in the top of the screen