Home

Awesome

jsonspec

Build status GoDoc Go Report Card Coverage Status

JSON output generator for the BDD framework GoGiven

Import:

import github.com/corbym/jsonspec

Usage:

package foo
import (
	"testing"
	"github.com/corbym/gogiven"
	"github.com/corbym/jsonspec"
	"os"
)

func TestMain(testmain *testing.M) {
	gogiven.Generator = jsonspec.NewTestOutputGenerator()
	runOutput := testmain.Run()
	gogiven.GenerateTestOutput()
	os.Exit(runOutput)
}

... actual tests...

Example Output

{
  "title": "Generator Test",
  "test_state": {
    "test title": {
      "test_results": {
        "id": "abc2124",
        "failed": true,
        "skipped": true,
        "test_output": "well alrighty then"
      },
      "test_title": "test title",
      "interesting_givens": {
        "faff": "flap"
      },
      "captured_io": {
        "foob": "barb"
      },
      "given_when_then": {
        "given_when_then": [
          "given",
          "when",
          "then"
        ],
        "comment": [
          "Fooing is best",
          "done with friends"
        ]
      }
    }
  }
}