Forum Discussion

Lianne's avatar
Lianne
New Contributor
3 months ago

Looking to pass values from Execution Plan set up

New person (and not a programmer).

I have created a login script using Keyword Test, and set it to use a Variable called UserName.

Is there a way to set up an Execution plan that has

Login using username1

Execute other tests and logout

Login using username2

... and so on.

So basically, is there a way to define which username to use in each reuse of the Login script from within the Execution Plan? it would be great if I could say Login (use username1 in the UserName variable), then change it for each execution of the Login script

  • JDR2500's avatar
    JDR2500
    Frequent Contributor

    You can do what essentially what you're describing with Data Driven Testing.  The idea is you read data from a file (e.g. Excel sheet or CSV), in your case user names, and run the tests with each data item.  This can be done using scripts or in keyword tests.

    Using Keyword Tests for Data-Driven Testing | TestComplete Documentation (smartbear.com)

    I have done exactly what you are describing by reading usernames and passwords from an Excel file I created.

    This tutorial should help:

    Data-Driven Testing With Keyword Tests - Tutorial | TestComplete Documentation (smartbear.com)

  • MW_Didata's avatar
    MW_Didata
    Regular Contributor

    If the test is in the Executionplan multiple times then you can set the parameter to different values.

    I'm using scripts but KWT works the same way

    Looks a little like this:

    Just make sure the Keywordtest uses a Parameter

    You can set them here:

     

  • Not sure if it is possible, I don't use the Execution Plan. May I suggest a different approach.

    Let's assume you are reading from excel sheet all the user names.
    On the project properties you create a variable type "data table" to load excel sheet. 
    On the login script properties you create a UserName parameter.
    On a top controller script you create a data loop to go thru all the sheet values, and call the login script pass to it each value.

  • JDR2500's avatar
    JDR2500
    Frequent Contributor

    In addition to the Data Driven Testing I should mention that parametrizing your keyword tests is another option that more closely matches what you have in mind.  Here is the help topic for that approach:

    Keyword Test Parameters | TestComplete Documentation (smartbear.com)

    It works more like you described.  You pass a test the login name either from another test that calls it, or directly from the Execution Plan.