Ask a Question

Run Testcases As Baseline and Testline

SOLVED
TMUGHILENDRAN
Occasional Contributor

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 when i select as Testline it will run the same testcases but it will compare the image that have been saved before.

Is it possible to do with TestComplete.

 

Thanks in Advance.

9 REPLIES 9
tristaanogre
Esteemed Contributor

The first run through you'll have to create all your baselines manually.  You can start with utilizing the Visualizer feature of TestComplete.  You can, during a playback of a test, tell TestComplete to record images of the application under test.  See https://support.smartbear.com/testcomplete/docs/testing-with/visualizer/overview.html.  You can then take the images generated during playback and utilize them to create Region checkpoints (https://support.smartbear.com/testcomplete/docs/testing-with/checkpoints/regions/about.html). 

 

Once you have your region checkpoints added to your project, you have some option settings you can adjust.

 

For updating baselines, you can go to Tools -> Options -> Engines -> Stores.  If you check the flag next to "Update regions", every call to Regions.Compare or Regions.Check will update the stored baseline.  If you uncheck the flag, those calls will do the comparison.

 

Hope this helps.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Regions.Compare needs 2 parameter as Baseline Image and Testline Image like Regions.Check(Picture1,Picture2) 

so how can i check with the Stored image in the Visualizer in Testcomplete and provide me a demo example so i can under that easily.

for example :

 

function Checkregion ()
    Object1.Click()
end function

 

As you can see in this code i like to store Object1 image while playback and when i run it again i want to compare with old image with real time object image.

So can you give me a example for that.

 

Thanks in Advance.

 

Hi,

I have Enabled the flag from Tools -> Options -> Engines -> Stores "Update Regions" still its not working,

for example :

 

function Checkregion ()
    Object1.Click()

    Call Regions.regionsObject.Check(Object1)
end function

 

I have checked the flag in "Update Region" even though its still compare with old image its not updating the region. 

 

 

Thanks in Advance.

Also Is it possible to store all these images to a particular location and get all these image from a given location and compare that with real time application.

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);
        pictureBaseline.Compare(testObject.Picture())
    }
}

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.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

I don't want to load image for each and every file, So is there any way to load a entire folder,

for example i like to save all the image available in Regions to a particular folder and load that folder to a region whenever i want.

 

example.:

function regioncheck()

{

      Regions.Save("c:\temp\test1")

     Regions.Load("c:\temp\test1")

}

 

Like that So, in that c:\temp\test1 contains all the image from the regions in the program.

Again, not out of the box... you would have to use the aqFileSystem object to find all image files in a folder and then, using a for loop, loop through and load each one.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available

Is it possible to change the Regions location where all the Regions image is stored programmatic way.

 

 for example i already have a region name "uan" as you can see in the image. that location showing as "c:\user\mumughil\Download\uan.png" but i wanted to use different image that is available in "c\temp\uan.png" is it possible to change that image location pragmatically.

There are no methods built into the Regions objects that allows you to save an object to a different location.  My suggestion would be that, when you add an image to Regions, first save it to the desired location and then add it.   This will make sure it's in the folder that you want to store it in.


Robert Martin
[Hall of Fame]
Please consider giving a Kudo if I write good stuff
----

Why automate?  I do automated testing because there's only so much a human being can do and remain healthy.  Sleep is a requirement.  So, while people sleep, automation that I create does what I've described above in order to make sure that nothing gets past the final defense of the testing group.
I love good food, good books, good friends, and good fun.

Mysterious Gremlin Master
Vegas Thrill Rider
Extensions available
cancel
Showing results for 
Search instead for 
Did you mean: