Sign inSign up

reportfactory/server

By reportfactory

•Updated almost 8 years ago

Report Factory Rails Api

Image
1

802

reportfactory/server repository overview

⁠Report Factory

Build Status Maintainability Test Coverage

Report Factory is a storage for your test reports with intuitive API to manage all your projects test results.

The provided API are based on the JSON API⁠ convention. Currently migrating to GraphQL⁠.

⁠Getting Started

Follow these instructions⁠ to get Report Factory running with Docker. The configuration is ready for production.

The image of this project can be pulled from Dockerhub⁠:

  docker pull reportfactory/server

⁠Preconditions

  • Add Content-Type header with application/vnd.api+json
  • Add your account's X-API-KEY to header

⁠Available API

⁠Users

To login and get your X-API-KEY:

POST /api/v1/users/login

{
    "data":{
        "type":"users",
        "attributes":{
            "email":"[email protected]",
            "password":"Password1"
        }
    }
}

To return your user:

GET /api/v1/user


To return all registered users:

GET /api/v1/users


To create a user (Admin only):

POST /api/v1/users/create

{
    "data":{
        "type":"users",
        "attributes":{
            "name":"UserName",
            "email":"[email protected]",
            "password":"Password1",
            "type":"Tester"
        }
    }
}

To update a user (Admin only):

PUT /api/v1/users/:id

{
    "data":{
        "type":"users",
        "attributes":{
            "name":"UpdatedName",
            "email":"[email protected]"
        }
    }
}

Note: You can promote user to Admin by passing "type":"Admin"


To get user information:

GET /api/v1/users/:id


To get all reports of a user:

GET /api/v1/users/:id/reports


To get all RSpec reports of a user:

GET /api/v1/users/:id/reports/rspec


To delete a user (Admin only):

DELETE /api/v1/users/:id


⁠Projects

To return all available projects:

GET /api/v1/projects


To create a new project (Admin only):

POST /api/v1/projects

{
    "data":{
        "type":"project",
        "attributes":{
            "project_name":"MyAwesomeProject"
        }
    }
}

To get project by name:

GET /api/v1/projects/:project_name


To update a project:

PUT /api/v1/projects/:project_name

{
    "data":{
        "type":"project",
        "attributes":{
            "project_name":"UpdatedProjectName"
        }
    }
}

To delete a project (Admin only):

DELETE /api/v1/projects/:project_name

⁠Project Reports

To return all reports within a project:

GET /api/v1/projects/:project_name/reports


To get all RSpec reports within a project:

GET /api/v1/projects/:project_name/reports/rspec


To submit an RSpec report:

POST /api/v1/projects/:project_name/reports/rspec

{
  "data": {
    "type": "rspec_report",
    "attributes": {
      "version": "3.7.0",
      "examples": [
        {
          "id": "./spec/routing/routes_spec.rb[1:4:1]",
          "description": "routes GET /api/v1/projects/:project_name/reports/rspecto rspec_reports#index",
          "full_description": "routing /api/v1/projects/:project_name/reports/rspec routes GET /api/v1/projects/:project_name/reports/rspecto rspec_reports#index",
          "status": "passed",
          "file_path": "./spec/routing/routes_spec.rb",
          "line_number": 59,
          "run_time": 0.001341,
          "pending_message": null,
        },
        {
          "id": "./spec/requests/rspec_reports_api_spec.rb[1:1:1]",
          "description": "gets all rspec reports within project",
          "full_description": "RspecReports GET index gets all rspec reports within project",
          "status": "failed",
          "file_path": "./spec/requests/rspec_reports_api_spec.rb",
          "line_number": 11,
          "run_time": 0.032876,
          "pending_message": null,
          "exception": {
            "class": "RSpec::Expectations::ExpectationNotMetError",
            "message": "\nexpected: 200\n     got: 204\n\n(compared using ==)\n",
            "backtrace": [
              "./gems/rspec-support-3.7.0/lib/rspec/support.rb:97:in `block in \u003cmodule:Support\u003e'",
              "./gems/rspec-support-3.7.0/lib/rspec/support.rb:106:in `notify_failure'",
              "./gems/rspec-expectations-3.7.0/lib/rspec/expectations/fail_with.rb:35:in `fail_with'",
              "./gems/rspec-expectations-3.7.0/lib/rspec/expectations/handler.rb:38:in `handle_failure'",
              "./gems/rspec-expectations-3.7.0/lib/rspec/expectations/handler.rb:50:in `block in handle_matcher'",
            ]
          }
        }
      ]
      "summary": {
        "duration": 0.747558,
        "example_count": 2,
        "failure_count": 1,
        "pending_count": 0,
        "errors_outside_of_examples_count": 0
      },
      "summary_line": "2 examples, 1 failures",
    }
  }
}

To view an existing RSpec reports within a project:

GET /api/v1/projects/:project_name/reports/rspec/:id

⁠Reports

To return all reports:

GET /api/v1/reports


To get all RSpec reports:

GET /api/v1/reports/rspec

⁠Scenarios

To return all scenarios:

GET /api/v1/scenarios


To get all scenarios by project:

GET /api/v1/projects/:project_name/scenarios

⁠GraphQL

Clients can fetch data using GraphQL from /graphql' endpoint. Just make sure you pass X-API-KEY` header with your user token. To acccess GraphiQL in development you need to set the token in the environment variable:

  export X_API_KEY={your_x_api_key}

Then youl'll be able to access /graphiql on your localhost.

⁠License

The application is available as open source under the terms of the MIT License⁠.

Tag summary

Content type

Image

Digest

Size

135.5 MB

Last updated

almost 8 years ago

docker pull reportfactory/server