|
|
|
|
@ -113,6 +113,12 @@ func GetMonkeyAnomaliesByTaskId(c *gin.Context) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func createTbBug(ano models.MonkeyAnomaly) {
|
|
|
|
|
// 暂时忽略anr提单
|
|
|
|
|
if strings.Contains(ano.AnomalyInfos, "ANR in") {
|
|
|
|
|
fmt.Println("[Debug]", "anr异常将跳过提单逻辑")
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
db, err := dbsql.GetConn(dbsql.DSN)
|
|
|
|
|
if err != nil {
|
|
|
|
|
fmt.Println("[createTbBug]", err)
|
|
|
|
|
@ -127,15 +133,41 @@ func createTbBug(ano models.MonkeyAnomaly) {
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bug_type := "Other"
|
|
|
|
|
if strings.Contains(ano.AnomalyInfos, "FATAL EXCEPTION") {
|
|
|
|
|
bug_type = "EXCEPTION"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
content := ""
|
|
|
|
|
content += "**关联Monkey报告:** [点击查看](http://qa.flatincbr.work/#/monkey/result/" + cast.ToString(ano.TaskId) + ")" + "\n\n<br>\n\n"
|
|
|
|
|
content += "**上报时间:**" + ano.CreateTime.Format("2006-01-02 15:04:05") + "\n\n<br>\n\n"
|
|
|
|
|
content += "**应用版本:**" + task.Version + "\n\n<br>\n\n"
|
|
|
|
|
content += "**信息预览:**" + "\n\n"
|
|
|
|
|
for _, v := range ano.Anomalies {
|
|
|
|
|
for i, vv := range strings.Split(v, "\n") {
|
|
|
|
|
|
|
|
|
|
title := "【Monkey测试】"
|
|
|
|
|
for i, v := range ano.Anomalies {
|
|
|
|
|
for ii, vv := range strings.Split(v, "\n") {
|
|
|
|
|
content += "> " + vv + "\n"
|
|
|
|
|
if i > 10 {
|
|
|
|
|
switch bug_type {
|
|
|
|
|
case "EXCEPTION":
|
|
|
|
|
// 取第一行和第三行内容拼接
|
|
|
|
|
if i == 0 && ii == 0 {
|
|
|
|
|
_strs := strings.Split(vv, "): ")
|
|
|
|
|
if len(_strs) > 1 {
|
|
|
|
|
title += _strs[1] + " - "
|
|
|
|
|
}
|
|
|
|
|
} else if i == 0 && ii == 2 {
|
|
|
|
|
_strs := strings.Split(vv, "): ")
|
|
|
|
|
if len(_strs) > 1 {
|
|
|
|
|
title += _strs[1]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
if i == 0 && ii == 0 {
|
|
|
|
|
title += "未知异常 - " + vv
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ii > 10 {
|
|
|
|
|
break
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -145,11 +177,11 @@ func createTbBug(ano models.MonkeyAnomaly) {
|
|
|
|
|
content += "\n"
|
|
|
|
|
|
|
|
|
|
bug := common.NewBug("crushu") //task.Project
|
|
|
|
|
bug.SetExecutor("62733beb6918b259138d7577").
|
|
|
|
|
SetInvolveMember("62733beb6918b259138d7577").
|
|
|
|
|
SetTitle("【Monkey测试】任务id=" + cast.ToString(task.Id) + "发生异常").
|
|
|
|
|
|
|
|
|
|
bug.SetTitle(title).
|
|
|
|
|
SetPlatform(task.Platform).
|
|
|
|
|
SetContent(content)
|
|
|
|
|
SetContent(content).
|
|
|
|
|
SetCategory(common.BugCategory_Anomaly)
|
|
|
|
|
|
|
|
|
|
id, err := bug.Create()
|
|
|
|
|
if err != nil {
|
|
|
|
|
@ -158,4 +190,5 @@ func createTbBug(ano models.MonkeyAnomaly) {
|
|
|
|
|
}
|
|
|
|
|
fmt.Println("缺陷创建成功:", "https://www.teambition.com/task/"+id)
|
|
|
|
|
|
|
|
|
|
db.Table(ano.TableName()).Model(models.MonkeyAnomaly{}).Where("id = ?", ano.ID).Update("bug_id", id)
|
|
|
|
|
}
|
|
|
|
|
|