Forum Discussion

Occasional Contributor
7 years ago

Run Testcases As Baseline and Testline

Hi,   I need to Run a script in testcomplete as Baseline and Testline options. So When I set that as Baseline it will save all the image of the testcases and save it in a proper location, and whe...
  • tristaanogre's avatar
    7 years ago

    I guess the point I'm trying to make is that, yes, you can do what you're asking... but it's not an "out of the box" functionality.  For what you're asking, you're going to need to write some of your own code to save the files in order to update the baselines and then utilize those saved files in running your tests.  So, I envision a function that would look something like this:

    function imageComparison(testObject, filePath, fileName) {
        //Create a project variable called updateBaseline and make it boolean. 
        //When you want to update your baselines, set it to true
        var pictureBaseline = Utils.Picture();
        if (Project.Variables.updateBaseline) {
            testObject.Picture().SaveToFile(filePath + fileName);
        else {
            pictureBaseline.LoadFromFile(filePath + fileName);

    So, instead of using the built in Regions.Compare or Regions.Check, you would use the above method.  If the project variable is set to true, your baseline files will be updated... if it's set to false, you'll do the comparison.