Forum Discussion

alexhdz2007's avatar
alexhdz2007
Occasional Contributor
5 years ago
Solved

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.

  • 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.

3 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    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.

    • alexhdz2007's avatar
      alexhdz2007
      Occasional Contributor

      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