cancel
Showing results for 
Search instead for 
Did you mean: 

Iterative data driven CI

SOLVED
Highlighted
Occasional Contributor

Iterative data driven CI

I'm sure I'm not the first to ask this question however I don't see an answer here.

 

We want to incorporate TC as part of the CI cycle.  Our tests create data that can only be created once i.e. users, products, documents etc.  Subsequent tests with the same data will fail.  We can generate hundreds of rows of test data and specify on the data loop only to run row 1 of the test data. The next iteration, we have to change the keyword test data loop to use row 2 and repeat for every execution.  This manual process won't work in an automated CI cycle.

 

I've ditched the keyword test and written javascript to use the excel drivers for the data loop.  How can I pass the starting row number from the CI tool (Jenkins) on the command line?  Do I have to write the value to a text file and read the text file in the javascript to load it into a project variable?

 

TIA

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: Iterative data driven CI

Hi,

 

There are two ways you to achieve your scenarios,

 

Way #1:

 

In Jenkins, TestComplete build step you can additional command line arguments to get your value into TestComplete.

 

Step 1: Add a parameter for your jenkins build

param.PNG

Step 2: Use that parameter in additional command line arguments, as like below

buildstep.PNG

Step 3: In your project suite, Create a OnStartTest event, add below code into that

function GeneralEvents_OnStartTest(Sender)
{
      Project.Variables.StartRow = returnParamValue("StartRow");
}
function returnParamValue(strParamName){
      for(var i = 0 ; i < BuiltIn.ParamCount() ; i++){
            var currentParamName = BuiltIn.ParamStr(i);
            if(aqString.Find(currentParamName,strParamName,0,true) != -1 ){
                    var arr = currentParamName.split("=");
                    return arr[1];
            }
      }     
}

Step 4: Now you can use your Project.Variables.StartRow.

 

Way #2:

As you mentioned in the getting value from some text file. In this scenario, when you run in jenkins it is difficult to give dynamic path.

 

I would prefer 1st way which is very dynamic and easy to understand but need some time for initial setup.

 

 

 


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”


Extension Available

View solution in original post

2 REPLIES 2
Highlighted
Community Hero

Re: Iterative data driven CI

Hi,

 

There are two ways you to achieve your scenarios,

 

Way #1:

 

In Jenkins, TestComplete build step you can additional command line arguments to get your value into TestComplete.

 

Step 1: Add a parameter for your jenkins build

param.PNG

Step 2: Use that parameter in additional command line arguments, as like below

buildstep.PNG

Step 3: In your project suite, Create a OnStartTest event, add below code into that

function GeneralEvents_OnStartTest(Sender)
{
      Project.Variables.StartRow = returnParamValue("StartRow");
}
function returnParamValue(strParamName){
      for(var i = 0 ; i < BuiltIn.ParamCount() ; i++){
            var currentParamName = BuiltIn.ParamStr(i);
            if(aqString.Find(currentParamName,strParamName,0,true) != -1 ){
                    var arr = currentParamName.split("=");
                    return arr[1];
            }
      }     
}

Step 4: Now you can use your Project.Variables.StartRow.

 

Way #2:

As you mentioned in the getting value from some text file. In this scenario, when you run in jenkins it is difficult to give dynamic path.

 

I would prefer 1st way which is very dynamic and easy to understand but need some time for initial setup.

 

 

 


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”


Extension Available

View solution in original post

Highlighted
Occasional Contributor

Re: Iterative data driven CI

This:
            var currentParamName = BuiltIn.ParamStr(i);            

is exactly what i was looking for; the missing piece.

 

Thank you.

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors