Skip to main content

Evaluate test case execution against its statistical average run time & user-configured timedelta.

Project description

robotframework-stopwatch

Version

Robot Framework listener extension for agile perfomance testing.

Evaluate test case execution against its statistical average run time & user-configured timedelta in.

Why?

While Robot Framework does provide an ability to setup time limits (e.g. timeouts) as a means of failing tests/suites depending on their time of execution, such approach is somewhat set in stone. Meaning that you have to manually inspect runtimes of your tests and decide upon much needed time limits. When you have single master suite, or your testing production is not quite large - this works alright. But when your number of tests is 300+, managing each timeout individually is rather straining. Add to that multiple layers of configurations such as different environments, testing tools, or downright infrastructure inconsistencies that do occur and you end up quite strained with the idea of reliable perfomance testing. This extension is an attempt to provide a reliable tool for flexible, integrated perfomance testing.

Overview

As mentioned above, robotframework-stopwatch is not quite a library, but extension of built-in Robot Framework Listener.

When first integrated, the StopwatchListener will initialise an empty logfile (by default: ./stopwatch_log.json) to store required run data for every individual test. After first run, taking into consideration the test succeeded, average runtime for this test will be set to this run time of execution. Afterwards, each succesful test runtime will be used to update the last average runtime value for the test. The user-preconfigured timedelta is then used to evaluate all future test runs status. Failed tests, whether due to timedelta exceeded or natural test fails, have no effect upon test average runtime. Extension also provides a log data divider environment to catalog same tests based on different setups.

When test with established average runtime fails due to exceeded time limit, test is marked as failed with a following message output:

Stopwatch! Test runtime exceeded the acceptable time limit.

Installation

pip install robotframework-stopwatch

Usage

robotframework-stopwatch relies on a single base class StopwatchListener, that comes with following attributes:

  • logfile (str): The path to the log file. By default: ./stopwatch_log.json

  • environment (str, optional) The marker/divider used to separate test run data across different configurations.

  • timedelta (str, optional): The time delta value used for evaluating test runtimes. Defaults to "10s". Time formats include: "5s", "2 min", "1 hour".

There are two ways to implement robotframework-stopwatch.

Listener approach

When custom listener is already in-use, or robotframework-stopwatch is needed on a global level (every suite, every test), create or modify the listener:

from robot.stopwatch import StopwatchListener

class CustomListener(StopwatchListener):
    def __init__(self, logfile, environment, timedelta):

This won't interfere with your custon listener functionality.

Command-line approach

When there is a need to set separate timedelta for different suites/tests, or setting up a listener is not required, it is possible to pass StopwatchListener and its command line arguments directly from terminal:

robot --listener robot.stopwatch.StopwatchListener:"logfile":"environment":"timedelta" some_test.robot

Concurecy

As of now, robotframework-stopwatch supports concurent read/write, making it possible to share a logfile data among multiple agents, instances, test runners. To incorporate concurent logging do rely on the most suitable tactics of shared file storage for your organisation (e.g. Azure Shared Storage).

Plans

  1. Interface for setting up test run data log in a remote database.
  2. Robust timedelta time formats.
  3. Robust logfile handling.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

robotframework_stopwatch-0.2.10.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robotframework_stopwatch-0.2.10-py3-none-any.whl (17.6 kB view details)

Uploaded Python 3

File details

Details for the file robotframework_stopwatch-0.2.10.tar.gz.

File metadata

File hashes

Hashes for robotframework_stopwatch-0.2.10.tar.gz
Algorithm Hash digest
SHA256 d6a4258b5fe0b9aaf200bd739c362571839340177af5fb0fc7359bc4263e478f
MD5 9938ffda30bae6ee27105c24d79d055e
BLAKE2b-256 00ff258ee7243c4e5bee82f1f93b94ee42cdacee6fcbf53a83a8210f75f25e5f

See more details on using hashes here.

File details

Details for the file robotframework_stopwatch-0.2.10-py3-none-any.whl.

File metadata

File hashes

Hashes for robotframework_stopwatch-0.2.10-py3-none-any.whl
Algorithm Hash digest
SHA256 793e1803fef7acbb722de21f743d45135c80980acfa1dff9adbcd2abb589e6a8
MD5 1f143630b5a1d06fecd4fa479dd025d4
BLAKE2b-256 a1963cace8fe68f0ef86bb5bc2082dfbe99dd665cbd3398796e8ccf8f1ac2451

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page