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:
- Login to application and logout.
- Register, login and logout.
- Delete your account from application.
Let’s understand base components for above scenarios:
- Functionality : Login. Logout, Register, Delete Account
- Code: Perform Login, Logout, Register and Delete Account
- 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!
- Very simple.
- No need of advance coding knowledge.
- You will love copy and paste commands.
- You can ask for more time from clients and get more billings. :-p
- Since you are not using re-usability methodology, you need to rewrite the same reusable code again and again.
- Common codes or prerequisite or post-requisite codes are written in to each file causing more lines of code.
- 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.
- 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.
- Maintenance and scalebility need Avenger’s power. LOL. Any change in login or logout functionality, you need to update in all script files.
- You can not give this to anybody who can reuse your code.
- You can not setup your code in CI tools like Jenkins.
- You will not get good rating and appraisals. Sad!
When to use this framework?
- When functionalities are very less, short and straightforward.
- You want to make it project specific and no further usage after sometimes.
- You want to perform UNIT testing.
- Data and functionalities are always fixed and at any point chances of changing data is very minimal.
- Your budget and time both are less for project.
- 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.