github.com/ixpectus/declarate@v0.0.0-20240422152255-708027d7c068/tests/suite_test.go (about)

     1  package tests
     2  
     3  import (
     4  	"os"
     5  	"testing"
     6  
     7  	"github.com/ixpectus/declarate/commands/echo"
     8  	"github.com/ixpectus/declarate/commands/script"
     9  	"github.com/ixpectus/declarate/commands/shell"
    10  	"github.com/ixpectus/declarate/commands/vars"
    11  	"github.com/ixpectus/declarate/compare"
    12  	"github.com/ixpectus/declarate/contract"
    13  	"github.com/ixpectus/declarate/eval"
    14  	"github.com/ixpectus/declarate/kv"
    15  	"github.com/ixpectus/declarate/output"
    16  	"github.com/ixpectus/declarate/report"
    17  	"github.com/ixpectus/declarate/suite"
    18  	"github.com/ixpectus/declarate/variables"
    19  )
    20  
    21  func TestSuite(t *testing.T) {
    22  	os.Chdir("../")
    23  	evaluator := eval.NewEval(nil)
    24  	vv := variables.New(evaluator, kv.New("persistent", false), true)
    25  	cmp := compare.New(contract.CompareParams{}, vv)
    26  	// if output
    27  	s := suite.New("./tests/suite", suite.RunConfig{
    28  		TestRunWrapper: NewDebugWrapper(),
    29  		Report:         report.NewAllureReport("./allure-results"),
    30  		Variables:      vv,
    31  		FailFast:       true,
    32  		NoColor:        true,
    33  		Output: &output.Output{
    34  			WithProgressBar: true,
    35  		},
    36  		Builders: []contract.CommandBuilder{
    37  			&echo.Unmarshaller{},
    38  			vars.NewUnmarshaller(evaluator),
    39  			shell.NewUnmarshaller(cmp),
    40  			script.NewUnmarshaller(cmp),
    41  		},
    42  		T: t,
    43  	})
    44  	if err := s.Run(); err != nil {
    45  		t.Log(err)
    46  		t.Fail()
    47  	}
    48  }