There are two ways in which we can specify the properties of the objects that will be used in our script:-
1. Descriptive Programming – This is the approach that was demonstrated in the previous tutorial where we specified the object’s properties in the TestMethod itself(by copying the object properties on the clipboard).
2. Application Model – Application Model is to LeanFT, what object repository is to UFT. Simply put together, its a collection of Test objects that we can use in our scripts. It acts as a centralized repository which can be shared across different scripts.
Which approach is better is a very subjective question and I will leave that to you to figure out which suits you best. Here is how we can create Application Models in LeanFT:-
1. Either create a completely new LeanFT Application Model Project(by going to File-> New Project-> Test) or Add a new Application Model Project to your solution(right click on Project in Solution explorer and add LeanFT-> Application Model).
2. Define the name of the model as well as a class name. Once the Application Model tsrx file is created, you can start adding objects to it.
3. There are two ways in which we can add the objects:-
a) Specify the object type and properties explicitly by clicking on the + icon on the top left corner:-
b) Open the Object Identification center and after selecting the appropriate object, click on the add to App Model icon :-
After you have the required objects in the Application Model, you can refer to these objects using intelli-sense in the TestMethod code that you can write:-
So this is how you can add objects to the application model and use them in your scripts.
Happy Automating !