Monday 20 March 2023

Coding Standards for Automation QA- SDET?

 


How to install JDK and set Java Home path in Windows and MacOs ?

Ans: Click here for Steps

Java Interview question Set-1:  SET-01 1-10

Java Interview question Set-2:  SET-02 10-20

Java Interview question Set-3:  SET-03 21-30

How to Call a method in JAVA?


Generic Coding Standards for Automation

  • Use SoftAssertion instead of multiple asserting statements.

  • ReadMe should have all the detailed steps on how to run the Automation Suite.

  • Classes should not have too many "static" imports
  • "private" and "final" methods that don't access instance data should be "static"
  • "Thread.sleep" should not be used in tests
  • Duplication of assertion should be avoided
  • The functionality is good for the users of the code.
  • All UI changes are sensible and look good.
  • Avoid using numbers inside the Xpath.
  • All parallel programming is done safely.
  • The code isn’t more complex than it needs to be.
  • The author isn’t implementing things they might need in the future,
    but don’t know they need now.
  • The developer used clear names for everything.
  • Comments are clear and useful, and mostly explain why instead of what.
  • The code is appropriately documented.
  • The code conforms to the style guides.
  • Take a screenshot of the failed investigation.
  • Refactor to make sure that no duplication is tolerated
  • Redundant parenthesis
  • Constants should always be all-uppercase, with underscores to separate words
  • Use of Constant class and not specific classes

Java Standards for Test Script Design

Java coding standards for automation testing are similar to general coding standards, with some additional considerations specific to automation testing. Here are some general coding standards for automation testing using Java:

  1. Naming Conventions:
    Use meaningful names for classes, methods, and variables. Use CamelCase for class names, and start with a lowercase letter for variable and method names. Use descriptive names that accurately reflect their purpose.

  2. Code Formatting:
    Follow a consistent code formatting style, such as the one recommended by Oracle. Use consistent indentation, avoid excessive line length, and add comments where necessary to explain complex code.

  3. Error Handling:
    Handle exceptions properly in your code. Use try-catch blocks to handle exceptions, and add descriptive error messages that help you understand what went wrong when the code fails.

  4. Modularity:
    Write code that is modular, reusable, and maintainable. Break up your code into smaller, reusable functions, and create classes that encapsulate specific functionality. Use inheritance and polymorphism to create a more modular and maintainable codebase.

  5. Test Design:
    Write code that is easy to test. Use design patterns like Page Object Model (POM) to create code that is easy to test, maintain, and update. Write test cases that are independent, atomic, and repeatable.

  6. Assertions:
    Use assertions in your test code to validate that the application under test is behaving as expected. Use descriptive error messages in your assertions to help you understand what went wrong when the code fails.

  7. Code Review:
    Have a code review process in place to ensure that your code follows established standards, is maintainable, and is easy to test. Review your code with your team and get feedback to improve your coding practices.

By following these Java coding standards for automation testing, you can create more maintainable, reusable, and testable code, which can lead to more efficient and effective automation testing.

  •    How to convert List to array and array to list?

          Click here for Answer

    General rules

    1. Follow standard conventions.
    2. Keep it simple stupid. Simpler is always better.
      Reduce complexity as much as possible.
    3. Boy scout rule. Leave the campground cleaner than you found it.
    4. Always find root cause. Always look for the root cause of a problem.

    Design rules

    1. Keep configurable data at high levels.
    2. Prefer polymorphism to if/else or switch/case.
    3. Separate multi-threading code.
    4. Prevent over-configurability.
    5. Use dependency injection.
    6. Follow Law of Demeter. A class should know only its direct dependencies.

    Understandability tips

    1. Be consistent. If you do something a certain way,
      do all similar things in the same way.
    2. Use explanatory variables.
    3. Encapsulate boundary conditions.
      Boundary conditions are hard to keep track of.
      Put the processing for them in one place.
    4. Prefer dedicated value objects to primitive type.
    5. Avoid logical dependency.
      Don't write methods which works correctly depending on something
      else in the same class.
    6. Avoid negative conditionals.


    Names rules

    1. Choose descriptive and unambiguous names.
    2. Make meaningful distinction.
    3. Use pronounceable names.
    4. Use searchable names.
    5. Replace magic numbers with named constants.
    6. Avoid encodings. Don't append prefixes or type information.

    *******************************************************************
    For any doubts or career guidance from me, reach out here : https://topmate.io/sidharth_shukla

    ********************************************************************

    These commands cover a range of basic UI interactions and are a good starting point for building automated tests with Cypress.

    Do remember that knowing Linux is one of the most important aspect to work as an SDET.

    Basic Linux Commands for Automation QA


    ****************************************

    TOP 15 BDD - CUCUMBER Interview Q&A


    ************************************************

    ✍️AUTHORLinkedIn Profile

    ************************************************

    Learn (API-Microservice)Testing+ Selenium UI Automation-SDET with Self Paced Videos prepared by FAANG employees and LIVE Doubt Session 

    SDET TRANING VIDEOS AVAILABLE with Live Doubt Session(course-1 below,API TRaining Videos With Class Notes and Coding Set) and (API+UI, both course-1 & 2 below) Check Training Page for Course Content or reach out @whatsapp +91-9619094122. 
    This includes classnotes, 300+ interview questions, 3 projects, Java Coding question set for product companies along with career guidance from FAANG employees for Automation and SDET.

    For more details whatsapp : https://lnkd.in/dnBWDM33

    *************************************************

    SeleniumWebdriver Automation Testing Interview Questions:

    https://automationreinvented.blogspot.com/search/label/SeleniumWebdriver

    API Testing Interview Question Set:

    https://automationreinvented.blogspot.com/2022/03/top-80-api-testing-interview-questions.html

    DevOps Interview Q&A:

    https://automationreinvented.blogspot.com/2021/11/top-11-devops-interview-questions-and.html 

    Kubernetes Interview Question Set

    https://automationreinvented.blogspot.com/search/label/Kubernetes

    Docker Interview Question Set

    https://automationreinvented.blogspot.com/Docker

    Linux Interview question Set

    https://automationreinvented.blogspot.com/search/label/Linux

    Automation Testing/SDET Framework Design

    https://automationreinvented.blogspot.com/search/label/FrameworkDesign

    Java Related Interview Question Set

    https://automationreinvented.blogspot.com/search/label/Java

    GIT Interview Question Set:

    https://automationreinvented.blogspot.com/2021/09/top-40-git-interview-questions-and.html

    Coding Interview Question Set:

    https://automationreinvented.blogspot.com/search/label/Coding%20Questions

    Mobile Testing Interview Question Set:

    https://automationreinvented.blogspot.com/search/label/Mobile%20Testing

    Python Interview Question Set for QAE - SDET - SDE:

    https://automationreinvented.blogspot.com/search/label/Python

    No comments:

    Post a Comment

    All Time Popular Posts

    Most Featured Post

    Scenario Based Frequently Asked Interview Q&A on TestNG

      🔺 LinkedIn: https://www.linkedin.com/in/sidharth-shukla-77b53145/ 🔺 Telegram Group:  https://t.me/+FTf_NPb--GQ2ODhl Welcome to our compr...