github.com/redhat-appstudio/e2e-tests@v0.0.0-20230619105049-9a422b2094d7/templates/test_suite_cmd.tmpl (about)

     1  package cmd
     2  
     3  /* This was generated from a template file. Please feel free to update as necessary */
     4  
     5  import (
     6  	"fmt"
     7  	"os"
     8  	"testing"
     9  
    10  	"github.com/redhat-appstudio/e2e-tests/pkg/framework"
    11  
    12  	"github.com/onsi/ginkgo/v2"
    13  	"github.com/onsi/gomega"
    14  	_ "github.com/redhat-appstudio/e2e-tests/tests/{{ .SuiteName }}"
    15  
    16  	"flag"
    17  
    18  	"github.com/spf13/viper"
    19  )
    20  
    21  const ()
    22  
    23  var _ = ginkgo.SynchronizedBeforeSuite(func() []byte {
    24  	return nil
    25  }, func(data []byte) {})
    26  
    27  var webhookConfigPath string
    28  var demoSuitesPath string
    29  var polarionOutputFile string
    30  var polarionProjectID string
    31  var generateTestCases bool
    32  
    33  func init() {
    34  	rootDir, _ := os.Getwd()
    35  	flag.StringVar(&webhookConfigPath, "webhookConfigPath", "", "path to webhook config file")
    36  	flag.StringVar(&polarionOutputFile, "polarion-output-file", "polarion.xml", "Generated polarion test cases")
    37  	flag.StringVar(&polarionProjectID, "project-id", "AppStudio", "Set the Polarion project ID")
    38  	flag.BoolVar(&generateTestCases, "generate-test-cases", false, "Generate Test Cases for Polarion")
    39  }
    40  
    41  func {{ .SuiteName }}Test(t *testing.T) {
    42  	GinkgoWriter.Println("Starting {{ .SuiteName }} tests...")
    43  
    44  	gomega.RegisterFailHandler(ginkgo.Fail)
    45  	ginkgo.RunSpecs(t, "{{ .SuiteName }} tests")
    46  }
    47  
    48  var _ = ginkgo.SynchronizedAfterSuite(func() {}, func() {
    49  	//Send webhook only it the parameter configPath is not empty
    50  	if len(webhookConfigPath) > 0 {
    51  		GinkgoWriter.Println("Send webhook")
    52  		framework.SendWebhook(webhookConfigPath)
    53  	}
    54  })
    55  
    56  var _ = ginkgo.ReportAfterSuite("Polarion reporter", func(report types.Report) {
    57  	if generateTestCases {
    58  		framework.GeneratePolarionReport(report, polarionOutputFile, polarionProjectID)
    59  	}
    60  })