enum.go 5.9 KB
Newer Older
aaronchen2k2k's avatar
aaronchen2k2k 已提交
1
package commConsts
aaronchen2k2k's avatar
init  
aaronchen2k2k 已提交
2

aaronchen2k2k's avatar
aaronchen2k2k 已提交
3
type ExecFromDef string
aaronchen2k2k's avatar
init  
aaronchen2k2k 已提交
4 5

const (
6
	FromZentao ExecFromDef = "zentao"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
7 8
	FromCmd    ExecFromDef = "cmd"
	FromClient ExecFromDef = "client"
aaronchen2k2k's avatar
init  
aaronchen2k2k 已提交
9 10
)

aaronchen2k2k's avatar
aaronchen2k2k 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
func (e ExecFromDef) String() string {
	return string(e)
}

type ResponseCode struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
}

var (
	Success         = ResponseCode{0, "Request Successfully"}
	CommErr         = ResponseCode{100, "Common Error"}
	ParamErr        = ResponseCode{200, "Parameter Error"}
	UnAuthorizedErr = ResponseCode{401, "UnAuthorized"}

	ResponseParseErr = ResponseCode{6000, "Json Parse Error"}
	NeedInitErr      = ResponseCode{1000, "Data Not Init"}

雨爱无痕 已提交
29 30 31
	ErrDirNotEmpty                    = ResponseCode{1100, "Dir Not Empty Error"}
	ErrZentaoConfig                   = ResponseCode{2000, "Zentao Config Error"}
	ErrZentaoRequest                  = ResponseCode{3000, "zentao request Error"}
aaronchen2k2k's avatar
aaronchen2k2k 已提交
32 33 34
	ErrRecordWithSameNameExist        = ResponseCode{3010, "Record With Same Name Exist"}
	ErrRecordWithSamePathExist        = ResponseCode{3011, "Record With Same Path Exist"}
	ErrRecordWithSameInterpreterExist = ResponseCode{2000, "Record With Same Interpreter Exist"}
雨爱无痕 已提交
35
	ErrRecordNotExist                 = ResponseCode{4000, "Record Not Found"}
雨爱无痕 已提交
36
	ErrRecordNotAllowDelete           = ResponseCode{2000, "Record Can Not Delete"}
雨爱无痕 已提交
37
	ErrPostParam                      = ResponseCode{2000, "Parameter Error"}
雨爱无痕 已提交
38
	NotAvailable                      = ResponseCode{5000, "Not Available"}
雨爱无痕 已提交
39
	ServerNotAvailable                = ResponseCode{5001, "Server Not Available"}
雨爱无痕 已提交
40
	ProxyNotAvailable                 = ResponseCode{5002, "Proxy Not Available"}
aaronchen2k2k's avatar
aaronchen2k2k 已提交
41

aaronchen2k2k's avatar
aaronchen2k2k 已提交
42
	ErrFileOrDirExist = ResponseCode{6000, "File or Dir Exist"}
aaronchen2k2k's avatar
aaronchen2k2k 已提交
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
)

type ResultStatus string

const (
	PASS    ResultStatus = "pass"
	FAIL    ResultStatus = "fail"
	SKIP    ResultStatus = "skip"
	BLOCKED ResultStatus = "blocked"
	UNKNOWN ResultStatus = "unknown"
)

func (e ResultStatus) String() string {
	return string(e)
}

type ExecCmd string

const (
	ExecInit ExecCmd = "init"
	ExecStop ExecCmd = "execStop"

	ExecCase   ExecCmd = "execCase"
	ExecModule ExecCmd = "execModule"
	ExecSuite  ExecCmd = "execSuite"
	ExecTask   ExecCmd = "execTask"

aaronchen2k2k's avatar
aaronchen2k2k 已提交
70 71
	ExecUnit    ExecCmd = "execUnit"
	ExecZapScan ExecCmd = "zapScan"
雨爱无痕 已提交
72 73

	Watch ExecCmd = "watch"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139
)

func (e ExecCmd) String() string {
	return string(e)
}

type WsMsgCategory string

const (
	Output WsMsgCategory = "output"

	Run    WsMsgCategory = "run"
	Result WsMsgCategory = "result"
	Error  WsMsgCategory = "error"

	Communication WsMsgCategory = "communication"
	Unknown       WsMsgCategory = ""
)

func (e WsMsgCategory) String() string {
	return string(e)
}

type OsType string

const (
	OsWindows OsType = "windows"
	OsLinux   OsType = "linux"
	OsMac     OsType = "mac"
)

func (e OsType) String() string {
	return string(e)
}
func (OsType) Get(osName string) OsType {
	return OsType(osName)
}

