Giter Site home page Giter Site logo

devexperts / switchboard Goto Github PK

View Code? Open in Web Editor NEW
13.0 8.0 3.0 280 KB

Toolset designed to collect, parse, filter and group automated tests from code, transform the result and perform the required further actions.

Home Page: https://testfailed.com/switchboard

License: Mozilla Public License 2.0

Java 79.02% Groovy 19.73% Gherkin 1.25%
autotests testrunner testcase-generator continuous-integration

switchboard's Introduction

Switchboard

Test Case Processing Toolset

Switchboard is designed to collect, parse, filter and group tests from code, transform the result and perform the required actions on it.

Concept

The toolset consists of an API module, a Core module, a Runner and an extendable set of Integration modules.

Test

An entity representing a single test (e.g. TestNG or JUnit test, a Cucumber scenario, etc.) consisting of an identifier and its Attributes.

TestRun

An entity representing a group of Tests consisting of an identifier, its Attributes and a set of tests.

Integration

Each Integration module provides specific features implementation or access to interaction with software, e.g. cukes integration can collect Cucumber test data from .feature files, jira integration provides access to Atlassian Jira REST API functionality etc. Each integration is autonomous and is run within its own classpath to evade dependency conflicts.

IntegrationComponent

An implementation of a single atomic component of an integration. All components are executed during integration run in the following sequence:

  • TestExtractor components supplying Tests from an external source, e.g. files, DB, URL etc.
  • TestProcessor components complementing, decoding, splitting etc. specified tests.
  • TestFilter components filtering processed Tests.
  • TestSplitter components splitting tests into TestRuns by specified attributes.
  • TestRunProcessor components processing (complementing, decoding, splitting etc) tests runs.
  • TestRunConsumer components consuming the prepared TestRuns (e.g. test runner, report collector etc.). Each IntegrationComponent is run within the context of an integration it is specified in.

How to run

A Switchboard is run by Runner module: java -jar {path-to-runner-jar} -c {path-to-configuration} -i {path-to-libs} with 2 parameters:

  • -c - JSON configuration file path
  • -i - Paths to integration lib jars and/or directories with libs; glob pattern is supported.

Runner executes all components marked as runnable ("runnable": true in JSON config).

Configuration

Each Integration or Integration set configuration is stored as a JSON, describing the structure, execution order and execution parameters.

Example

This configuration will:

  • collect Cucumber test cases
  • filter tests marked with MarkerAnnotation1 attribute
  • create test batches grouped by 5 tests at most
  • log the result into the console
{
  "@class": "com.devexperts.switchboard.integrations.cukes.CukesIntegration",
  "identifier": "CukesIntegration-1",
  "runnable": false,
  "testExtractors": [
    {
      "@class": "com.devexperts.switchboard.integrations.cukes.CukesTestExtractor",
      "identifier": "CukesTestExtractor-1",
      "testLocations": [
        "src/test/resources/test_classes"
      ],
      "filePattern": "regex:.*.feature",
      "cucumberNativeFilters": "",
      "basePath": "src/test/resources"
    }
  ],
  "testProcessors": [],
  "testFilters": [
    {
      "@class": "com.devexperts.switchboard.impl.filters.AttributesFilter",
      "identifier": "AttributesFilter-1",
      "attributePredicate": {
        "@class": "com.devexperts.switchboard.entities.attributes.AttributeIsPresent",
        "attributeKeyRegex": "MarkerAnnotation1"
      }
    }
  ],
  "testSplitters": [
    {
      "@class": "com.devexperts.switchboard.impl.splitters.TestCountSplitter",
      "identifier": "TestCountSplitter-1",
      "count": 5
    }
  ],
  "testRunProcessors": [],
  "testRunConsumers": [
    {
      "@class": "com.devexperts.switchboard.impl.consumers.LoggingTestRunConsumer",
      "identifier": "TestLoggingConsumer-1"
    }
  ]
}
ComponentReference

Any integration components can be used in other Integrations using a ComponentReference wrapper. A special component type ComponentReference can be used to wrap a component of an integration executed during another Integration run. Component wrapped by ComponentReference is run within the context of its source integration.

Environment variables in the configuration

If a value in configuration should be resolved from the environment during execution the variable should be set as %variable_name%. Here's how you can set Jira password from JIRA_PASSWORD environment variable:

[
  {
    "@class": "com.devexperts.switchboard.integrations.javaparser.JavaParserIntegration",
    "identifier": "JavaParserIntegration - runnable",
    "runnable": true,
    ...
    "uri": "https://jira.somewhere.elsewhere.com",
    "login": "somebody",
    "password": "%JIRA_PASSWORD%"
  }
]

switchboard's People

Contributors

dmgorbunov avatar kamenkov avatar mikebolotov avatar mvashchinsky avatar nikolaenkov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

switchboard's Issues

Jenkins integration

Jenkins has a Remote Access API that allows triggering jobs. There's also Apache 2.0 licensed jenkins-rest lib that wraps this API for Java.

The goal would be to be able to

  • Trigger a number of jobs
  • Control job parameters
  • Control job-to-agent assignment

Design configuration manager

Currently, Switchboard configuration is managed via JSON file.
To ease support of complex configurations and make it easier to build new ones, we need to design configuration generator/manager.

Git integration

Currently, for code parsing, we expect it to be checked out to local directory.
It would be much more handy to use Git URL instead.
Authorization is the biggest question, I suppose.

Excel integration

We need to support excel import-export for Switchboard. The main pipeline target would be JIRA.

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.