LeanFT Java Tutorial Part 4 – Application Models

In case you missed out on part 3, here you go:-

LeanFT Java Tutorial Part 3 – Object Identification Center

Basically 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 Test Method itself(by copying the object properties from 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. When you navigate to New-> Other -> LeanFT, then you need to decide between the two:-

  • Application Model Item – You need to create this if your Application model needs to be used inside the designated project only. This will be created just like a class inside a package in your project. If you want to use this in other classes in the same package, you can use it directly and if you want to use this in other class in different package, then you need to import the package of the Application Model and then you can use it.
  • Application Model Project – You need to create this if your Application model needs to be used across multiple projects. For using this in another project, you just need to add your project to the build path and then import the corresponding package and start using the objects.

For the sake of this tutorial, I’ll be covering Application Model Item.

2. Define the name as well as the package of the model. After that, you will see an Application Model tsrx file is created. Now 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:-

AppModel1

b) Open the Object Identification center from the App Model and after selecting the appropriate object and the identification properties, click on the add to App Model icon :-

AppModel3

After you have the required objects in the Application Model, you can refer to these objects as follows:-

AppModelJavaJPG

One thing worth noticing here is that I need to pass the browser instance when I want to create an object of my application model. This will enable LeanFT to understand that all objects in my application model are to be identified with the passed browser object as the parent. Passing browser is required only in case of Web Automation scripts, for other technologies we can create the application model object without passing a context object.

So this is how you can add objects to the application model and use them in your scripts.

LeanFT Java Tutorial Part 5 – Finding Child Objects

Happy Automating !
Harshit Kohli

Advertisements

Eat, Sleep, Automate. REPEAT !

Tagged with: , , , , , ,
Posted in LeanFT
2 comments on “LeanFT Java Tutorial Part 4 – Application Models
  1. […] LeanFT Java Tutorial Part 4 – Application Models […]

  2. Daniel Camenzind says:

    Hi Harshit
    I have problem automating date picker control of an app in general.(iOS or Android) using LeanFT! Do you have anything on this subject?
    Thanks and regards
    Daniel

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog Stats
  • 168,130 hits
Categories

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 796 other followers

%d bloggers like this: