Forum Discussion

ivan_sy's avatar
ivan_sy
Contributor
11 years ago

Search and repalce a specific operation on all KeywordTests

We are just using the default TestComplete automatic namemapping during recording and so far we have no problems with it. Our application now has a newer branch, with a support for HTML formmatting on the same spot where the normal textcontrol is - buttom line, it's a new object. I have edited namemapping mapped object to do conditional mode, to support both the old textcontrol and the HTML capable textcontrol and I am happy that it works.



However, the problem now is that most KeywordTests uses the operation SetText() and the newer object doesn't have SetText() but just set_text(). The old object supports both SetText() and set_text() - so it was a poor decision of not using set_text() - well we haven't known that till now.



Is there a way to do a search and replace functionality for all KeywordTests in the project to change all instances of SetText() to set_text() ?


  • Hi Ivan,


     


    It looks like my suggestion won't work for this control. I suggest that you vote for it on this page - this way, implementing support for your control in one of the future updates will get a higher priority.


     


    At the moment, using set_text seems to be the only option. So, you will have to modify the keyword test. I suggest that you do it outside TestComplete by changing the corresponding .tcKDTest  file (TestComplete can search only though the Value column in the Keyword Editor, but you need to change the Operation column).

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Ivan,


     


    It looks like my suggestion won't work for this control. I suggest that you vote for it on this page - this way, implementing support for your control in one of the future updates will get a higher priority.


     


    At the moment, using set_text seems to be the only option. So, you will have to modify the keyword test. I suggest that you do it outside TestComplete by changing the corresponding .tcKDTest  file (TestComplete can search only though the Value column in the Keyword Editor, but you need to change the Operation column).

  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Ivan,


     


    The set_text method seems to be a custom method of the control while SetText is the one provided by TestComplete. You don't see the SetText action as the control may not have special support in TestComplete. However, it looks like this control is inherited from the one that is supported by the tool. So, you can try using the Object Mapping feature to make TestComplete treat the control as a supported control. In this case, SetText will be available for the controls, and there will be no need to modify the test.

  • Hi Tanya.  thank you for pointing that out.



    I tried to add the Class using the "Add From Screen", it uses the WndClass value and playing it gave me this error:



    Unable to find the object SetText("act"). See Additional Information for details.

    The object with the specified attributes does not exist.



    Possible causes of the error




    I removed that class and added it manually as "TXTextControl.TextControl" (which is the value of ClrFullClassName



    There's no error but TestComplete was not able to set the text on it. As I view it while in playback, it does nothing.



    The control is documented here:

    http://www.textcontrol.com/en_US/support/documentation/dotnet/n_textcontrol.htm



    It looks like a richtextbox and it is intended to be an HTML editor, more like a richtextbox but for HTML editing. It also wrapped inside (its parent object) an Infragistics Ultrapanel (if that matters)



    What can you advise?
  • Hi Tanya,



    I have a follow up question on this--it sounds like you have already answered it, but I am hoping that you may have suggestions.



    We have a project suite that is composed mostly of keyword tests.



    If we need to change a keyword operation for an entirely different one, is there an efficient way to accomplish that?



    Similary to Ivan's question, how could I find all Delay keyword operations in the project suite and replace them with Run Script Routine operations?



    Any suggestions would be appreciated.



    Thanks,

    Daniel
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)
    Hi Daniel,

     


    Right now, TestComplete can search through the Value column in keyword tests. As the Delay command is specified in the Operation column, TC won't find anything there. So, the only option is to modify the .tcKDTest file.