refactor: merge TestCase with TCase, fix converters

This commit is contained in:
lilong.129
2024-08-19 19:42:20 +08:00
parent 448a0bbc67
commit 7b438e5cec
12 changed files with 107 additions and 77 deletions
+8 -8
View File
@@ -358,15 +358,15 @@ type TestResult struct {
// ==================== model definition ends here ====================
func LoadHARCase(path string) (*hrp.TCase, error) {
func LoadHARCase(path string) (*hrp.TestCase, error) {
// load har file
caseHAR, err := loadCaseHAR(path)
if err != nil {
return nil, err
}
// convert to TCase format
return caseHAR.ToTCase()
// convert to TestCase format
return caseHAR.ToTestCase()
}
func loadCaseHAR(path string) (*CaseHar, error) {
@@ -381,16 +381,16 @@ func loadCaseHAR(path string) (*CaseHar, error) {
return caseHAR, nil
}
// convert CaseHar to TCase format
func (c *CaseHar) ToTCase() (*hrp.TCase, error) {
// convert CaseHar to TestCase format
func (c *CaseHar) ToTestCase() (*hrp.TestCase, error) {
teststeps, err := c.prepareTestSteps()
if err != nil {
return nil, err
}
tCase := &hrp.TCase{
Config: c.prepareConfig(),
TestSteps: teststeps,
tCase := &hrp.TestCase{
Config: c.prepareConfig(),
TSteps: teststeps,
}
err = tCase.MakeCompat()
if err != nil {