e2e

package
v1.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

README

E2E tests

The purpose of this docs is to describe KICS' E2E test suite

Getting Started

There are several ways to execute the E2E tests.

TLDR

This steps will build the kics and then run the E2E using the built binary (placed by default under ${PWD}/bin/kics)

make test-e2e
Step by Step

These steps will build the kics and then run the E2E using the built binary.

go build -o ./bin/kics cmd/console/main.go

If you want to provide a version:

go build -o ./bin/kics -ldflags "-X github.com/Checkmarx/kics/internal/constants.Version=$(git rev-parse --short HEAD) cmd/console/main.go

and then:

E2E_KICS_BINARY=./bin/kics go test "github.com/Checkmarx/kics/e2e" -v

Test Scenarios

Test scenarios are defined as follows:

var tests = []struct {
	name          string
	args          args
	wantStatus    int
	removePayload []string
}{
	// E2E-CLI-005 - KICS scan with -- payload-path flag should create a file with the
	// passed name containing the payload of the files scanned
	{
		name: "E2E-CLI-005",
		args: args{
            // These are CLI arguments passed down to the KICS binary
			args: []cmdArgs{
				[]string{"scan", "--silent", "-q", "../assets/queries", "-p", "fixtures/samples/terraform.tf",
					"--payload-path", "fixtures/payload.json", "-q", "../assets/queries"},
			},
             // this is a reference to a fixture placed under e2e/fixtures that contains the expected stdout output
			expectedOut: []string{
				"E2E_CLI_005",
			},
            // this is a reference to a fixture placed under e2e/fixtures that contains the expected KICS' payload
			expectedPayload: []string{
				"E2E_CLI_005_PAYLOAD",
			},
		},
		wantStatus:    0,
        // we should cleanup the payload after running this scenario
		removePayload: []string{"payload.json"},
	},
}

E2E tests are skiped in short mode:

func Test_E2E_CLI(t *testing.T) {
	kicsPath := getKICSBinaryPath("")

	if testing.Short() {
		t.Skip("skipping E2E tests in short mode.")
	}
//...
}

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

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