Selenium Framework 4: Understanding Of Linear Framework

Hello Folks,

In this post, we will learn about Linear Framework of Selenium webdriver.

We know, any framework has three base components: Functionality, Code and Data. When we mix up all three base components at same place is called Linear framework.  For example:

Consider you need to automate three scenarios as below:

  1. Login to application and logout.
  2. Register, login and logout.
  3. Delete your account from application.

Let’s understand base components for above scenarios:

  1. Functionality : Login. Logout, Register, Delete Account
  2. Code: Perform Login, Logout, Register and Delete Account
  3. Data: User Name, Details, User Id etc.

Hopefully, you can easily categorize and understand as shown above.

You start coding as below:

TestScript1_LoginLogout : Login Code, Hard coded all required data in script, logout code etc all in same file( Say .java file).

TestScript2_RegisterLoginLogout : Register Code, Rewriting Login Code again, Hard coded all required data in script, logout code etc all in same file( Say .java file).

TestScript2_DeleteAccount : Delete account code, Hard coded all required data in scrip etc all in same file( Say .java file).

You are done!

Advantages:

  1. Very simple.
  2. No need of advance coding knowledge.
  3. You will love copy and paste commands.
  4. You can ask for more time from clients and get more billings. :-p

Disadvantages:

  1. Since you are not using re-usability methodology, you need to rewrite the same reusable code again and again.
  2. Common codes or prerequisite or post-requisite codes are written in to each file causing more lines of code.
  3. Since you are hard coding data in scripts itself, you can not run the same script for different data easily. Manager asks you to run your script for 100 users. You will keep changing data 100 times and run script. Manually you can test functionality faster.
  4. You can not use output of scripts in to other scripts easily. TestScripts2 will generate a user which you can use for login or delete account scripts which you need to manually feed data in scripts.
  5. Maintenance and scalebility need Avenger’s power.  LOL. Any change in login or logout functionality, you need to update in all script files.
  6. You can not give this to anybody who can reuse your code.
  7. You can not setup your code in CI tools like Jenkins.
  8. You will not get good rating and appraisals. Sad!

When to use this framework?

  1. When functionalities are very less, short and straightforward.
  2. You want to make it project specific and no further usage after sometimes.
  3. You want to perform UNIT testing.
  4. Data and functionalities are always fixed and at any point chances of changing data is very minimal.
  5. Your budget and time both are less for project.
  6. You want to present POC on selenium.

If you have any doubt, feel free to comment below.
If you like my posts, please like, comment, share and subscribe.
#ThanksForReading
#HappySelenium

Author: Amod Mahajan

My name is Amod Mahajan and I am an IT employee with 4+ years of experience in Software testing and staying in Bengaluru. My area of interest is Automation testing. I started from basics and went throw so many selenium tutorials. Thanks to Mukesh Otwani as his tutorials are easy and cover basics to advance. I have habit of exploring concepts by deep diving. I used to make notes. I thought of sharing my knowledge through posts and now I am here. #KeepLearning #ShareLearning