Forum Discussion

Lee_M's avatar
Lee_M
Community Hero
4 years ago

UserForms - click to run

I am creating a Userform that has a button to run a test

I can use the OnClick event to call a script test but NOT A KEYWORD test

 

any idea how to do this, without creating a keyword test call from a test

 

  • Lee_M's avatar
    Lee_M
    4 years ago

    when I click on the EH section of the component I get these options

     

     

    They can only call scripts

     

     

     

    SmartBear has confirmed to me yesterday that you can only call scripts, although you can create a script that calls the KW test these can not be called directly

     

    SB has suggested that, since the UserForms are not the most frequently used tool this functionality is not lightly to change

    - it is a limitation that can easily be worked around and good to know this is the only option available here for now

  • Hello,

    I am confused at what the end goal is here? Are we trying to trigger a script via keyword test, or trigger a keyword test in script?

    You could drag and drop your script into the keyword test.

    Or in any of the available scripting languages call: "Keywordtests.(Test Name).run()"

    I hope this helps!

    • Lee_M's avatar
      Lee_M
      Community Hero

      I am trying to trigger a KW test from a button press

       

      I can call a script function in the event handler but I was trying to find if there was a more direct way

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    I can use the OnClick event to call a script test but NOT A KEYWORD test

    Can you provide your code for OnClick event?

    My expectation is that it must be possible to use KeywordTests object as suggested by mattb.

     

    • Lee_M's avatar
      Lee_M
      Community Hero

      when I click on the EH section of the component I get these options

       

       

      They can only call scripts

       

       

       

      SmartBear has confirmed to me yesterday that you can only call scripts, although you can create a script that calls the KW test these can not be called directly

       

      SB has suggested that, since the UserForms are not the most frequently used tool this functionality is not lightly to change

      - it is a limitation that can easily be worked around and good to know this is the only option available here for now

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        Ah, I see now...

        Yes, only script routines can be assigned as event handlers for both User Form events and Project events (like OnUnexpectedWindow).

        Thank you for the detailed update and reference to Support's reply.