提交 9012dd98 编写于 作者: Z zhaoke

Merge branch 'main' of git.zcorp.cc:pangu/zentaoatf

......@@ -66,3 +66,4 @@ node_modules
/test/coverage/allure-results/
/internal/pkg/plugin/zap-plugin
/zap_key
/test/restapi/allure-results/
......@@ -21,18 +21,22 @@ func BuildCli() (err error) {
cliPath = `.\cmd\command\main.go`
outPath += ".exe"
}
_, err = os.Stat(outPath)
if err != nil && os.IsExist(err) {
os.Remove(outPath)
}
var cmd *exec.Cmd
cmd = exec.Command("go", "build", "-o", outPath, cliPath)
cmd.Dir = constTestHelper.RootPath
fmt.Println(cmd.String())
_, err = cmd.CombinedOutput()
if err != nil {
return
}
return
}
......
package main
import (
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"
"testing"
)
type AllSuite struct {
suite.Suite
}
func TestRestApiSet(t *testing.T) {
suite.RunSuite(t, new(ProductApiSuite))
}
func (s *AllSuite) BeforeEach(t provider.T) {
t.ID("0")
t.AddSubSuite("TestProductApi")
}
package main
import (
"fmt"
httpUtils "github.com/easysoft/zentaoatf/pkg/lib/http"
constTestHelper "github.com/easysoft/zentaoatf/test/helper/conf"
"github.com/ozontech/allure-go/pkg/framework/provider"
"github.com/ozontech/allure-go/pkg/framework/suite"
"testing"
)
func TestProductApi(t *testing.T) {
suite.RunSuite(t, new(ProductApiSuite))
}
type ProductApiSuite struct {
suite.Suite
}
func (s *ProductApiSuite) BeforeEach(t provider.T) {
t.ID("1")
t.AddSubSuite("ProductApi")
}
func (s *ProductApiSuite) TestMe(t provider.T) {
t.Require().Equal("Success", "Success")
}
func (s *ProductApiSuite) TestProductApi(t provider.T) {
url := fmt.Sprintf("http://127.0.0.1:%d/api.php/v1/products", constTestHelper.ZentaoPort)
httpUtils.Get(url)
type ProductApiSuite struct {
suite.Suite
t.WithNewStep("My Second Step!", func(sCtx provider.StepCtx) {
sCtx.NewStep("My First SubStep!")
})
}
......@@ -41,8 +41,8 @@ func main() {
flagSet.StringVar(&version, "version", "latest", "")
flagSet.StringVar(&version, "v", "latest", "")
flagSet.StringVar(&testToRun, "testToRun", "all_test.go", "")
flagSet.StringVar(&testToRun, "t", "all_test.go", "")
flagSet.StringVar(&testToRun, "testToRun", "", "")
flagSet.StringVar(&testToRun, "t", "", "")
testing.Init()
flagSet.Parse(os.Args[1:])
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册