2.要求多字段 ,描述 也要求标准格式
【问题描述】【操作步骤】【预期结果】【实际结果】【手机型号】
3 要求多张截图
在下认为 app 测试 ,1 人起码匹配 2 台测试机,那么在这种要求提交高标准格式 jira 的情境之下,就会出现提交一个 bug 起码得 2 分钟以上
而有了这个工具 提交 bug 只是 2 秒的事情
bug 提交时间占比:截图 ,上传 pc,jira 手动选择多字段,传图,描述文案中,手动书写格式
/新增 父 issue
private String fatherIssue ;
private String modelName ;//模板名称
private long id ;
private String summary ;//主题
private String issueType ;//bug类型,子任务;Sub_Bug
private String issueType_id ;
private String priority ;//优先级
private String priority_id ;
private String components ;//模块
private String versions ;//影响版本
private String fixVersions ;//解决版本
private String assignee ;//经办人
private String customfield_10100 ;//Tester
private String customfield_10103 ; //抄送人
private String customfield_10607 ;//设计
private String customfield_10606 ;//缺陷分类
private String description ;//描述
由此开发了一款工具 bugposter,主要实现两个功能:创建 | 更新模板,一键创建 bug
把一些格式要求固定的主题 ,描述 版本 之类的抽象出来 ,每个用户 可以针对不同的 app 版本创建模板 ,或者更新模板,
创建 bug 时,在 app 端扫描二维码登录之后,本地选中图片,选中模板,直接提交 bug 即可
如下为遇到的一些问题:
jiraurl 参数:
public class Constant {
//登录
public static final String LOGIN_JIRA_SERVER = "http://jira.youxin.com/rest/api/latest/serverInfo" ;
//
public static final String PROJECT_VERSION_URL = "" ;
/父亲iSsue
public static final String GET_ISSUE_URL = "http://jira.youxin.com/rest/api/2/issue/" /*{issueIdOrKey}*/;
//获取IssueYTypeַ
public static final String GET_ISSUE_TYPE = "http://jira.youxin.com/rest/api/2/issuetype" ;
//获取优先级
public static final String GET_PRIORITY = "http://jira.youxin.com/rest/api/2/priority" ;
//获取域ַ
public static final String GET_FIELD = "http://jira.youxin.com/rest/api/2/field" ;
//获取可以指派的人ַ
public static final String GET_ASSIGN = "http://jira.youxin.com/rest/api/2/user/assignable/search" ;
//创建Bugַ
public static final String CREATE_ISSUE = "http://jira.youxin.com/rest/api/2/issue" ;
//获取componmentַ
public static final String GET_COMPONMENT = "http://jira.youxin.com/rest/api/2/component/1" ;
//获取项目分类ַ
public static final String GET_project_CATEGORY = "http://jira.youxin.com/rest/api/2/projectCategory";
//获取IssueLinkַ
public static final String GET_ISSUE_LINK = "http://jira.youxin.com/rest/api/2/issueLink" ;
//上传附件
public static final String UPLOAD_IMAGE_URL = "http://jira.youxin.com/rest/api/2/issue/0/attachments" ;
}
public static String getBase64LoginInfo(User u) {
String baseData = "";
if (null != u) {
String userName = u.getName();
String pwd = u.getPwd();
String login_info = userName + ":" + pwd;
baseData = Base64.encode(login_info.getBytes());
}
return baseData;
}
public static HttpURLConnection setConnection(HttpURLConnection conn,
String baseData) {
HttpURLConnection connection = conn;
//connection.setDoInput(true);
conn.setDoOutput(true) ;
//connection.setConnectTimeout(5000);
conn.setRequestProperty("Connection", "Keep-Alive");
// 设置文件字符集:
conn.addRequestProperty("Content-Type","application/json;charset=UTF-8;");
conn.addRequestProperty("Authorization", "Basic " + baseData);
//conn.setRequestProperty("Accept", "application/json") ;
//conn.addRequestProperty("User-Agent", "Android JIRA REST Client");
return connection;
}
提交bug的参数:
public static Map<String,Map<Object, Object>> getIssueParam(User u,Model model,String project_id){
//创建返回的fields
Map<String, Map<Object, Object>> map = new HashMap<String, Map<Object,Object>>() ;
Map<Object, Object> res = new HashMap<Object, Object>() ;
//创建传的priority,issueType
Map<String, String> priority = new HashMap<String,String>() ;
Map<String, String> issuetype = new HashMap<String,String>() ;
Map<String, String> assignee = new HashMap<String,String>() ;
Map<String, String> project = new HashMap<String, String>() ;
Map<String, String> parent = new HashMap<String, String>() ;
Map<String, String> tester = new HashMap<String, String>() ;
tester.put("name", u.getName()) ;
parent.put("key", project_id) ;
project.put("key","APP") ;
priority.put("id", model.getPriority_id()) ;
issuetype.put("id", model.getIssueType_id()) ;
assignee.put("name", u.getName()) ;
res.put("project", project) ;
res.put("summary", model.getSummary()) ;
res.put("description", model.getDescription()) ;
//res.put("customfield_10606", model.getCustomfield_10606()) ;
res.put("issuetype", issuetype) ;
res.put("priority", priority) ;
res.put("parent", parent) ;
res.put("assignee", assignee) ;//添加默认经办人
//直接设置tester
res.put("customfield_10100",tester) ;
//新增 fixVersions versions components ,三者都是list
ArrayList<Map<String, String>> comp = new ArrayList<Map<String,String>>() ;
Map<String, String> components_name = new HashMap<String, String>() ;
components_name.put("name", model.getComponents()) ;
comp.add(components_name) ;
ArrayList<Map<String, String>> fixVersion = new ArrayList<Map<String,String>>();
Map<String, String> fixVersions_name = new HashMap<String, String>() ;
fixVersions_name.put("name", model.getFixVersions()) ;
fixVersion.add(fixVersions_name) ;
ArrayList<Map<String, String>> versions = new ArrayList<Map<String,String>>() ;
Map<String, String> versions_name = new HashMap<String, String>() ;
versions_name.put("name", model.getVersions()) ;
versions.add(versions_name) ;
res.put("components", comp) ;
res.put("fixVersions", fixVersion) ;
res.put("versions", versions) ;
map.put("fields", res) ;
return map ;
}
```erb
时间比较仓储 ,大家看的时候如果有问题,随时交流