type CaseStepType string

const (
	Group CaseStepType = "group"
	Item  CaseStepType = "item"
)

type ExecBy string

const (
	Case   ExecBy = "case"
	Module ExecBy = "module"
	Suite  ExecBy = "suite"
	Task   ExecBy = "task"
)

func (e ExecBy) String() string {
	return string(e)
}
func (ExecBy) Get(str string) ExecBy {
	return ExecBy(str)
}

type TestType string

const (
	TestFunc TestType = "func"
	TestUnit TestType = "unit"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
140
	TestZap  TestType = "zap"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
141 142 143 144 145 146 147 148 149 150 151 152 153
)

func (e TestType) String() string {
	return string(e)
}
func (TestType) Get(str string) TestType {
	return TestType(str)
}

type TestTool string

const (
	ZTF     TestTool = "ztf"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
154
	Allure  TestTool = "allure"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
155 156 157 158 159 160 161 162
	JUnit   TestTool = "junit"
	TestNG  TestTool = "testng"
	PHPUnit TestTool = "phpunit"
	PyTest  TestTool = "pytest"
	Jest    TestTool = "jest"
	CppUnit TestTool = "cppunit"
	GTest   TestTool = "gtest"
	QTest   TestTool = "qtest"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
163
	GoTest  TestTool = "gotest"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
164 165 166 167

	AutoIt         TestTool = "autoit"
	Selenium       TestTool = "selenium"
	Appium         TestTool = "appium"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
168
	RobotFramework TestTool = "robot"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
169
	Cypress        TestTool = "cypress"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
170 171
	Playwright     TestTool = "playwright"
	Puppeteer      TestTool = "puppeteer"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
172
	K6             TestTool = "k6"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
173
	Zap            TestTool = "zap"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
174 175 176 177 178 179 180 181 182 183 184 185 186
)

func (e TestTool) String() string {
	return string(e)
}
func (TestTool) Get(str string) TestTool {
	return TestTool(str)
}

type BuildTool string

const (
	Maven BuildTool = "maven"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
187
	Mocha BuildTool = "mocha"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256
)

func (e BuildTool) String() string {
	return string(e)
}
func (BuildTool) Get(str string) BuildTool {
	return BuildTool(str)
}

type PlatformType string

const (
	Android PlatformType = "android"
	Ios     PlatformType = "ios"
	Host    PlatformType = "host"
	Vm      PlatformType = "vm"
)

type TreeNodeType string

const (
	Root      TreeNodeType = "root"
	Workspace TreeNodeType = "workspace"
	Dir       TreeNodeType = "dir"
	File      TreeNodeType = "file"

	ZentaoModule TreeNodeType = "module"
)

type ScriptFilterType string

const (
	FilterWorkspace ScriptFilterType = "workspace"
	FilterModule    ScriptFilterType = "module"
	FilterSuite     ScriptFilterType = "suite"
	FilterTask      ScriptFilterType = "task"
)

type NodeCreateMode string

const (
	Brother NodeCreateMode = "brother"
	Child   NodeCreateMode = "child"
)

func (e NodeCreateMode) String() string {
	return string(e)
}

type NodeCreateType string

const (
	CreateDir  NodeCreateType = "dir"
	CreateNode NodeCreateType = "node"
)

func (e NodeCreateType) String() string {
	return string(e)
}

type DropPos int

const (
	Before DropPos = -1
	Inner  DropPos = 0
	After  DropPos = 1
)

func (e DropPos) Int() int {
aaronchen2k2k's avatar
init  
aaronchen2k2k 已提交
257 258
	return int(e)
}
aaronchen2k2k's avatar
aaronchen2k2k 已提交
259

260
type JobStatus string
aaronchen2k2k's avatar
aaronchen2k2k 已提交
261 262

const (
263 264
	JobCreated    JobStatus = "created"
	JobInprogress JobStatus = "inprogress"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
265

266 267 268
	// temp status
	JobTimeout JobStatus = "timeout"
	JobError   JobStatus = "error"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
269

270 271 272 273
	// final status
	JobCanceled  JobStatus = "canceled"
	JobCompleted JobStatus = "completed"
	JobFailed    JobStatus = "failed"
aaronchen2k2k's avatar
aaronchen2k2k 已提交
274
)
275 276 277 278

func (e JobStatus) ToString() string {
	return string(e)
}
aaronchen2k2k's avatar
aaronchen2k2k 已提交
279 280 281 282 283 284 285 286 287 288 289

type K6ResultType string

const (
	Metric K6ResultType = "Metric"
	Point  K6ResultType = "Point"
)

func (e K6ResultType) ToString() string {
	return string(e)
}