Commit 9c148a0c authored by wdy's avatar wdy

查询测试方法

parent 4ff42940
...@@ -21,5 +21,5 @@ public interface ITestTypeService extends IService<TestType> { ...@@ -21,5 +21,5 @@ public interface ITestTypeService extends IService<TestType> {
* 从科恩获取所有测试方法 * 从科恩获取所有测试方法
* @return * @return
*/ */
List<TestTypeVO> getTestTypeList(); List<String> getTestTypeList();
} }
...@@ -6,17 +6,17 @@ import com.alibaba.fastjson2.JSONObject; ...@@ -6,17 +6,17 @@ import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.domain.TestType; import com.ruoyi.domain.TestType;
import com.ruoyi.domain.vo.ScenarioVO;
import com.ruoyi.domain.vo.TestTypeVO;
import com.ruoyi.mapper.TestTypeMapper; import com.ruoyi.mapper.TestTypeMapper;
import com.ruoyi.service.ITestTypeService; import com.ruoyi.service.ITestTypeService;
import com.ruoyi.web.request.TestTypeRequest; import com.ruoyi.web.request.TestTypeRequest;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
@Service @Service
@Transactional @Transactional
...@@ -40,11 +40,21 @@ public class TestTypeServiceImpl extends ServiceImpl<TestTypeMapper, TestType> i ...@@ -40,11 +40,21 @@ public class TestTypeServiceImpl extends ServiceImpl<TestTypeMapper, TestType> i
} }
@Override @Override
public List<TestTypeVO> getTestTypeList() { public List<String> getTestTypeList() {
//以post形式请求接口 //以post形式请求接口
String result= HttpUtil.post("https://10.12.48.78:8090/DescribeScenarioTestTypeList",""); String result= HttpUtil.post("https://10.12.48.78:8090/DescribeScenarioTestTypeList","");
JSONObject jsonObject = JSONObject.parseObject(result); JSONObject jsonObject = JSONObject.parseObject(result);
return jsonObject.getList("test_type_list", TestTypeVO.class); return jsonObject.getList("test_type_list", TypeVO.class)
.stream()
.map(TypeVO::getName)
.collect(Collectors.toList());
}
@Data
public static class TypeVO {
private String name;
} }
} }
...@@ -57,7 +57,7 @@ public class TestTypeController extends BaseController { ...@@ -57,7 +57,7 @@ public class TestTypeController extends BaseController {
@Trace @Trace
@Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")}) @Tags({@Tag(key = "param", value = "arg[0]"), @Tag(key = "result", value = "returnedObj")})
@RequestMapping(method = RequestMethod.POST, value = "/getTestTypeList") @RequestMapping(method = RequestMethod.POST, value = "/getTestTypeList")
public R<List<TestTypeVO>> getTestTypeList(){ public R<List<String>> getTestTypeList(){
return R.ok(testTypeService.getTestTypeList()); return R.ok(testTypeService.getTestTypeList());
} }
......
package com.ruoyi.web.request;
import com.ruoyi.common.core.page.PageDomain;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "TestUserCaseListRequest", description = "查询测试用例")
public class TestUserCaseListRequest extends PageDomain {
@ApiModelProperty("测试场景")
private String testScenario;
@ApiModelProperty("测试方法")
private String testType;
@ApiModelProperty("用例编号或者名称关键字")
private String searchKeywords;
}
package com.ruoyi.web.response;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ApiModel(value = "TestUserCaseListResponse", description = "查询测试用例")
@Data
public class TestUserCaseListResponse {
@ApiModelProperty("测试场景")
private String testScenario;
@ApiModelProperty("测试方法")
private String testType;
@ApiModelProperty("用例编号")
private String useCaseNo;
@ApiModelProperty("用例名称")
private String useCaseName;
@ApiModelProperty("对应输入")
private String input;
@ApiModelProperty("用例描述")
private String description;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment