1
votes

I am writing a lots of tests (cucumber + watir-webdriver + pageobject) and they take a long time to run.

I am wondering if it is possible to know the list of all pages shown in the browser during tests? In fact, I want to verify that each test is optimized, and not go through pages of no use. I can watch all the tests to do that, but I think I will be more efficient by just reading the list of urls.

Has someone already made something like that?

1
Depending how you wrote/organized your tests, I think the easiest way to track this would be to extend watir-webdriver (goto and link.click) or to add an AfterStep in cucumber. It really depends on how your existing code is written and the type of app being tested.Justin Ko

1 Answers

0
votes

Can't you add a log statement to your page objects? I am thinking something like:

require 'time'
require 'logger'

module TestHelper
  pagelog = Logger.new('log.txt')

  class LoginPage

      def initialize()
        pagelog.debug "LoginPage: #{Time.now}"
      end

      ...
    end
end

Or maybe update PageObjects so it will do it automatically for all PageObject classes.