GithubHelp home page GithubHelp logo

cta-tool's Introduction

cta-tool

Build Status Coverage Status codecov

Tool Modules for Compass Test Automation, One of Libraries in CTA-OSS Framework

General Overview

Overview

This module provides the Tool class to extend. We provides the Tool as a tool to be implemented any functionality across bricks and framework.

Guidelines

We aim to give you brief guidelines here.

  1. Tool Class Usage
  2. Tool Class Structure
  3. Tool Class Constructor
  4. Tool Configuration

1. Tool Class Usage

To create a tool for CTA-OSS Framework, we need to extend the class.

const Tool = require("cta-tool");

class SampleTool extends Tool {
  method1() {
    ...
  }

  method2() {
    ...
  }
}

module.exports = SampleTool;

This example shows how to use Tool. We can implement any methods, which in this example are method1() and method2(), that are provided within this tool.

back to top

2. Tool Class Structure

Here is a structure of Tool Class.

class Tool {
  constructor(dependencies, configuration);
}

Presently, Tool class provides a constructor, not other methods because we aim to provide extensibility on tool.

back to top

3. Tool Class Constructor

In a constructor, the Tool uses dependencies injection to make the dependencies and configuration available within Tool.

class SampleTool extends Tool {
  constructor(dependencies, configuration) {
    super(dependencies, configuration);  // to bind the dependencies and configuration
  }
}

module.exports = SampleTool;

By calling super(), the dependencies and configuration are bound and available within class context. They can be accesed in any method via this.dependencies and this.configuration. You can provide the configuration, while the dependencies are provided by cement. The provided configuration will be validated in contructor.

back to top

4. Tool Configuration

const configuration = {
  name: string;
  singleton: boolean;
  properties: any;
};

class SampleTool extends Tool {
  constructor(dependencies, configuration) {
    super(dependencies, configuration);
    ...
  }

  otherMethod() {
    const name = this.name;
    const singleton = this.singleton;
    const properties = this.properties;
    const configuration = this.configuration;
  }
}

The Tool Configuration has three required fields.

  • name - define the tool name
  • singleton - indicate whether the tool is singleton
  • properties - provide properties

These values are avaliable within Tool class.

back to top


To Do

  • More Points

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.