Forum Discussion

ray_watson's avatar
ray_watson
New Contributor
15 years ago

Web comparison checkpoint

I have downloaded the trial version of TextComplete to assess if it can be used to support our automated regression test needs and other general testing requirements.



Our platform is web based and one of the first test cases I created was to access some web pages and create a web comparison checkpoint comparing the whole page to the baseline version.



Unfortunately all of the web pages on our platform contain the date/time so every time I do a web page comparison checkpoint, the comparison fails as the date and/or time is different to that of the stored base line web page .



Is there any way to perform a comparison and exclude certain tags/elements from the comparison or some other way to avoid my problem?



Thanks

 

5 Replies

  • ray_watson's avatar
    ray_watson
    New Contributor
    Hi Allen,



    Thank you for the information.  I had already read this help information and was still unsure how to resolve my problem.



    However, I tried another test and changed the Web Comparison mode from 'Compare entire page' to 'Compare only specified tags' and checked 'Links', 'Images' and 'Input Elements' options.



    My initial tests seems to show that this fixes my comparison problem as the comparison no longer fails. Looking at the web page source I can see the element that was failing the comparison was generated by Javascript and was writing a variable finalDate (containing current date/time) on the client side  as follows:



    <SCRIPT>document.write(finalDate);</SCRIPT>


    17:33, 29 décembre 2010 </FONT></TD></TR><!-- Code block added by Arnold R on 18-FEB-09 --><!-- Code block End --></TBODY></TABLE></TD></TR>




    So, the 'Compare only specified tags'  obviously excludes this type of element from the page comparison (i.e. in this case the data  '17:33, 29 décembre 2010 ' generated by the Javascript 'document.write(finalDate)'.



    My only concern now is that I don't understand how changing the web comparison mode worked - that is, I don't know what I am now excluding from the web page comparison.



    I have very little HTML/Java/VB script knowledge so it is not easy for me to understand what elements in the web page witll now be excluded from the comparison (i.e. I assume all elements that are not deemed to fall under the categories: 'Links', 'Images' and 'Input Elements').



    Could you please advise me a little more regarding what the 'Compare only specified tags'  with 'Links', 'Images' and 'Input Elements' option is actually doing and when using this option what am I including and what am I excluding from the web page comparison.



    Thanks

    Ray



  • Hi Ray,





    Enabling each of these options makes TestComplete verify the contents of the checked elements only. All other elements will not be taken into consideration.


  • ray_watson's avatar
    ray_watson
    New Contributor
    Hi Allen,



    Thank you for your reply. I think I now understand much better what tags are being compared and not being compared depending on the otions selected.



    This leaves with a problem that I seem to have two options to avoid my original problem (that the current date and time is present on all of our web pages so all web page checkpoint comparisons fail if entire page is compared):



    1. I compare only Image, Link and Input Tags. The problem with this is that there are lots of tags I want to compare that are not one of these three types. If I do not compare these tags it is not a proper test.



    2. Compare the entire page and accept that every comparison will fail because of the date/time difference. I was hoping to use this option and then just look at each comparison failure in the log to see if anything else other than the date/time tag had failed in the comparison. However, the web page comparison error log only logs the first web page difference so I will only ever see the date/time difference as it appears at the beginning of the page.



    I see that for my optiin 2. that other users have requested that a web page comparison does not stop on the first error (e.g forum post by  

    Pakinam Boghdady named 'About Web Comaprision Checkpoints ') so perhaps you will add this feature in the future.



    If you have no more suggestions regarding how I can avoid my issue then it seems we will not be able to adopt your product for our rgression testing as it is unable to compare web pages where certain elements always differ (i.e. date and time in my case) and there appears to be no workaround to compare these type of web pages.



    Regards

    Ray 





  • Hi Ray,





    As a possible workaround, I can suggest that you save the HTML code of the needed page (the outerHTML property of the Page.HTML object) to a text file instead of using the Web Comparison Checkpoint feature. When executing a test, save the actual HTML code of the page to another file and compare these files by using an external comparing tool (for example, WinMerge).





    You can get the HTML code of a page in the following way:







      var htmlCode = Sys.Process("IEXPLORE").Page("*").Application.Document.getElementsByTagName("HTML")[0].outerHTML; 

      Log.Message("HTML code", htmlCode);







    I see that for my optiin 2. that other users have requested that a web page comparison does not stop on the first error (e.g forum post by   Pakinam Boghdady named 'About Web Comaprision Checkpoints ') so perhaps you will add this feature in the future


    We have such a suggestion in our database, and your request has increased its rating.