grunt-perfbudget icon indicating copy to clipboard operation
grunt-perfbudget copied to clipboard

Support for Multiple Tests

Open JordanForeman opened this issue 9 years ago • 3 comments

My particular use case involves running several tests for various types of pages as opposed to testing a single url. I'm not sure what the best way to implement this would be, but I'm envisioning something like:

perfbudget: {
    default: {
        options: {
            url: 'http://google.com',
            key: 'YOUR_KEY_HERE',
            paths: [
                '/',
                '/category',
                '/category/item'
            ]
        }
    }
}

Where the plugin would iterate over the paths provided, append them to the base URL, and kick off a test for each of the full URLs created.

Paths would be an optional parameter, and when not specified the plugin would default to the current behavior.

JordanForeman avatar Aug 11 '14 19:08 JordanForeman

Hmmm...yeah, I follow you. Shouldn't take too much work to pull it off.

tkadlec avatar Sep 23 '14 03:09 tkadlec

As a suggestion, rather than an array of paths, have additional objects per-URL with the ability over-ride any of the settings - I say this because there a frequently cases where the performance budget is different per-page (for instance, little used pages, or particularly rich pages). So, for instance:

{
    "default": {
        "options": {
            "key": "XXXXXXXXXXXXXXXXXXXXX",
            "location": "Dulles:Chrome",
            "timeout": 180,
            "connectivity": "Cable",
            "runs": 1,
            "budget": {
                "render": 5000,
                "loadTime": 7000,
                "visualComplete": 7000,
                "bytesIn": 1000000,
                "requests": 68,
                "SpeedIndex": 4800
            }
        }
    },
    "home": {
        "options": {
            "url": "http://www.google.com",
            "budget": {
                "bytesIn": 1600000
            }
        }
    },
    "home-analytics": {
        "options": {
            "url": "http://www.google.com/analytics/",
            "timeout": 60,
            "connectivity": "DSL"
        }
    }
}

This is much the same as grunt-yslow uses (https://github.com/andyshora/grunt-yslow) and it works well there.

kevindixon avatar Nov 03 '14 17:11 kevindixon

As a temporary workaround, multi-perfbudget-grunt allows multiple tests to be run in a single command.

kevindixon avatar Nov 07 '14 16:11 kevindixon