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:
1
using System;
2
//we are referencing the SW Model
3
using MyFirstSoftware_Model;
4
using Progile.ATE.Common;
5
using Progile.ATE.TestFramework;
6
7
namespace TC001_Rev1
8
{
9
[TestCase(1)]
10
public class MyFirstTestCase
11
{
12
//we are setting a new App property
13
private MyFirstSoftwareApp App { get; set; }
14
15
[SetupTest]
16
public bool Setup(ITester t)
17
{
18
//we are instantiating the SW model
19
App = new MyFirstSoftwareApp(t);
20
return true;
21
}
22
23
[PreconditionStep]
24
public void PreconditionStep(ITester t)
25
{
26
if (t.Testee.FindImage(TestImages.TC001_Rev1.Images.TopMenu.Home).HasSucceeded)
27
t.Report.PassStep("The progile.ch home page is displayed in the WebBrowser");
28
else
29
t.Report.FailStep("The progile.ch home page is not displayed in the WebBrowser");
30
}
31
//We define the Test Input and the Expected Results in the tag before the method
32
[TestStep(1,
33
TestInput = "Click on the Contact Us link in the top of the screen",
34
ExpectedResults = "The Contact Us page is displayed")]
35
public void Step1(ITester t)
36
{
37
//we are clicking on the Contact Us item in the Top Menu
38
t.Testee.Mouse.Click(TestImages.TC001_Rev1.Images.TopMenu.ContactUs);
39
40
//we are checking if the Contact Us page has been displayed
41
if(t.Testee.FindImage(TestImages.TC001_Rev1.Images.Screens.ContactUs).HasSucceeded)
42
t.Report.PassStep("The Contact Us page is displayed");
43
else
44
t.Report.FailStep("The Contact Us page is not displayed");
45
}
46
47
}
48
}
49
Copied!
Copy link