Why use the Application Model in LeanFT?
Category:
Question ID: 109137
1
0

Why would I use the Application Model in LeanFT? Seems easier to just create object descriptions as you go and have it in your test.

Marked as spam
Posted by (Questions: 387, Answers: 66)
Asked on July 30, 2019 8:14 pm
59 views
Answers (1)
1
Private answer

There are quite a few reasons to use the Applicaiton Model.

- You can use it in multiple tests
- It provides a single point for updating if the application changes
- It helps to clean up your code.

Find more information about [Application Models on the LeanFT Help Center][1].

Consider the below code samples which do the same thing. With Applicaiton Model: 10 lines of code vs. without Apllication Model: 56 lines of code.

//With Application Model

FlightApplicationModel FlightApp = new FlightApplicationModel();
FlightApp.MicroFocusMyFlightSampleApplicationWindow.UserName.SetText(''John'');
FlightApp.MicroFocusMyFlightSampleApplicationWindow.PasswordEditField.SetSecure(''5bea0947eb05a78de896''); //HP
FlightApp.MicroFocusMyFlightSampleApplicationWindow.OKButton.Click();
FlightApp.MicroFocusMyFlightSampleApplicationWindow.FINDFLIGHTSButton.Click();
FlightApp.MicroFocusMyFlightSampleApplicationWindow.FlightsDataGridTable.SelectRow(4);
FlightApp.MicroFocusMyFlightSampleApplicationWindow.SELECTFLIGHTButton.Click();
FlightApp.MicroFocusMyFlightSampleApplicationWindow.PassengerNameEditField.SetText(''John'');
FlightApp.MicroFocusMyFlightSampleApplicationWindow.ORDERButton.Click();
FlightApp.MicroFocusMyFlightSampleApplicationWindow.ORDERButton.Click();

//Without Application Model

var microFocusMyFlightSampleApplicationWindow = Desktop.Describe(new WindowDescription
{
FullType = @''window'',
ObjectName = @''Micro Focus MyFlight Sample Application'',
WindowTitleRegExp = @''Micro Focus MyFlight Sample Application''
});
var agentNameEditField = microFocusMyFlightSampleApplicationWindow.Describe(new EditFieldDescription
{
ObjectName = @''agentName''
});
agentNameEditField.SetText(''John'');

var passwordEditField = microFocusMyFlightSampleApplicationWindow.Describe(new EditFieldDescription
{
ObjectName = @''password''
});
passwordEditField.SetSecure(''5be9ff55937293c391ef'');

var wpfButtonButton = microFocusMyFlightSampleApplicationWindow.Describe(new ButtonDescription
{
ObjectName = @''okButton'',
Text = @''OK''
});
wpfButtonButton.Click();

var fINDFLIGHTSButton = microFocusMyFlightSampleApplicationWindow.Describe(new ButtonDescription
{
ObjectName = @''FIND FLIGHTS'',
Text = @''FIND FLIGHTS''
});
fINDFLIGHTSButton.Click();

var flightsDataGridTable = microFocusMyFlightSampleApplicationWindow.Describe(new TableDescription
{
ObjectName = @''flightsDataGrid''
});
flightsDataGridTable.SelectCell(5, 4);

var sELECTFLIGHTButton = microFocusMyFlightSampleApplicationWindow.Describe(new ButtonDescription
{
ObjectName = @''selectFlightBtn'',
Text = @''SELECT FLIGHT''
});
sELECTFLIGHTButton.Click();

var passengerNameEditField = microFocusMyFlightSampleApplicationWindow.Describe(new EditFieldDescription
{
ObjectName = @''passengerName''
});
passengerNameEditField.SetText(''John'');

var ORDERButton = microFocusMyFlightSampleApplicationWindow.Describe(new ButtonDescription
{
ObjectName = @''orderBtn'',
Text = @''ORDER''
});
ORDERButton.Click();

[1]: https://admhelp.microfocus.com/leanft/en/14.50-14.53/HelpCenter/Content/HowTo/TestObjects_AppModel.htm

Marked as spam
Posted by (Questions: 17, Answers: 807)
Answered on July 30, 2019 8:15 pm
0
You've convinced me. I will look into using App Model going forward.
( at July 30, 2019 8:16 pm)
EyeOnTesting

Welcome back to "EyeOnTesting" brought to you by Orasi Software, Inc.

X
Scroll to Top