我搜索了一遍,通过SO进行搜索,并通过主机page上推荐的导航时间页面进行了阅读,但无法自行解决。watir-webdriver-performance gem中的response_time,:time_to_first_byte和time_to_last_byte有什么区别?
:response_time
,:time_to_first_byte
和:time_to_last_byte
有什么区别?
从我的理解,以及在导航计时文档,似乎:response_time
应该是:time_to_first_byte
的总和,:time_to_last_byte
,但是在执行我的测试中,我发现事实并非如此。
require 'watir-webdriver-performance'
$response = $browser.performance.summary[:response_time]
$first_byte = $browser.performance.summary[:time_to_first_byte]
$last_byte = $browser.performance.summary[:time_to_last_byte]
def performance_check
puts ("#{$browser.url}: Response time: #{$response}ms.")
puts ("#{$browser.url}: Time to first byte: #{$first_byte}ms.")
puts ("#{$browser.url}: Time to last byte: #{$last_byte}ms.")
end
def test_site_01
$browser.goto("http://www.google.com/")
performance_check
end
我看到的典型输出是:
http://www.google.com: Response time: 1558ms.
http://www.google.com: Time to first byte: 384ms.
http://www.google.com: Time to last byte: 385ms.
谢谢。
非常感谢你:) – Mellissa