Forum Discussion

eflyerman's avatar
eflyerman
Occasional Contributor
7 years ago

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. us...
  • shankar_r's avatar
    7 years ago

    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

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

    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.