Issued Encountered During Automation and How You Fixed Them

  • There are multiple test methods in the same class. There is an order they need to execute. Otherwise, it will cause script failure

    • Method 01 : Update the test method name based on the alphabetical order  
    • Method 02: Use priority attribute in TestNG 

  • When loading a specific page, there is a script failure since a progress dialogue appears and disappears after a few millisecond's

    • Add implicit wait
    • Add explicit wait with Expected Conditions stalenessOf()

  • There is a node tree. After adding a new node web driver cannot identify it because there is a scroll bar appears.

    • Use the JavaScriptExecutor class and executeScript() method
    • Use ScrollIntoView method

  • Add exception handling for a few methods to avoid null pointer exception

    • When the driver tries to expand the node but it is not possible to expand add a try-catch block
    • When uploading an image and the user cannot identify the file add try-catch block statements

  • When we want to know the exact time our sign or save actions happened

    •  I have a block of code in those methods to save the time
    • WorkingMemory.getInstance().setMemory("getChangeContactTime",
    •  dateTimeFormatter.format(date_today));
    • Above line of code is on the page object method
    • In the test script I have passed a varibale to assertions
    • String note_time = WorkingMemory.getInstance().getMemory("getNoteDateTimeValue");

  • When the Test script is not identified the dialog if it opened in the second time

    • I have identified that dialogues are not finalized after using
    • Those dialogues are supposed to be finalized after logging out from the application
    • So this is a code-level issue
    • When it comes to the user end scenario user does not always not log out of the application so it should be possible to identify the dialog within the same dialog 
    • So it cannot be fixed by adding wait, changing the identification method (class, id, container title)

  • The script failed while trying to identify the created keyword

    • The script is working in other environments
    • Only one environment it is not working
    • One thing can do is enable screenshots during a failure
    • I have used VMware to execute the script
    • We can open VMWare and watch the execution
    • What happened was a scroll bar appeared and created keywords were displayed after the scroll bar so it is not possible to identify
    • My approach was after creating the keyword refresh the page
    • select the necessary node expand it then select the keyword do the actions and collapse the node

  • It is possible to have the same name for multiple keywords. In that case how to identify specific keyword
    • There is an option to select a keyword by name
    • But when duplicate names are there better to go with keyword id

  • We have nodes in a tree hierarchy. Once we add a child node the number of nodes is updated. If we execute our code in different environments test script fails since it cannot identify the parent node
    • Parent nodes have names like this
      • medical history[34]
      • Diagnosis[23]
    • In our QA automation environment the data is the same there is no change since with nightly installation db is restored 
    • When we execute the script in another environment if the data is different script will fail since the number of child nodes is different 
    • I have to create a separate method for selecting the parent node
    • So I have to go with the index number instead of the visible text
    • then select the node expand then select the keyword then do the necessary actions

  • Sometimes different keywords can have the same name. In that case script will fail since there are multiple keywords with the same name.

    •  So we have an option to select the keyword by id 
    • I have created a method to select the keyword by id

  • Some configurations like global settings and selections need to be applied before executing the script and it takes around 3 minutes

    • Use implicit wait
    • Use thread sleep

  • Sometimes local project doesn't get latest changes from the remote repo. What Can I do ?
    • First I trigger mvn clean install
      • So it will start compiling the changes by clean state by deleting target folder and re creating jar and war files
    • If that doesn't work check whether external libraries section it is display correct version of the remote repo I wanted
    • If it is not there clean the mvn repo manually and trigger mvn clean install command again

  • Page objects become unmanageable when it exceed more than 50 pages. What is the solution?
    • Create dynamic page objects
      • Consider making your page objects more dynamic
      • Instead of having separate class for each page create more generic page object that can adapt to different pages based on parameters
    • Reusable components
      • Identify common components across pages and create separate classes or components for them
      • Reuse these components in different pages
      • This can include common dialog, footer and navigation 
    • Divide into sub modules
      • Group related pages into modules or sections
      • Authentication, Login, Product, Checkout
    • Use Page Object hierarchies
      • Create hierarchy of page objects
      • Have a base object that contains common elements and behaviors shared across multiple pages
      • Subclass this page for specific pages or modules
    • Continuous refactoring
      • Regularly review and refactoring our page object model
      • Continuous improvement is the key to maintaining a scalable and manageable framework

  • When executing automation in the remote desktop machine then the screen of our machine screen needs to stay focused and not sleep or locked. If it is locked scripts will get failed. What is the solution?

    • If suddenly we forget and lock the machine execution failed 
    • If suddenly power cut script execution failed
    • So we used vmware application as the solution
      • When our machine is added to vmware then we have to log into our machine through vmware 
      • Then start execution
      • Now it will execute even though our machine is switched off shut down or locked there is no harm to the execution
  • In the same dialog if we are searching a value multiple times then it will keep caching the previous value. So how to handle this situation?
    • call the clear() method before sending text in the input field
    • Otherwise, it will type the word together with the previous word will cause inaccurate search results
  • When you have to execute scripts in different environments your script depends on data in the given environment. If scripts failed due to data what should be the solution?
    • Write data scripts separately
    • Make sure to execute them before executing scripts
    • Always try to create new data rather than depending on existing data

  • How to automate printing functionalities? Print preview is open using 3rd party software called SAP Crystal Report Viewer.

    • Verifying the print preview is crucial and it is very important 
    • It is hard to verify the print preview since it is opened as a separate window outside the client
    • So there is an XML generated when printing a note
    • If we verify XML it is the same as the print preview


Comments

Popular posts from this blog

False Positive

100% Percent Test Coverage