MCPcopy
hub / github.com/httprunner/httprunner / convert2GoTestScripts

Function convert2GoTestScripts

hrp/pkg/convert/from_gotest.go:13–52  ·  view source on GitHub ↗
(paths ...string)

Source from the content-addressed store, hash-verified

11)
12
13func convert2GoTestScripts(paths ...string) error {
14 log.Warn().Msg("convert to gotest scripts is not supported yet")
15 os.Exit(1)
16
17 // TODO
18 var testCasePaths []hrp.ITestCase
19 for _, path := range paths {
20 testCasePath := hrp.TestCasePath(path)
21 testCasePaths = append(testCasePaths, &testCasePath)
22 }
23
24 testCases, err := hrp.LoadTestCases(testCasePaths...)
25 if err != nil {
26 log.Error().Err(err).Msg("failed to load testcases")
27 return err
28 }
29
30 var pytestPaths []string
31 for _, testCase := range testCases {
32 tc := testCase.ToTCase()
33 converter := TCaseConverter{
34 tCase: tc,
35 }
36 pytestPath, err := converter.toPyTest()
37 if err != nil {
38 log.Error().Err(err).
39 Str("originPath", tc.Config.Path).
40 Msg("convert to pytest failed")
41 continue
42 }
43 log.Info().
44 Str("pytestPath", pytestPath).
45 Str("originPath", tc.Config.Path).
46 Msg("convert to pytest success")
47 pytestPaths = append(pytestPaths, pytestPath)
48 }
49
50 // format pytest scripts with black
51 return myexec.ExecPython3Command("black", pytestPaths...)
52}
53
54//go:embed testcase.tmpl
55var testcaseTemplate string

Callers

nothing calls this directly

Calls 5

toPyTestMethod · 0.95
TestCasePathTypeAlias · 0.92
LoadTestCasesFunction · 0.92
ErrMethod · 0.80
ToTCaseMethod · 0.45

Tested by

no test coverage detected