testdeck

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2022 License: MIT Imports: 6 Imported by: 0

README

Testdeck

Testdeck is a framework for integration, end-to-end (E2E), and security testing of gRPC microservices written in Golang.

Please see the docs folder for documentation and tutorials.

Features

  • Integration/E2E testing for gRPC microservices written in Golang
  • Fuzz testing of gRPC endpoints (using google/gofuzz)
  • Injection of malicious payloads (from swisskyrepo/PayloadsAllTheThings), similar to Burpsuite's Intruder function
  • Utility methods for gRPC/HTTP requests
  • Connecting a debugging proxy such as Charles or Burpsuite to analyze, modify, replay, etc. requests

How to Use

As with all test automation frameworks, you will most likely need to do some customization and fine-tuning to tailor this tool for your organization. It is recommended that you clone this repository and build on top of it to suit your needs.

To learn how to build your own test automation system using Testdeck, please see the setup guide and the blog article.

Contribution

Please read the CLA carefully before submitting your contribution to Mercari. Under any circumstances, by submitting your contribution, you are deemed to accept and agree to be bound by the terms and conditions of the CLA.

https://www.mercari.com/cla/

License

Copyright 2020 Mercari, Inc.

Licensed under the MIT License.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TD

type TD struct {
	T TestingT // wrapper on testing.T
	// contains filtered or unexported fields
}

TD contains a testdeck test case + statistics to save to the DB later It allows us to capture functionality from testing.T

func Test

func Test(t TestingT, tc TestCaseDelegate, options ...TestConfig) *TD

This method starts the test t is the interface for testing.T tc is the interface for testdeck test cases options is an optional parameter for passing in special test configurations

func (*TD) Error

func (c *TD) Error(args ...interface{})

Error passes through to testing.T.Error

func (*TD) Errorf

func (c *TD) Errorf(format string, args ...interface{})

Errorf passes through to testing.T.Errorf

func (*TD) Fail

func (c *TD) Fail()

Fail passes through to testing.T.Fail

func (*TD) FailNow

func (c *TD) FailNow()

FailNow passes through to testing.T.FailNow

func (*TD) Failed

func (c *TD) Failed() bool

Failed passes through to testing.T.Failed

func (*TD) Fatal

func (c *TD) Fatal(args ...interface{})

Fatal passes through to testing.T.Fatal

func (*TD) Fatalf

func (c *TD) Fatalf(format string, args ...interface{})

Fatalf passes through to testing.T.Fatalf

func (*TD) Helper

func (c *TD) Helper()

Helper passes through to testing.T.Helper

func (*TD) Log

func (c *TD) Log(args ...interface{})

Log passes through to testing.T.Log

func (*TD) Logf

func (c *TD) Logf(format string, args ...interface{})

Logf passes through to testing.T.Logf

func (*TD) Name

func (c *TD) Name() string

Name passes through to testing.T.Name

func (*TD) Parallel

func (c *TD) Parallel()

Parallel passes through to testing.T.Parallel

func (*TD) Skip

func (c *TD) Skip(args ...interface{})

Skip passes through to testing.T.Skip

func (*TD) SkipNow

func (c *TD) SkipNow()

SkipNow passes through to testing.T.SkipNow

func (*TD) Skipf

func (c *TD) Skipf(format string, args ...interface{})

Skipf passes through to testing.T.Skipf

func (*TD) Skipped

func (c *TD) Skipped() bool

Skipped passes through to testing.T.Skipped

type TestCase

type TestCase struct {
	Arrange                  func(t *TD) // setup stage before the test
	Act                      func(t *TD) // the code you actually want to test
	Assert                   func(t *TD) // the outcomes you want to verify
	After                    func(t *TD) // clean-up steps
	deferrer.DefaultDeferrer             // deferred steps that you want to run after clean-up
}

A struct that represents a testdeck test case

func (*TestCase) ActMethod

func (tc *TestCase) ActMethod(t *TD)

func (*TestCase) AfterMethod

func (tc *TestCase) AfterMethod(t *TD)

func (*TestCase) ArrangeMethod

func (tc *TestCase) ArrangeMethod(t *TD)

Interface methods

func (*TestCase) AssertMethod

func (tc *TestCase) AssertMethod(t *TD)

func (*TestCase) Run

func (tc *TestCase) Run(t *testing.T, name string)

Run passes through to testing.T.Run

type TestCaseDelegate

type TestCaseDelegate interface {
	ArrangeMethod(t *TD)
	ActMethod(t *TD)
	AssertMethod(t *TD)
	AfterMethod(t *TD)
}

An interface for testdeck test cases; it is implemented by the TestCase struct below

type TestConfig

type TestConfig struct {
	// tests run in parallel by default but you can force it to run in sequential by using ParallelOff = true
	ParallelOff bool
}

TestConfig is for passing special configurations for the test case

type TestingT

type TestingT interface {
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Fail()
	FailNow()
	Failed() bool
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
	Log(args ...interface{})
	Logf(format string, args ...interface{})
	Name() string
	Skip(args ...interface{})
	SkipNow()
	Skipf(format string, args ...interface{})
	Skipped() bool
	Helper()
	Parallel()
}

methods from testing.T

Directories

Path Synopsis
Package testdeps provides access to dependencies needed by test execution.
Package testdeps provides access to dependencies needed by test execution.
db

Jump to

Keyboard shortcuts

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