Links

Referencing the Model in the Test Case

Since your Test Cases and Software Models reside in different projects you need to make sure that the test cases "are aware" that the model exists. That means you need to reference the model in your test case projects.
To add a reference to your model perform the following steps:
  • In your Test Case Project right click on the References node and select Add Reference.. from the context menu
  • Tick your software version project and press the OK button
  • Tick your software version project and press the OK button
As the last step you will need to add the model reference in your test case class as follows:
  • Before the namespace name add the reference to the model: using MyFirstSoftware_Model;
  • Before the [SetupTest] add a new property: private MyFirstSoftwareApp App { get; set; }
  • In the [SetupTest] method instantiate your SW model: App = new MyFirstSoftwareApp(t);
After the above mentioned modification your test case will look as follows:
using System;
//we are referencing the SW Model
using MyFirstSoftware_Model;
using Progile.ATE.Common;
using Progile.ATE.TestFramework;
namespace TC001_Rev1
{
[TestCase(1)]
public class MyFirstTestCase
{
//we are setting a new App property
private MyFirstSoftwareApp App { get; set; }
[SetupTest]
public bool Setup(ITester t)
{
//we are instantiating the SW model
App = new MyFirstSoftwareApp(t);
return true;
}
[PreconditionStep]
public void PreconditionStep(ITester t)
{
if (t.Testee.FindImage(TestImages.TC001_Rev1.Images.TopMenu.Home).HasSucceeded)
t.Report.PassStep("The progile.ch home page is displayed in the WebBrowser");
else
t.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")]
public void Step1(ITester t)
{
//we are clicking on the Contact Us item in the Top Menu
t.Testee.Mouse.Click(TestImages.TC001_Rev1.Images.TopMenu.ContactUs);
//we are checking if the Contact Us page has been displayed
if(t.Testee.FindImage(TestImages.TC001_Rev1.Images.Screens.ContactUs).HasSucceeded)
t.Report.PassStep("The Contact Us page is displayed");
else
t.Report.FailStep("The Contact Us page is not displayed");
}
}
}