Giter Club home page Giter Club logo

sireg's Introduction

sireg - regression testing for websites

Travis David

This tool helps you regression test your website. Never deploy a change to your website that breaks parts of it. The tool performs HTTP requests to a given set of URLs and regression tests whether the status code is 200. The tool supports rewriting the loaded URLs so that you can point the tool to a staging server in your build pipeline.

Features:

  • Load URLs from existing sitemaps or a text file.
  • Easily specify a target server where all loaded URLs are rewritten to.
  • Roll your own: the architecture of the tool makes it easy to adjust it to complex setups.
  • Shipped as a single, self-contained executable for any OS.
  • Easy to add to an existing build pipeline.
  • JSON Schema support to setup regression test suites.

Under construction: The tool is currently being developed, so anything may change anytime. If you'd like to shape the future of the project, get in touch and open a PR :-)

Table of Contents

Workflow

The workflow of sireg is straight forward:

[Load URLS] ▶️ [Filter URLs]* ▶️ [Apply URL replacements] ▶️ [Request URLs] ▶️ [Report Results]

*yet to be implemented

  • Load URLs: sireg loads a bunch of URLs you want to test. The URLs can be loaded from different locations.
  • Filter URLs: Sometimes it is not necessary to test all URLs. Filters help to focus and reduce the testing time.
  • Apply URL replacements: In case you want to target different URLs, use replacers to alter the loaded URLs before sireg issues the request.
  • Request URLs: sireg requests all URLs and stores the HTTP result with all redirection steps for evaluation.
  • Report Results: Different options to report the test results help you make use of the analysis result.

Getting Started

Download a released binary of sireg and store it in a location such that you can execute sireg from where you need it.

To get started with sireg, let's verify that all pages you list in your sitemap have a 200 status code:

$ sireg exec --loader-sitemap-sitemap "https://<DOMAIN>/sitemap.xml"

Now let's continue and see whether all the pages listed in your sitemap are present on your local development copy running on your computer:

$ sireg exec \
    --loader-sitemap-sitemap "https://<DOMAIN>/sitemap.xml" \
    --replacer-static-replace "https://<DOMAIN>/" \
    --replacer-static-with "http://localhost:8080/"

Start to explore sireg and see all available options with:

$ sireg exec --help

sireg Test Suite

Tests executed with sireg can be defined in a test suite configuration file. In fact, the JSON test suite file is more versatile than the sireg exec command. Test suites are simple JSON files and can be executed with sireg as follows:

sireg test my-test-suite.json

You may find example test suite definitions in the /examples directory.

sireg provides a JSON schema file to help you write valid test suites: sireg-test-suite.schema.json. In case you are using IntelliJ, make sure to setup IDE support for JSON schema.

Loaders & Replacers

sireg currently supports the following loaders and replacers out of the box:

Loaders

  • SitemapLoader: Load URLs from a sitemap.
  • FileLoader: Load URLs from a text file, line by line.

View the documentation for all loaders.

Replacers

  • StaticReplacer: Use Node's String.replace to replace parts of a URL.

View the documentation for all replacers.

sireg Test Suite Settings

The test suite may define settings which affect the execution of the tool.

{
  "testSuite": "My test suite name",
  "settings": {
    // sireg settings here
  }
}
  • concurrentRequests [Default: 3] - The number of concurrent HTTP requests to execute. Make sure your server can handle the load, there is no throttling.
  • requestTimeout [Default: 3000] - The number of milliseconds to wait for a server to send response headers (and start the response body) before aborting the request.

Roadmap

sireg aims to support:

  • Testing that a bunch of URLs end up at a good status code.
  • Regression testing all URLs from an existing sitemap.
  • Filters to limit the set of URLs that are being tested (based on heuristics, for example).
  • Features to test redirect locations.
  • More reporters (CSV, for example).
  • Provide a crawler to make it easy to start testing existing sites.

Contributing

Open a PR :-)

See all changes made to this project in the change log. This project follows semantic versioning.

This project is licensed under the terms of the MIT license.


Project created and maintained by Fabian Keller.

sireg's People

Contributors

fakleiser avatar dependabot-preview[bot] avatar dependabot[bot] avatar

Stargazers

 avatar Daniel avatar Porawit Poboonma avatar Remo H. Jansen avatar

Watchers

James Cloos avatar  avatar

sireg's Issues

Improve Reporting

Implement a JsonReporter or FileReporter that writes the test results to disk. The logging output should be improved to be configurable and have a lower default verbosity. An option should exist to write the verbose log messages to a separate log file.

Feature: SmokeTestFilter

Implement a SmokeTestFilter that randomly chooses a subset of the URLs to test. Either by percentage or absolute number.

Refactor: SiteUrl

Refactor SiteUrl to SiteTestCase, as it conveys more meaning, is closer to the target domain and is more open to future extension.

It allows to define an improved test case API along the lines of:

let myTestCase = TestCase.expect(url)
  .toHaveStatusCode(200);
let myTestCase = TestCase.expect(url)
  .toRedirectTo(url, redirectStatusCode = 301);

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.