Releases: gdt-dev/http
v1.11.0
v1.10.0
v1.1.0
New functionality
Skip scenario if condition true (gdt-dev/gdt#5)
Adds the ability to skip a test scenario if a condition evaluates to true. Use the skip-if field in the Scenario YAML to tell gdt to skip the scenario if that condition evaluates to true. The condition is just a test.
For example, let's assume you have a gdt-kube scenario that looks like
this:
tests:
- kube.create: manifests/nginx-deployment.yaml
- kube:
get: deployments/nginx
assert:
matches:
status:
readyReplicas: 2
- kube.delete: deployments/nginxIf you execute the above test and there is already an 'nginx'
deployment, the kube.create test will fail. To prevent the scenario
from proceeding with the tests if an 'nginx' deployment already exists,
you could add the following
skip-if:
- kube.get: deployments/nginx
tests:
- kube.create: manifests/nginx-deployment.yaml
- kube:
get: deployments/nginx
assert:
matches:
status:
readyReplicas: 2
- kube.delete: deployments/nginxWith the above, if an 'nginx' deployment exists already, the scenario
will skip all the tests.
Breaking changes in YAML definitions
exec plugin assertions now under assert field (gdt-dev/gdt#6)
The exec plugin now nests its assertions under an assert field.
So, instead of this:
tests:
- exec: echo cat
out:
is: catyou now do this:
tests:
- exec: echo cat
assert:
out:
is: catrequire renamed to fixtures (gdt-dev/gdt#2)
The require field in the Scenario YAML definition has been renamed to the more appropriate fixtures, since this field lists the fixtures that the scenario requires.
http plugin assertions now in assert field (#1)
The response field in the http plugin's Spec YAML definition has been renamed to the more appropriate assert, since this field contains the assertions for the test.
v1.0.0
Initial port of code from github.com/jaypipes/gdt-http.
To use gdt, define your tests in a YAML file or a directory containing YAML files, use the gdt.From() method to create a runnable test suite or scenario and then Run() it:
package mypackage_test
import (
"context"
"path/filepath"
"testing"
"github.com/gdt-dev/gdt"
_ "github.com/gdt-dev/http"
"github.com/stretchr/testify/require"
)
func TestRunASuite(t *testing.T) {
require := assert.New(t)
fp := filepath.Join("suite", "testdata", "http")
s, err := gdt.From(fp)
require.Nil(err)
s.Run(context.TODO(), t)
}
func TestRunOneScenario(t *testing.T) {
require := require.New(t)
fp := filepath.Join("suite", "testdata", "http", "create-then-get-book.yaml")
s, err := gdt.From(fp)
require.Nil(err)
s.Run(context.TODO(), t)
}