Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
August 29, 2022 06:36 pm GMT

Track your test duration

Have you ever increased your test duration by upgrading some dependencies, changing a configuration, ... ?

That happened to me, and that's why I made this project that tracks the duration of each test in a project as well as the timing to run all the tests.

Note: This is a special post to show my Redis Hackathon submission

Overview of My Submission

Redis Timing Tracker will help you to track all the duration of your test. This is useful to know when your time execution suddenly increased.

All test page overview

All test page overview

Single test page overview

Single test page overview

Thanks to graphs, you can easily see the evolution of timings. Each point corresponds to a run, and by clicking on it you can see the commit SHA, to look at what are the changes that has been made.

Of course, if the duration increases that doesn't mean that there is a regression, it can also be due to the add of tests. So you can see number of test executed for a run by clicking on the point.

If there is any point that complicates the read of the graph you can delete it temporarily of the graph to have a better curve or even permanently from the database.

It also detects if the current test did not run at the last execution which probably mean that it has been removed from tests.

You can see it in action: https://redis-timing-tracker.vercel.app/

Note: For now the tracking only works with Jest. And take into account only tests that don't have any error. The full test duration is not persisted if there is a test in error.

Let's see the architecture of the project:

Architecture

I developed a Jest reporter that needs to be added on the project to track its execution test timing.
This reporter will publish the following data on a topic:

  • execution of each test
  • the total execution duration

Then there is a script that subscribes to that topic to process the previous messages.
For example it will store the duration for each started time on a Time Series to display the graph, the info in JSON format to get the information of each run at click. You can see all the information on the README.md.

Submission Category

I submit this project for the Wacky Wildcards.

Language Used

JS/TS/Node.js.

Link to Code

Redis Timing Tracker

What is it?

Track the timing of your jest tests to follow the evolution of time passed for each test.

This way you can know when a change in your configuration, a library upgrade or a change in your test, increased drastically the time passed onyour tests.

All test page overview

All test page overview

Single test page overview

Single test page overview

The Back Office is deployed here: https://redis-timing-tracker.vercel.app/

Note: For now, it doesn't persist data of a test in error, and if there is an error it doesn't persist the full execution duration.

How it works

Here is little achitecture diagram:

Architecture diagram of the project

Stack used

Type structures are written with Typescript.

In this project I use 3 services of the Redis Stack:

  • Redis pub/sub
  • RedisJSON
  • RediSearch
  • RedisTimeSeries

Pub/sub messages

Before looking at how the data is stored. It's important to see how Redis pub/sub is usedEvents are published and subscribed to a topic

Additional Resources / Info

I developped the BO with Next JS and used Chakra UI to build the frontend UI.

I used recharts to draw my graphs.

For the database, I use the node-redis client. And used the following modules:


Original Link: https://dev.to/romaintrotard/track-your-test-duration-39fb

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To