53 lines
1.0 KiB
Go
53 lines
1.0 KiB
Go
package features
|
|
|
|
import (
|
|
"os"
|
|
"testing"
|
|
|
|
"dance-lessons-coach/pkg/bdd"
|
|
|
|
"github.com/cucumber/godog"
|
|
)
|
|
|
|
func TestBDD(t *testing.T) {
|
|
// Get feature name from environment variable or default to all features
|
|
feature := os.Getenv("FEATURE")
|
|
|
|
var paths []string
|
|
var suiteName string
|
|
|
|
if feature == "" {
|
|
// Run all features
|
|
suiteName = "dance-lessons-coach BDD Tests - All Features"
|
|
paths = []string{
|
|
"auth",
|
|
"config",
|
|
"greet",
|
|
"health",
|
|
"jwt",
|
|
}
|
|
} else {
|
|
// Run specific feature
|
|
suiteName = "dance-lessons-coach BDD Tests - " + feature + " Feature"
|
|
paths = []string{feature}
|
|
}
|
|
|
|
suite := godog.TestSuite{
|
|
Name: suiteName,
|
|
TestSuiteInitializer: bdd.InitializeTestSuite,
|
|
ScenarioInitializer: bdd.InitializeScenario,
|
|
Options: &godog.Options{
|
|
Format: "progress",
|
|
Paths: paths,
|
|
TestingT: t,
|
|
Strict: true,
|
|
Randomize: -1,
|
|
// StopOnFailure: true,
|
|
},
|
|
}
|
|
|
|
if suite.Run() != 0 {
|
|
t.Fatal("non-zero status returned, failed to run BDD tests")
|
|
}
|
|
}
|