Forum Discussion

ryanterronez's avatar
ryanterronez
Occasional Contributor
4 years ago
Solved

Default Parameter

I have a default parameter in my keyword test, it is a url called loginPage:

When I look at the test case in the Execution Plan that parameter is blank:

It feels like the default value of the parameter should be there, any clue why it isn't?

 

  • AlexKaras's avatar
    AlexKaras
    4 years ago

    Hi,

     

    Generally speaking, I agree with you and your described scenario but with two notes:

    -- Synchronization between keyword test and execution plan must work really well so that every change in the keyword test parameters is reflected in the execution plan; and

    -- It must be clear in the execution plan that default value for the parameter is used but not manually entered one.

     

    And just because of these two notes I think that empty value displayed in the execution plan for empty parameter is better than some displayed value that can make you to be uncertain whether or not the default value is used.

    You are welcome to create either Support ticket via the https://support.smartbear.com/testcomplete/message/ form or create a new Feature Request here and reference this thread: https://community.smartbear.com/t5/forums/postpage/board-id/TestXCompleteFeatureRequests

     

5 Replies

  • AlexKaras's avatar
    AlexKaras
    Champion Level 3

    Hi,

     

    [Edited]:

    It feels like the default value of the parameter should be there

    I don't think so.

    In the Execution Plan you are specifying that the last parameter is not passed.

    And in the test you specify that some value must be used as parameter's value if it is absent or null.

    So parameter's actual value during runtime must be equal to the default one. But I don't think that default value must be indicated during design time. (I just see quite a few of potential problems with this and thus I think that current implementation is more relevant.)

     

    • ryanterronez's avatar
      ryanterronez
      Occasional Contributor

      AlexKaras I added a keyword test to the execution plan six times, each run with different values for the parameters.  After running the tests a few dozen times realized I wanted to add another parameter.  So I added the new parameter to the keyword test, with a default value, and the parameter for the test items on the execution plan are blank.  But if I add that keyword test as a new child test item to the execution plan the parameter has the default value.  In my mind I thought that since the default parameter value is tied to that keyword test, then it should update in the execution plan automatically, just like if I were to update the value of a test variable, or keyword test step.  I don't understand why we wouldn't want that to be updated automatically.  If I call a function from a keyword test, then add a default parameter to that function, I don't need to update the keyword test to run that function.  It seems like the exact same scenario, but they behave differently.

      • AlexKaras's avatar
        AlexKaras
        Champion Level 3

        Hi,

         

        Generally speaking, I agree with you and your described scenario but with two notes:

        -- Synchronization between keyword test and execution plan must work really well so that every change in the keyword test parameters is reflected in the execution plan; and

        -- It must be clear in the execution plan that default value for the parameter is used but not manually entered one.

         

        And just because of these two notes I think that empty value displayed in the execution plan for empty parameter is better than some displayed value that can make you to be uncertain whether or not the default value is used.

        You are welcome to create either Support ticket via the https://support.smartbear.com/testcomplete/message/ form or create a new Feature Request here and reference this thread: https://community.smartbear.com/t5/forums/postpage/board-id/TestXCompleteFeatureRequests

         

    • ryanterronez's avatar
      ryanterronez
      Occasional Contributor

      AlexKaras no, I would never pass an empty string as that parameter.  Do I need to mark that parameter not optional?  I only marked it as optional so that I would stop getting a popup every time I ran the test.