Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

lbtest

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lbtest

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

  • 0.1.0
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

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 or a single URL
lbtest run -p 1-100:1 -s ~/sample.js
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 only supports 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 todos demo', 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 a 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 ~/sample.js
         lbtest validate -u 'YOUR-SCENARIO-ID'

  Options:

    -h, --help                    output usage information
    -s, --script <string>         CasperJs Test Script to validate
    -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/runscript.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 qinghai@loadbooster.com

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.

Keywords

FAQs

Package last updated on 21 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc