All Projects → ojkelly → Wedgetail

ojkelly / Wedgetail

Licence: mit
Time your functions in your tests

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects

Projects that are alternatives of or similar to Wedgetail

Openrunner
Computest Openrunner: Benchmark and functional testing for frontend-heavy web applications
Stars: ✭ 16 (-78.38%)
Mutual labels:  testing-tools, performance-testing
Dynamometer
A tool for scale and performance testing of HDFS with a specific focus on the NameNode.
Stars: ✭ 122 (+64.86%)
Mutual labels:  performance-testing, testing-tools
Awesome K6
A curated list of resources on automated load- and performance testing using k6 🗻
Stars: ✭ 78 (+5.41%)
Mutual labels:  performance-testing, testing-tools
AutoMeter-API
AutoMeter-API是一款针对分布式服务,微服务API功能和性能一体的自动化测试平台,一站式解决应用,服务,API,环境管理,用例,条件,测试场景,计划,测试报告,功能/性能测试兼容支持的一体化工作平台
Stars: ✭ 105 (+41.89%)
Mutual labels:  testing-tools, performance-testing
Suman
🌇 🌆 🌉 Advanced, user-friendly, language-agnostic, super-high-performance test runner. http://sumanjs.org
Stars: ✭ 57 (-22.97%)
Mutual labels:  performance-testing, testing-tools
rfswarm
Robot Framework Swarm
Stars: ✭ 68 (-8.11%)
Mutual labels:  testing-tools, performance-testing
Webapibenchmark
Web api management and performance testing tools
Stars: ✭ 143 (+93.24%)
Mutual labels:  performance-testing, testing-tools
JUnitPerf
API performance testing framework built using JUnit
Stars: ✭ 48 (-35.14%)
Mutual labels:  testing-tools, performance-testing
Awesome Test Automation
A curated list of awesome test automation frameworks, tools, libraries, and software for different programming languages. Sponsored by http://sdclabs.com
Stars: ✭ 4,712 (+6267.57%)
Mutual labels:  performance-testing, testing-tools
Zazkia
tcp proxy to simulate connection problems
Stars: ✭ 49 (-33.78%)
Mutual labels:  testing-tools
Tank
Tank is a downloadable application that can be used to load test websites
Stars: ✭ 61 (-17.57%)
Mutual labels:  performance-testing
Docker Google Lighthouse
Google Lighthouse - Docker Image
Stars: ✭ 46 (-37.84%)
Mutual labels:  performance-testing
Hrrs
Record, transform, and replay HTTP requests in Java EE and Spring applications.
Stars: ✭ 54 (-27.03%)
Mutual labels:  performance-testing
Jmeter Java Dsl
Simple API to run JMeter performance tests in an VCS and programmers friendly way
Stars: ✭ 63 (-14.86%)
Mutual labels:  performance-testing
Pytest Mimesis
Mimesis integration with the pytest test runner. This plugin provider useful fixtures based on providers from Mimesis.
Stars: ✭ 46 (-37.84%)
Mutual labels:  testing-tools
Assert
A collection of convenient assertions for Swift testing
Stars: ✭ 69 (-6.76%)
Mutual labels:  testing-tools
Imatcher
Image comparison library
Stars: ✭ 44 (-40.54%)
Mutual labels:  testing-tools
Componentfixture
🛠️Interactive sandox playground for vue components
Stars: ✭ 44 (-40.54%)
Mutual labels:  testing-tools
Reportportal
Main Repository. Report Portal starts here - see readme below.
Stars: ✭ 1,175 (+1487.84%)
Mutual labels:  testing-tools
Expect Playwright
Jest utility matcher functions to simplify expect statements for the usage with Playwright.
Stars: ✭ 66 (-10.81%)
Mutual labels:  testing-tools

Wedgetail

Performance test your functions

View on npm npm downloads Dependencies Build Status codecov NSP StatusKnown Vulnerabilities FOSSA Status

Wedgetail is a small performance tesing library that runs on NodeJS 9.5.0 and above. It's designed to be used inside your tests, to ensure your desired function is always as fast as you want it to be.

Getting Started

Add wedgetail to your devDependencies.

yarn add -D wedgetail

npm install --save-dev wedgetail

Wedgetail can be easily inserted into your tests. It's reccomended you create a seperate test just for performance, as you cannot use the result of the function you are testing.

The function you are testing can also be your whole test.

Usage

To use wedgetail you need to call in inside the callback.

// javascript
import test from "ava";

import { timeExecution } from "wedgetail";

test("Can time a function", async t => {
    // This object contains a definition of the threshold
    // at which your function is too slow.
    // All timings are in milliseconds(ms)
    const allowedPerformance = {
        average: 0.001,
        high: 1,
        low: 0.001,
        percentiles: {
            ninetieth: 0.0004,
            ninetyFifth: 0.001,
            ninetyNinth: 0.001,
            tenth: 0.0005,
        },
    };

    const timings = await timeExecution({
        expectedTimings: allowedPerformance,
        numberOfExecutions: 5000,
        // By using an anonymous arrow function you should
        // be able to maintain the correct scope
        // of `this`.
        callback: () => {
            // Your function goes here
            Math.sqrt(Math.random());
        },
    });
    // You can use any testing or assertion library.
    // if the timings are below your expected values then
    // `timings.results.passed` will be `true`
    t.true(timings.results.passed, "timings failed");
});
// typescript
import test from "ava";

import { timeExecution, Timings, TimedPerformance } from "wedgetail";

test("Can time a function", async t => {
    // This object contains a definition of the threshold
    // at which your function is too slow.
    // All timings are in milliseconds(ms)
    const allowedPerformance: Timings = {
        average: 0.001,
        high: 1,
        low: 0.001,
        percentiles: {
            ninetieth: 0.0004,
            ninetyFifth: 0.001,
            ninetyNinth: 0.001,
            tenth: 0.0005,
        },
    };

    const timings: TimedPerformance = await timeExecution({
        expectedTimings: allowedPerformance,
        numberOfExecutions: 5000,
        // By using an anonymous arrow function you should
        // be able to maintain the correct scope
        // of `this`.
        callback: () => {
            // Your function goes here
            Math.sqrt(Math.random());
        },
    });
    // You can use any testing or assertion library.
    // if the timings are below your expected values then
    // `timings.results.passed` will be `true`
    t.true(timings.results.passed, "timings failed");
});

You will need to play around with numberOfExecutions to find the right number. If your function is slow (2ms+) you may want to use a number less than 5000.

Running the tests

Use yarn tests or npm run tests.

Tests are written with ava, and we would strongly like tests with any new functionality.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

FOSSA Status

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].