-1

I want to design a framework which will run on top of existing selenium webdriver automation framework and my idea is to find the test coverage of application.

Initially I'm just looking for a Proof of Concept.

I am thinking to do it in following steps:

  1. Find all the click able web elements of a page, suppose If I am talking about google home page then there are few click able links like Gmail, News, You Tube etc. So first I want to store & count all these links in some storage probably in an xml file.

  2. Find all the web elements of google homepage, which get handled in my existing selenium framework (I'm using POM framework), For google home page I have handled only Gmail and You tube link.

  3. Compare the result of 1 & 2 and check how many elements are still pending to implement some action in existing selenium framework. As I mentioned for an example that Google homepage has 3 click able links but in my framework only two have been handled it means the coverage is around (2/3)*100 = 66.6%.

I know this not very accurate result but for a proof of concept it'd be sufficient to implement this concept.

To perform this comparison I am thinking to use some kind of mechanism for e.g. an xml file where I can store the result of 1 & 2.

I'm not sure there is any tool available in market which can find test coverage (not code coverage).

This is only for Proof of concept

Priyanshu
  • 3,040
  • 3
  • 27
  • 34

1 Answers1

1

In the web page, retreive all the hyper links through the below code. If you want other objects also to be included, change the xpath accordingly.

List linkElements = driver.findElements(By.xpath("//a[@href]"));