Is there a library to track new code changes pushed to a webpage?

My developers have a not so fun habit of renaming html names, ids, etc without telling me. So I run my code and it breaks and then I get to hunt through the code to find the changes and update my tests. Is there a library or something to automate finding these changes through some type of code comparison? I’m still a RF and Python newbie but I googled the hell out of it and didn’t find any solutions. Thanks.

Hi Greg,

I’m not aware of any, but before I make some suggestions on how you could deal with it by code I’ll suggest you first try tackling it at an organisational level.

  • Start by reviewing your non functional requirements, if there is a anything at all there you can use to defect the constant changing of the ID’s raise a defect.
  • If that fails discuss the matter with your test manager, and see if he can get the business to agree to implement a non functional requirement for constant ID’s that don’t change from release to release, pitch it as a cost saving for the organisation, less time you spend maintaining test scripts allowing testing to finish faster improving quality for the organisation

If all that fails maybe others can offer some more suggestions how to deal development managers to get their team to behave more professionally?

If all else fails then resort to code, assuming you are using SeleniumLibrary and you can navigate to the screens with simple click where is the text of the hyperlink (if the text visible to the user keeps changing without a change request, then this should probably be a functional defect)

  • write a keyword (KW1) that takes a list object and a file name as arguments this keyword should create a text file with using the file name and each list item as a single line in the file
  • [Optional] write a keyword (KW2) that takes a list of web elements and returns a list of ID’s, for seleniumlibrary this would be combination of a for loop and Get Element Attribute
  • create a keyword (KW3) that takes the page name (${pagename}) and a html tag as an argument (i.e. ${tag}) this keyword should do the following:
    • using Get WebElements //${tag} to get a list of elements for that tag type
    • [Optional] pass this list of elements to KW2
    • pass this list to KW1, the text file should be named ${pagename}_${tag}_previous.txt
  • write a keyword (KW4) that takes a page name as an argument (${pagename}) and calls KW3 for each of the element types that are having their ID’s changing all the time e.g.
    KW3 ${pagename} input
    KW3 ${pagename} button
    KW3 ${pagename} form
  • write a seperate test case for each page that you need to test that navigates to the page and then calls KW4.

run the test suite once, this will generate the original (previous) text files

obviously when you do this the first time on the same release they should all pass (this becomes your baseline)

Last thing to do is to move/remove all the *_previous.txt and then rename all the *_new.txt to *_previous.txt ready for you next release.

Hope this helps,