GithubHelp home page GithubHelp logo

sauce-log-parser's Introduction

Sauce Log Parser

Build Status

Small python script that analyzes the log.json file provided by a Sauce Labs test.

It gets the time commands took to run and the time in between Sauce Labs sent a response and received another request. With those two metrics it gets the average, min, max and total of them.

This can help determine if a "slow" test is because of Selenium commands/server issue or if there is latency in the connection

NOTE: There is a discrepancy between the total time posted on the Sauce Labs test details page and the total time of between_commands and duration.

This is because the log.json file (which is used by this script) only takes into account test time but does not take into account start up and processing time.

python sel_log_parser.py -h
usage: sel_log_parser.py [-h] [-a ADMIN] [-k ACCESS_KEY] [-u USER] [-s]
                         [-r REGION] [-v] [--csv]
                         job_id [job_id ...]

positional arguments:
  job_id                Sauce Labs Session ID to be examined.

optional arguments:
  -h, --help            show this help message and exit
  -a ADMIN, --admin ADMIN
                        Sauce Admin username. For Saucers only.
  -k ACCESS_KEY, --access_key ACCESS_KEY
                        Sauce Admin access key. For Saucers only.
  -u USER, --user USER  Sauce username. Account Username of the Test Owner
                        that ran the session.
  -s, --save            Save the output as a .log file in cwd. Schema is
                        log_session-id.log.
  -r REGION, --region REGION
                        Sauce region where test was performed(us-west-1, us-
                        east-1, eu-central-1)
  -v, --verbose         Verbose flag to print at debug level
  --csv                 Save the output of all tests as csv in cwd. Schema is
                        date_job-ids.csv

Usage

Run against one session!

python sel_log_parser.py -a $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY -u some-username some-session-id

Run against multiple sessions!

python sel_log_parser.py -a $SAUCE_USERNAME -k $SAUCE_ACCESS_KEY -u some-username some-session-id another-session-id third-session-id ... Nth-session

Output:

---
test_id: your-session-id
duration:
  mean: 0.33958974618178145
  max: 480.00422978401184
  min: 0.0022919178009033203
  total: 551.8333375453949
between_commands:
  mean: 0.1021887963922153
  max: 180.5098659992218
  min: -477.2646918296814
  total: 165.95460534095764

Setup

Manual Setup via git master branch:

  1. cd to a directory where you want the python tools/files.
  2. git clone [email protected]:enriquegh/sauce-log-parser.git
  3. cd sauce-log-parser
  4. pip install -r requirements
  5. Start analysing tests!

Contributing and Testing

Fork the remote master branch and make pull requests. Open issues if something is wrong and copy-paste your input & output.

Launch tests with py.test. Pytest is used and the /tests directory should get you started on seeing what is covered and what tests should look like.

sauce-log-parser's People

Contributors

enriquegh avatar mdsauce avatar bertinwong-saucelabs avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.