cancel
Showing results for 
Search instead for 
Did you mean: 

Setting Baseline File as a Parameter

SOLVED
New Contributor

Setting Baseline File as a Parameter

I want to know if it is possible to set a parameter for a stored baseline file in a File Checkpoint within a keyword test. I am able to set the file that is to be checked as a parameter, but I cannot seem to do the same with a baseline file (the file being compared to).

 

Also, does the Compare Files operation have the capabilty to visually show you the compared files? I know for the File checkpoint it does this, but it looks like the former operation does not.

1 ACCEPTED SOLUTION

Accepted Solutions
Community Hero

Re: Setting Baseline File as a Parameter

Short answer:

 

No.  The reason being is that the way File Checkpoints work in Keyword tests is that baselines for File Checkpoints are objects in the "Files" stores.  If you convert a file checkpoint to Script, it looks like this.

 

function fileCheckpointTest()
{
  //Compares the Description1 Stores item with the 'C:\Temp\Description.xml' file.
  Files.Description1.Check("C:\\Temp\\Description.xml");
}

So, you see, the baseline isn't even a parameter here, only the file to be compared.

 

To do what you're asking, you need to build your checkpoint in Keyword tests differently.  Instead of using the File Checkpoint as it is, you would do a Test Action as "Call Object Method" and the object would be the "Files" object.  From there, call the "Compare" method which allows for two parameters of file names... baseline and test file which you can then pass in as parameters to the keyword test itself.


Robert Martin
[Community Expert Group]
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
Extensions available

View solution in original post

3 REPLIES 3
Community Hero

Re: Setting Baseline File as a Parameter

Short answer:

 

No.  The reason being is that the way File Checkpoints work in Keyword tests is that baselines for File Checkpoints are objects in the "Files" stores.  If you convert a file checkpoint to Script, it looks like this.

 

function fileCheckpointTest()
{
  //Compares the Description1 Stores item with the 'C:\Temp\Description.xml' file.
  Files.Description1.Check("C:\\Temp\\Description.xml");
}

So, you see, the baseline isn't even a parameter here, only the file to be compared.

 

To do what you're asking, you need to build your checkpoint in Keyword tests differently.  Instead of using the File Checkpoint as it is, you would do a Test Action as "Call Object Method" and the object would be the "Files" object.  From there, call the "Compare" method which allows for two parameters of file names... baseline and test file which you can then pass in as parameters to the keyword test itself.


Robert Martin
[Community Expert Group]
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
Extensions available

View solution in original post

New Contributor

Re: Setting Baseline File as a Parameter

Your method does work, my only concern is the Compare method does not provide me a visual comparison of the results, it only gives me a pass/fail in the log. 

 

But thank you for your help

Community Hero

Re: Setting Baseline File as a Parameter

You can save your own screenshots this way:

https://support.smartbear.com/testcomplete/docs/keyword-testing/reference/logging/post-screenshot.ht...

 

What I would do is If the compare fails, then post the screenshot, otherwise don't.  

 

ETA:  This will be useful if the file is open, otherwise not.  Another option is to save a copy of the file to some folder if the compare fails and note the location in the log.

New Here?
Join us and watch the welcome video:
Watch the new Interview
Top Kudoed Authors