npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lbtest

v1.0.3

Published

LoadBooster.com CLI to load test web applications from the command line

Downloads

4

Readme

lbtest CLI

This lbtest tool is a simple command line interface for loadbooster services. It allows you to load test web applications in terminal or integrate loadbooster into your continuous development.

Installation

[sudo] npm install -g lbtest
lbtest configure
Enter your LoadBooster credentials
User Email:  <YOUR_ACCOUNT_EMAIL>
API Token:   <YOUR_API_TOKEN>

You need NodeJS and NPM to do that. And, you can find your api token in account page

Usage

The usage options are simple:

  Usage: lbtest [options] [command]

  Commands:

    configure [options]                   Configure and validate your API token
    run [options]                         Run a load test based on a CasperJs Script or a single URL
    run-test-config [options] <string>    Run a load test based on a test config
    run-scenario [options] <id>           Run a load test based on an user scenario
    validate [options]                    Validate CasperJs Script or a user Scenario
    test-config [options]                 Retrieve your test configs
    scenario [options]                    Retrieve your scenarios
    account                               Show information about your account
    help [command]                        Output help information for this command

  Options:

    -h, --help     output usage information
    -V, --version  output the version number

How to run a load test?

There are three sub commands to start a load test.

1. Run a load test based on a CasperJs Test Script, Selenium HTML Script or a single URL
lbtest run -p 1-100:1 -s ~/casperjs_sample.js
lbtest run -p 1-100:1 -e ~/selenium_html_sample.html
lbtest run -r ireland -p 1-100:1,100:1 --url http://www.example.com

-p,--pattern: Ramp from s(start) to e(end) users in d minutes (s-e:d). i.e. -p 1-100:1,100:2, -p 100:2

-r,--region: california|oregon|virginia|ireland|singapore|tokyo|sydney|saopaulo

If the test status is finished, exit code is 0, failed, exit code is 1, SLA failed, exit code is 3.

Currently, lbtest supports Selenium HTML Script and CasperJs Test Script. The following is a simple CasperJs Test Script sample:

var vuSn=casper.lbParams?casper.lbParams.vuSn:"1";
if (!casper.addMetricsData)
    casper.addMetricsData=function(metrics,value) {console.log(metrics+":"+ value)};

 //sumType: "sum"|"min"|"max"|"avg"
 //default Value: {sumType:"sum", group:"", drawChart:true, color: undefined}
 //usage: casper.addMetricsData(metrics,metricsValue, yourValue1, yourValue2 ...); //metricsValue must be a number, your value can be any type.
if (casper.lbParams){
    casper.lbParams.userDefinedMetrics= {
      "Access homePage Count":{color:"blue"},
    }
}

var accountEmail="test"+vuSn+"@loadbooster.com";
//casper.options.stepTimeout = 3 * 60 * 1000; //default stepTimeout is 3 minutes.

var x = require('casper').selectXPath;

casper.test.begin('step1: open todosdemo', function(test) {
   casper.start('https://loadbooster.com/todosdemo');

   casper.addMetricsData("Access homePage Count",1, "your data 1", "your data 2");

   casper.run(function() {test.done();});
});
2. Run a load test based on an existing test config
lbtest run-test-config -p 1-100:1 'YOUR-TEST-CONFIG-ID'
3. Run a load test based on an existing user scenario
lbtest run-scenario -p 1-100:1 'YOUR-SCENARIO-ID'

how to validate a test script?

Use 'lbtest validate' command to validate a test script file or an existing user scenario.

  Usage: validate [options]
  i.e.   lbtest validate -s ~/casperjs-sample.js
         lbtest validate -e ~/selenium-sample.html
         lbtest validate -u 'YOUR-SCENARIO-ID'

  Options:

    -h, --help                    output usage information
    -s, --script <string>         CasperJs Test Script to validate
    -e, --selenium-script <string>  Selenium test case (HTML file)
    -u, --user-scenario <string>  Scenario Id to validate
    -v, --verbose                 Enable Verbose Mode

A sample validate output result:

[INFO] initialing
[INFO] +5s running
[ERROR] +25s failed

*****The following is the validation result*****

Test file: /home/ubuntu/loadbooster/lib/run_casper.js

****************** first time *******************
# step1: open home page
Access homePage Count:1
# step2:  random error
Access homePage Count:1
[ERROR] [phantom] casper.page.onResourceError:{"errorCode":404,"errorString":"Not Found","id":23,
"url":"http://loadbooster.com:18000/code/404"}
currentStep:{"type":"MainScript","stepNo":2,"name":"step2:  random error"}

License

(The MIT License)

Copyright (c) 2014 qinghai [email protected]

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.