Best Practices For Writing Automation 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),

Encapsulat…


This content originally appeared on DEV Community and was authored by Suresh Ayyanna

  1. 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)
  2. 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 source code should be analysed from logs without looking at the source code
    • Generate and save failure proofs outside the src code- videos/data/screenshots/logs
  3. Focus on making your code scalable and faster without
    compromising the code quality

  4. Your code should be platform and system independent

  5. Use as many assertions as possible focus on automated testing
    rather than automation

  6. Leave no hardcoded data in source code

  7. 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)

  8. Use Proper Documentation (Using comments wherever required)

  9. Create code which is can be easily read and modified by others(Important)


This content originally appeared on DEV Community and was authored by Suresh Ayyanna


Print Share Comment Cite Upload Translate Updates
APA

Suresh Ayyanna | Sciencx (2022-01-02T03:35:00+00:00) Best Practices For Writing Automation Test Code. Retrieved from https://www.scien.cx/2022/01/02/best-practices-for-writingautomation-test-code/

MLA
" » Best Practices For Writing Automation Test Code." Suresh Ayyanna | Sciencx - Sunday January 2, 2022, https://www.scien.cx/2022/01/02/best-practices-for-writingautomation-test-code/
HARVARD
Suresh Ayyanna | Sciencx Sunday January 2, 2022 » Best Practices For Writing Automation Test Code., viewed ,<https://www.scien.cx/2022/01/02/best-practices-for-writingautomation-test-code/>
VANCOUVER
Suresh Ayyanna | Sciencx - » Best Practices For Writing Automation Test Code. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2022/01/02/best-practices-for-writingautomation-test-code/
CHICAGO
" » Best Practices For Writing Automation Test Code." Suresh Ayyanna | Sciencx - Accessed . https://www.scien.cx/2022/01/02/best-practices-for-writingautomation-test-code/
IEEE
" » Best Practices For Writing Automation Test Code." Suresh Ayyanna | Sciencx [Online]. Available: https://www.scien.cx/2022/01/02/best-practices-for-writingautomation-test-code/. [Accessed: ]
rf:citation
» Best Practices For Writing Automation Test Code | Suresh Ayyanna | Sciencx | https://www.scien.cx/2022/01/02/best-practices-for-writingautomation-test-code/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.