I have made a GitHub project
Motivation
Often I develop Web UI tests in Groovy using Selenium. I want to measure the performance of the tests. Often I want to measure:
- how long (seconds) tests take to navigate to a URL in browser
- how long tests take to take and save screenshot of a web page
- how large (bytes) is the generated image file
And I want to examine many URLs; 100 or more. In practice, most of URL respond within 10 seconds but a few of them sometimes respond slow (over 30 seconds). Why? What happened? I need to list the slow URLs and look into them.
The 1st problem is that it is bothersome recording the duration using a stopwatch device. I introduced the Apache Commons StopWatch library into my test scripts to measure the duration and print the figure in console messages.
The 2nd problem is that it is difficult to find useful information out of the bulk of console messages. I want to summarise the statistics. But it is too tiresome to write manually a statistics report in Markdown table format.
I want to automate these tasks entirely. I want my tests to perform not only measure performance but also compile a concise report in Markdown format. Here comes the Timekeeper!
Example β Selenium test
Input CSV file is here:
https://www.google.com/search?q=timekeeper,timekeeper_google.png
https://duckduckgo.com/?q=timekeeper&t=h_&ia=web,timekeeper_duckduckgo.png
https://search.yahoo.co.jp/search?p=timekeeper,timekeeper_yahoo.png
The test emits the following Markdown text:
## How long it took to navigate to URLs
as events flowed
|URL|duration|graph|
|:----|----:|:----|
|https://www.google.com/search?q=timekeeper|00:00|`#`|
|https://duckduckgo.com/?q=timekeeper&t=h_&ia=web|00:02|`#`|
|https://search.yahoo.co.jp/search?p=timekeeper|00:04|`#`|
|Average|00:02| |
The format of duration is "minutes:seconds"
one # represents 10 seconds in the duration graph
This Markdown text will be rendered on browser like this:
The code is here, which is coded in Groovy using JUnit 5 + Selenium:
Katalon users would be able to rewrite this into a Test Case in Katalon Studio.
Download
The artifact is available at the Maven Central repository:
Dependencies
Timekeeper was tested on Java8.
See build.gradle
at https://github.com/kazurayam/timekeeper/ for external dependencies.