Forum Discussion

givanft's avatar
givanft
New Contributor
14 years ago

Is it possible to change old object to a new during execution of the test?



Hello friends!






First - sorry for my english :) 


Please, explain, is it possible to change old object to a new one during execution of the test?



For example I have this line:






  Sys.Process("PowerUserU").Window("#32770", "BCME 2011 PU").Window("Button", "OK").Keys("[Enter]");






now we have a new release 2012 and the line should be:





  Sys.Process("PowerUserU").Window("#32770", "BCME 2012 PU").Window("Button", "OK").Keys("[Enter]");




 so the TestComplete says "unable to find the object ... " and finished the test.



Is it possible in the TestComplete, as for example is it possible in "HP QuickTest Professional", that the TestComplete ask me - is the object actual because I see a new one on the screen with different name?


In other words is it possible to teach it (and do not make manual changes) what should be used now.



Thanks!!!

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor
    TestComplete will not "ask" during execution but there are all sorts of ways to achieve the same deal in the code you write before execution.



    For example, in the code you posted, you could replace it with 



    Sys.Process("PowerUserU").Window("#32770", "BCME * PU").Window("Button", "OK").Keys("[Enter]"); 



    and it will work both for your old version as well as for your new version and for any version afterwards, assuming the caption of the window is always within that particular pattern.



    Now, as for "teaching" TestComplete, TestComplete has a similar feature to QTP's "object repository".  TestComplete calls it "NameMapping" in which you can define objects for use in the tests by a set of criteria that uniquely identifies the object.



    As a good introduction to this, especially as regards objects that have certain dynamic properties, watch the following video.



    http://smartbear.com/support/screencasts/testcomplete/reliable-tests-for-dynamic-objects/