Timekeeper, a Java/Groovy library that helps tests to compile performance reports in Markdown

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:

  1. how long (seconds) tests take to navigate to a URL in browser
  2. how long tests take to take and save screenshot of a web page
  3. 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:

selenium test

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.

Repository

4 Likes

I have updated Timekeeper to 0.3.3. This release supports sorting rows in tables.

2 Likes

I have updated Timekeepr to v0.4.0, which supports outputting the report in CSV format.