Forum Discussion

heidi_n's avatar
heidi_n
Regular Contributor
7 years ago

If 1 Object Name Changes - How to mass update/fix 2,000 tests that use that object?

We have around 2,000 tests that use the same login prompt at the beginning of each test. When you enter your User Name, the field is called "eusername". What if development changes this object name to "login" or something different, for example? What if they decided to change the form name? How would I mass update/fix my 2,000 tests that use this? They would all become broken and get "object does not exist" due to the object rename. Any feedback is appreciated.

 

 

2 Replies

  • shankar_r's avatar
    shankar_r
    Community Hero

    Best way is to have separate Test Item for Login alone then you can refer that in all of your 2000 keyword tests.

     

    1) Create a Keyword test which contains only Login module.

    2) Add that created Login keyword as a Item in your all tests.

     

    To do that you can do following,

     

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    Question: Are you using name mapping? If so, then what the developers change the component identifying factors, your tests don't need to change, all you need to do is update your mapping to use the new values.  Your tests will inherit those changes.  This is the advantage of using name mapping in that you don't need to go through end edit the naming of your objects all over the place... centralized repository of objects, basically.

     

    If you're not using NameMapping, then things are a bit more challenging, of course.  Keyword tests don't do will with "Replace All" across multiple tests.  What I would do is go with what is always a good development best practice: no duplicated code.  If you see the same general code being repeated multiple times (and your login steps is exactly that), then it's best to pull that code out of the test and make it a separate keyword test or even a script function that you would call in all your tests.  That way, when development changes the login process, components, etc., you don't need to change 2000 tests, you just need to change the libraried function.  Even if you ARE using namemapping, this is highly recommended as a best practice to follow.  It will help in the maintenance of your application testing in the long run.