Forum Discussion

mgroen2's avatar
mgroen2
Super Contributor
9 years ago
Solved

Data driven Test Execution with TestExecute: is this possible implement?

I have created a Keyword Data Driven test in TestComplete. The test reads it's test data out of an Excel file, and perform a data driven loop. Works OK.

 

However, now I want another end user (not a tester) to use  TestExecute to execute the same test, however with its own set of testdata. So, a different test data source (of course, the format of the file is the same).

 

Is it possible, in TestExecute, to link the test file (the keyword test), to the source of the test data file (Excel file, for example) to be able to run the same test with different test data, while not having access to TestComplete (the test source itself).

 

I hope it is clear what I mean, and I wonder if this scenario is possible to implement (if so, how to implement)? 

Are there any best practices from fellow-testers, who have implemented such (or similar scenario?)

 

Thanks for your tips and advices!

 

Regards,
Mathijs

  • adapt and add this delphi-like script to your code :

     

    function ReadParams(Argument: string): Boolean;
    var
       i: integer;
    begin
       Result:= False;
       for i:= 0 to BuiltIn.ParamCount do
       begin
         log.Message(ParamStr(i));
         if (ParamStr(i) = Argument) then
         begin
           Result:= True;
           exit;
         end;
       end;
    end;

     

    use it like this :

     

    if (ReadParams('/User1')) then

      ... your code for the User1...

    else if ... etc

5 Replies

  • Marsha_R's avatar
    Marsha_R
    Champion Level 3

    If the end user has a separate copy of the project, then you could just replace the Excel file in that project with one using the same name as yours but different data.

     

    If the end user is running out of your copy of the project, then is there a user name or something you can check first and then pass the Excel file name as a parameter?  

    • mgroen2's avatar
      mgroen2
      Super Contributor

      Thanks for the tip. It's a good approach.

      Could be a good 'workaround', in some situations, but in some situations it's not desired to change filenames (because of usage etc). Still think it's an improvement to implement more segregation between test scripts ('logic'), and test data. 

      For end users this is necessary in particular because they do not run TestComplete.

      • m_essaid's avatar
        m_essaid
        Valued Contributor

        Hi,

         

        I would :

         

          - create a function to read command line parameters of TextExecute (ask me if you need it) and then use a parameter like /User1, or /User2, etc...

          - Use this condition to create by scrip the variable that point on the excel file (for User1, use this excel, for User2, use this, etc...)

         

        That's all

         

        Mehdi