Forum Discussion

Astrid's avatar
Astrid
Occasional Contributor
2 years ago

How to propagate script changes back to the keyword test?

I have recorded a keyword test and generated a script from it. I had to make changes to the script due to the fact that the test did not wait for the icon bar to display. I also mistakenly accepted an intelligent fix which caused a "ribbon2" to be created/mapped? I deleted "ribbon2" from the mapping and from the script.

When I run the test from the script it looks for "Ribbon". When I run it from the keyword test it looks for "Ribbon2" and consequently fails.

How can I fix the keyword test to look for "Ribbon" instead of "Ribbon2"? Images attached.

TiA - Astrid

  • Ensure your Name Mapping are defined and structured correctly, and make use of Object Browser

     

    1. It could be a slight bug in TC, hence you can't find the object.

    2. It's not possible to convert scripts to keyword tests

     

    Once you added the property to MSAA, if you use the Object Spy tool, it should highlight each of the buttons. Object Browser may show you more details, like this

     

     

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Look for the keyword test that references Ribbon2, and update it.

     

    If you double click the error in the message log, it should take you straight to the keyword test.

    • Astrid's avatar
      Astrid
      Occasional Contributor

      This is where the double click takes me (KeywordOpenDrawingTest). I do not know how to update the keyword test to reference "Ribbon" instead of "Ribbon2".

      THANK YOU!

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    You need to check your Mapped Objects and Aliases names, and verify the property values of those objects are correct.

     

    In you script file, you can right click on either of the objects in Aliases.draft.wndAfx.Ribbon.Main and select Go to Definition. It will take you to the mapped object.

    • Astrid's avatar
      Astrid
      Occasional Contributor

      Thank You!

      Right clicking on ...ribbon... > Go to Declaration (image: RightclickRibbonDeclaration.png) takes me here (image: RibbonDeclarationMappedObjects.png). What do I do here? I do not find "Ribbon2" to fix it.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Ensure your Name Mapping are defined and structured correctly, and make use of Object Browser

     

    1. It could be a slight bug in TC, hence you can't find the object.

    2. It's not possible to convert scripts to keyword tests

     

    Once you added the property to MSAA, if you use the Object Spy tool, it should highlight each of the buttons. Object Browser may show you more details, like this

     

     

    • Astrid's avatar
      Astrid
      Occasional Contributor

      rraghvani, thank you so much for all of your help. I am marking my question as solved. - My parent Ribbon object has 3 children, Window("ToolbarWindow32", "Main", 2)Window("ToolbarWindow32", "Typical", 1), and Window("#32770", "Ribbon", 1). I am able to individually select buttons only on the Window("#32770", "Ribbon", 1) icon bar but I can get my test to complete by running from the script. Thank You again! There is a LOT to learn!

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    I can't see Ribbon2 being used anywhere ğŸ˜• ?

     

    FYI. If you were to add the WndClass property value 'AfxControlBar140' to MSAA (Project Settings), you might be able to access the individual buttons

     

    • Astrid's avatar
      Astrid
      Occasional Contributor

      Thank You!

      I do not see Ribbon2 anywhere either. Yet when I run the keyword test is fails with Ribbon2Error. When I look at the script generated from the keyword test I get this: Aliases.draft.wndAfx.Ribbon2.Main.CheckItem(40068, true, false);

      I change it to Aliases.draft.wndAfx.Ribbon.Main.CheckItem(40068, true, false); running the script also fails because it does not find Main which is why I insert Aliases.draft.wndAfx.Ribbon.WaitVCLNETObject;
      Delay(5000); and save. Now the script succeeds most of the time.

      I guess my questions are:

      1. why is there an object that I cannot find anywhere? ğŸ˜•
      2. is there a connection between the Keyword test and the script generated from it and, if so, is there a way to propagate the changes made to the script back to the Keyword test?

      I have found MSAA and added AfxControlBar140. Have not had a chance to play with it yet.