{"id":25829,"date":"2021-01-21T21:26:45","date_gmt":"2021-01-21T21:26:45","guid":{"rendered":"https:\/\/applitools.com\/?p=25829"},"modified":"2022-09-27T11:37:30","modified_gmt":"2022-09-27T18:37:30","slug":"visual-ai-hype-or-reality","status":"publish","type":"post","link":"https:\/\/applitools.com\/blog\/visual-ai-hype-or-reality\/","title":{"rendered":"Visual Assertions – Hype or Reality?"},"content":{"rendered":"\n
There is a lot of buzz around Visual Testing these days. You might have read or heard stories about the benefits of visual testing. You might have heard claims like, “more stable code,” “greater coverage,” “faster to code,” and “easier to maintain.” And, you might be wondering, is this a hype of a reality? <\/p>\n\n\n\n
So I conducted an experiment to see how true this really is.<\/p>\n\n\n\n
Here are the observations from this test execution:<\/p>\n\n\n\n
My test implementation got simplified
\n
Less lines of code<\/li>\n
Fewer locators and assertions<\/li>\n
Test became easier to read and extend<\/li>\n<\/ul>\n<\/li><\/ol>\n\n\n\n
Test became more stable
\n
Fewer locators and assertions<\/li>\n
It does not matter if the locators change for elements in the page as long as the user experience \/ look and feel remains as expected. (Of course, locators on which I need to do actions using Selenium need to be the same)<\/li>\n<\/ul>\n<\/li><\/ol>\n\n\n\n
Comprehensive coverage of functionality and user experience
My test focuses on specific functional aspects – but with Visual Assertions, I was able to get validation of the functional change from the whole page, automatically<\/li><\/ul>\n<\/li><\/ol>\n\n\n\n
See these below examples of the nature of validations that were reported by Applitools:<\/p>\n\n\n\n
Version Check – Test 1:<\/p>\n\n\n\n
<\/p>\n\n\n\n
Filter Check – Test 2:<\/p>\n\n\n\n
<\/p>\n\n\n\n
Product Details – Test 3: <\/p>\n\n\n\n
<\/p>\n\n\n\n
Scaling test execution is seamless
\n
I needed to run the tests only on any 1 browser which is available on my machine. I chose Chrome<\/li>\n
With the Applitools Ultrafast Test Cloud, I was able to get results of the functional and visual validations across all supported platforms without any code change, and almost in the same time as a single browser execution. <\/li>\n<\/ul>\n<\/li><\/ol>\n\n\n\n
<\/p>\n\n\n\n
Lastly, an activity I thoroughly enjoyed in Step 2 was the aspect of deleting code that now became irrelevant because of using Visual Assertions.<\/p>\n\n\n\n
Conclusion<\/h1>\n\n\n\n
To conclude, the experiment made it clear – Visual Assertions are not a hype. The below table shows in summary the differences in the 2 approaches discussed earlier in the post.<\/p>\n\n\n\n
Activity<\/th>
Pure Functional Testing<\/th>
Using Applitools Visual Assertions<\/th><\/tr><\/thead>
Number of Tests automated<\/p><\/td>
3<\/p><\/td>
3<\/p><\/td><\/tr>
Time taken to implement tests<\/p><\/td>
90 min (implement + add relevant assertions)<\/p><\/td>
–<\/p><\/td><\/tr>
Time taken to add Visual Assertions to existing Selenium tests<\/p><\/td>
–<\/p><\/td>
\n
10 min<\/p>\n
Includes time taken to delete the assertions and locators that now became irrelevant<\/p>\n<\/td><\/tr>
Lines of code (actual Test method code)<\/p><\/td>
65 lines<\/p><\/td>
7 lines<\/p><\/td><\/tr>
Number of locators used<\/p><\/td>
23<\/p><\/td>
3<\/p><\/td><\/tr>
Number of assertions in Test implementation<\/p><\/td>
\n
16<\/p>\n
This approach validates only specific behavior based on the assertions.<\/p>\n
The first failing assertion stops the test. Remaining assertions do not even get executed<\/p>\n<\/td>
\n
3 (1 in for each test)<\/p>\n
Validates the full screen, captures all regressions and new changes as well in 1 validation<\/p>\n<\/td><\/tr>
Visual Assertions help in the following ways:<\/p>\n\n\n\n
Make your tests more stable<\/li>
Lower maintenance as there are less locators to work with<\/li>
Increase test coverage – you do not need to add assertions for each and every piece of functionality as part of your automation. With Visual Assertions, you will get the full – functional & user experience validation by 1 call<\/li>
Scaling is seamless – with the Ultrafast Test Cloud, you run your test just once, and get validation results across all supported browsers and devices<\/li><\/ul>\n\n\n\n