An Interest In:
Web News this Week
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
January 2, 2022 03:35 am GMT
Original Link: https://dev.to/sureshayyanna/best-practices-for-writingautomation-test-code-1laa
Best Practices For WritingAutomation Test Code
- Follow OOPs Concepts Wherever Possible
- Abstraction(base classes),
- Inheritance(multiple implementation of same things/multiple inheritance),
- Polymorphism(many forms with something different)
- Data Hiding(hide unnecessary/sensitive info),
- Encapsulation(Bind small entities into a single large entity)
- Follow Programming Language Guidelines (class name, Method name, package name, variable names)
Reduce code duplicity (think before writing new code)
- can I use/make change in existing code?
- Increase code reusability
- Make your code generic wherever possible
- Leave no hardcoded data in source code
- Keep your static data outside the source code
- Keep your dynamic data dynamic in test code (fetch it from util files)
- Test your code properly, use IDE options such as call hierarchy or show usage to test your changes E2E
- Use Extensive logging- everything which is part of sourcecode should be analysed from logs without looking at the source code
- Generate and save failure proofs outside the src code-videos/data/screenshots/logs
Focus on making your code scalable and faster without
compromising the code qualityYour code should be platform and system independent
Use as many assertions as possible focus on automated testing
rather than automationLeave no hardcoded data in source code
Always think for the future, separate out tech dependencies so
that migration to new tech is easy in case it is needed
10.Keep your tests independent for better results in
multithreading unless they are related (example publisher subscriber related tests)Use Proper Documentation (Using comments wherever required)
Create code which is can be easily read and modified by others(Important)
Original Link: https://dev.to/sureshayyanna/best-practices-for-writingautomation-test-code-1laa
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To