scratch-post

module
v0.0.0-...-0fda810 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 11, 2022 License: Apache-2.0

README

Go Report Card Actions

Scratch Post

A free, open source test management platform.

Provides a REST API which you can use to manage your tests. You will first need to create a project that will be a separated space to store tests that are related to a particular application. Inside a project you can define:

  • A scenario which is a defintion of a test case
  • A test plan which is used to aggregate multiple scenarios in a logical collection
  • An execution which is the actual result of a scenario, at a given point in time and as being part of a specific test plan

Using Scratch Post

Building the project:

make build-app

This will create a binary under build/_bin

The project requires 3 configuration files to be used. All these files can be generate using the binary.

./scratch-post generate -h
generate is used to generate the configurations needed to run scratch-post

Usage:
  scratch-post generate [command]

Available Commands:
  admin-db-config admin-db-config generates JSON file for configuring the database to store administrative information
  api-config      api-config generates JSON file for configuring the REST API
  test-db-config  test-db-config generates JSON file for configuring the database to store test information

Flags:
  -h, --help   help for generate

Use "scratch-post generate [command] --help" for more information about a command.
  1. Generating the REST API config

    ./scratch-post generate api-config -h
    api-config generates JSON file for configuring the REST API
    
    Usage:
    scratch-post generate api-config [flags]
    
    Flags:
        --adminPrefix string   prefix for all admin endpoints (default "/admin")
        --executions string    executions endpoint (default "/executions")
        --file string          file which will contain the configuration (default "apiconfig.json")
    -h, --help                 help for api-config
        --port string          port for the server (default "9090")
        --probes string        probes endpoints (default "/probes")
        --projects string      projects endpoint (default "/projects")
        --rootPrefix string    prefix for all api endpoints (default "/api/v1")
        --scenarios string     scenarios endpoint (default "/scenarios")
        --testplans string     testplans endpoint (default "/testplans")
        --users string         users endpoint. Is part of the admin endpoints (default "/users")
    
  2. Generating the Test DB config. address and database are mandatory.

    ./scratch-post generate test-db-config -h
    test-db-config generates JSON file for configuring the Mongo database.
            This data base is used to store test information. 
            Information provided by this config file is:
            - address:     the URL to connect to the instance 
            - database:    the specific database to be used in the instance
            - collections: a map which you can use to specify what collection each scratch-post item type can use
    
    Usage:
    scratch-post generate test-db-config [flags]
    
    Flags:
        --address string      testdb server address
        --database string     mongo database name
        --executions string   collection name to be used for executions (default "executions")
        --file string         file which will contain the configuration (default "testdb.json")
    -h, --help                help for test-db-config
        --projects string     collection name to be used for projects (default "projects")
        --scenarios string    collection name to be used for scenarios (default "scenarios")
        --testplans string    collection name to be used for testplans (default "testplans")
    

    ❕ The DB type used is MongoDB. If you don't have Mongo instance available, you can create a free instance at https://cloud.mongodb.com/

  3. Generating the Admin DB config. address is mandatory

    ./scratch-post generate admin-db-config -h
    admin-db-config generates JSON file for configuring the Postgress database.
            This data base is used to store test information. 
            Information provided by this config file is:
            - address: the URL to connect to the instance
    
    Usage:
    scratch-post generate admin-db-config [flags]
    
    Flags:
        --address string    testdb server address
        --file string       file which will contain the configuration (default "admindb.json")
    -h, --help              help for admin-db-config
        --maxIdle int       maximum idle connections (default 5)
        --maxLifetime int   maximum lifetime (default 5)
        --maxOpen int       maximum open connections (default 5)
    

    ❕ The DB type used is Postgress. If you don't have a Postgress instance available, you can create a free instance at https://www.elephantsql.com/

  4. To start the app you can use:

    ./scratch-post start -h
    Starts the server for managing test cases
    
    Usage:
    scratch-post start [flags]
    
    Flags:
        --admindb string        Path to admin DB config settings (default "admindb.json")
        --apiconfig string      Path to API config settings (default "apiconfig.json")
    -h, --help                  help for start
        --isJWT                 Sets the authentication type to JWT. Default is session ID
        --scenarios string      collection name to be used for scenarios (default "scenarios")
        --securityFile string   Path to file which contains the JWT security string (default "security.txt")
        --testdb string         Path to DB config settings (default "testdb.json")
    

    If you already have the config files, you can also use make run

    To start using the REST API refer to the docs

Directories

Path Synopsis
cmd
internal
db
pkg
executions/mocks
Package mock_executions is a generated GoMock package.
Package mock_executions is a generated GoMock package.
projects/mocks
Package mock_projects is a generated GoMock package.
Package mock_projects is a generated GoMock package.
scenarios/mocks
Package mock_scenarios is a generated GoMock package.
Package mock_scenarios is a generated GoMock package.
testplans/mocks
Package mock_testplans is a generated GoMock package.
Package mock_testplans is a generated GoMock package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL