功能测试->接口测试

This commit is contained in:
chenjianxing 2020-04-03 11:25:23 +08:00
parent 38e9810a97
commit d421965476
50 changed files with 421 additions and 447 deletions

View File

@ -2,7 +2,7 @@ package io.metersphere.base.domain;
import java.io.Serializable;
public class FucTest implements Serializable {
public class ApiTest implements Serializable {
private String id;
private String projectId;

View File

@ -3,14 +3,14 @@ package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class FucTestExample {
public class ApiTestExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public FucTestExample() {
public ApiTestExample() {
oredCriteria = new ArrayList<Criteria>();
}

View File

@ -2,7 +2,7 @@ package io.metersphere.base.domain;
import java.io.Serializable;
public class FucTestFile implements Serializable {
public class ApiTestFile implements Serializable {
private String testId;
private String fileId;

View File

@ -3,14 +3,14 @@ package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class FucTestFileExample {
public class ApiTestFileExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public FucTestFileExample() {
public ApiTestFileExample() {
oredCriteria = new ArrayList<Criteria>();
}

View File

@ -2,7 +2,7 @@ package io.metersphere.base.domain;
import java.io.Serializable;
public class FucTestReport implements Serializable {
public class ApiTestReport implements Serializable {
private String id;
private String testId;

View File

@ -3,14 +3,14 @@ package io.metersphere.base.domain;
import java.util.ArrayList;
import java.util.List;
public class FucTestReportExample {
public class ApiTestReportExample {
protected String orderByClause;
protected boolean distinct;
protected List<Criteria> oredCriteria;
public FucTestReportExample() {
public ApiTestReportExample() {
oredCriteria = new ArrayList<Criteria>();
}

View File

@ -2,7 +2,7 @@ package io.metersphere.base.domain;
import java.io.Serializable;
public class FucTestWithBLOBs extends FucTest implements Serializable {
public class ApiTestWithBLOBs extends ApiTest implements Serializable {
private String runtimeConfiguration;
private String schedule;

View File

@ -1,23 +0,0 @@
package io.metersphere.base.domain;
public class FucTestLog {
private String seleniumLog;
private String browserDriverLog;
public String getSeleniumLog() {
return seleniumLog;
}
public void setSeleniumLog(String seleniumLog) {
this.seleniumLog = seleniumLog;
}
public String getBrowserDriverLog() {
return browserDriverLog;
}
public void setBrowserDriverLog(String browserDriverLog) {
this.browserDriverLog = browserDriverLog;
}
}

View File

@ -0,0 +1,22 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.ApiTestFile;
import io.metersphere.base.domain.ApiTestFileExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ApiTestFileMapper {
long countByExample(ApiTestFileExample example);
int deleteByExample(ApiTestFileExample example);
int insert(ApiTestFile record);
int insertSelective(ApiTestFile record);
List<ApiTestFile> selectByExample(ApiTestFileExample example);
int updateByExampleSelective(@Param("record") ApiTestFile record, @Param("example") ApiTestFileExample example);
int updateByExample(@Param("record") ApiTestFile record, @Param("example") ApiTestFileExample example);
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.FucTestFileMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.FucTestFile">
<mapper namespace="io.metersphere.base.mapper.ApiTestFileMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiTestFile">
<result column="test_id" jdbcType="VARCHAR" property="testId" />
<result column="file_id" jdbcType="VARCHAR" property="fileId" />
</resultMap>
@ -66,13 +66,13 @@
<sql id="Base_Column_List">
test_id, file_id
</sql>
<select id="selectByExample" parameterType="io.metersphere.base.domain.FucTestFileExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiTestFileExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from fuc_test_file
from api_test_file
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
@ -80,18 +80,18 @@
order by ${orderByClause}
</if>
</select>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.FucTestFileExample">
delete from fuc_test_file
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiTestFileExample">
delete from api_test_file
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.FucTestFile">
insert into fuc_test_file (test_id, file_id)
<insert id="insert" parameterType="io.metersphere.base.domain.ApiTestFile">
insert into api_test_file (test_id, file_id)
values (#{testId,jdbcType=VARCHAR}, #{fileId,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.FucTestFile">
insert into fuc_test_file
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestFile">
insert into api_test_file
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="testId != null">
test_id,
@ -109,14 +109,14 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.FucTestFileExample" resultType="java.lang.Long">
select count(*) from fuc_test_file
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiTestFileExample" resultType="java.lang.Long">
select count(*) from api_test_file
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update fuc_test_file
update api_test_file
<set>
<if test="record.testId != null">
test_id = #{record.testId,jdbcType=VARCHAR},
@ -130,7 +130,7 @@
</if>
</update>
<update id="updateByExample" parameterType="map">
update fuc_test_file
update api_test_file
set test_id = #{record.testId,jdbcType=VARCHAR},
file_id = #{record.fileId,jdbcType=VARCHAR}
<if test="_parameter != null">

View File

@ -0,0 +1,37 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.ApiTest;
import io.metersphere.base.domain.ApiTestExample;
import io.metersphere.base.domain.ApiTestWithBLOBs;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ApiTestMapper {
long countByExample(ApiTestExample example);
int deleteByExample(ApiTestExample example);
int deleteByPrimaryKey(String id);
int insert(ApiTestWithBLOBs record);
int insertSelective(ApiTestWithBLOBs record);
List<ApiTestWithBLOBs> selectByExampleWithBLOBs(ApiTestExample example);
List<ApiTest> selectByExample(ApiTestExample example);
ApiTestWithBLOBs selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") ApiTestWithBLOBs record, @Param("example") ApiTestExample example);
int updateByExampleWithBLOBs(@Param("record") ApiTestWithBLOBs record, @Param("example") ApiTestExample example);
int updateByExample(@Param("record") ApiTest record, @Param("example") ApiTestExample example);
int updateByPrimaryKeySelective(ApiTestWithBLOBs record);
int updateByPrimaryKeyWithBLOBs(ApiTestWithBLOBs record);
int updateByPrimaryKey(ApiTest record);
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.FucTestMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.FucTest">
<mapper namespace="io.metersphere.base.mapper.ApiTestMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiTest">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="project_id" jdbcType="VARCHAR" property="projectId" />
<result column="name" jdbcType="VARCHAR" property="name" />
@ -9,7 +9,7 @@
<result column="create_time" jdbcType="BIGINT" property="createTime" />
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.FucTestWithBLOBs">
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestWithBLOBs">
<result column="runtime_configuration" jdbcType="LONGVARCHAR" property="runtimeConfiguration" />
<result column="schedule" jdbcType="LONGVARCHAR" property="schedule" />
</resultMap>
@ -77,7 +77,7 @@
<sql id="Blob_Column_List">
runtime_configuration, schedule
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.FucTestExample" resultMap="ResultMapWithBLOBs">
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiTestExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
@ -85,7 +85,7 @@
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from fuc_test
from api_test
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
@ -93,13 +93,13 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.base.domain.FucTestExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiTestExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from fuc_test
from api_test
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
@ -112,29 +112,29 @@
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from fuc_test
from api_test
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from fuc_test
delete from api_test
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.FucTestExample">
delete from fuc_test
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiTestExample">
delete from api_test
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.FucTestWithBLOBs">
insert into fuc_test (id, project_id, name,
<insert id="insert" parameterType="io.metersphere.base.domain.ApiTestWithBLOBs">
insert into api_test (id, project_id, name,
description, create_time, update_time,
runtime_configuration, schedule)
values (#{id,jdbcType=VARCHAR}, #{projectId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{runtimeConfiguration,jdbcType=LONGVARCHAR}, #{schedule,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.FucTestWithBLOBs">
insert into fuc_test
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestWithBLOBs">
insert into api_test
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
@ -188,14 +188,14 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.FucTestExample" resultType="java.lang.Long">
select count(*) from fuc_test
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiTestExample" resultType="java.lang.Long">
select count(*) from api_test
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update fuc_test
update api_test
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
@ -227,7 +227,7 @@
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update fuc_test
update api_test
set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
@ -241,7 +241,7 @@
</if>
</update>
<update id="updateByExample" parameterType="map">
update fuc_test
update api_test
set id = #{record.id,jdbcType=VARCHAR},
project_id = #{record.projectId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
@ -252,8 +252,8 @@
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.FucTestWithBLOBs">
update fuc_test
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiTestWithBLOBs">
update api_test
<set>
<if test="projectId != null">
project_id = #{projectId,jdbcType=VARCHAR},
@ -279,8 +279,8 @@
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.FucTestWithBLOBs">
update fuc_test
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.ApiTestWithBLOBs">
update api_test
set project_id = #{projectId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
@ -290,8 +290,8 @@
schedule = #{schedule,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.FucTest">
update fuc_test
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiTest">
update api_test
set project_id = #{projectId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},

View File

@ -0,0 +1,36 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.ApiTestReport;
import io.metersphere.base.domain.ApiTestReportExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface ApiTestReportMapper {
long countByExample(ApiTestReportExample example);
int deleteByExample(ApiTestReportExample example);
int deleteByPrimaryKey(String id);
int insert(ApiTestReport record);
int insertSelective(ApiTestReport record);
List<ApiTestReport> selectByExampleWithBLOBs(ApiTestReportExample example);
List<ApiTestReport> selectByExample(ApiTestReportExample example);
ApiTestReport selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") ApiTestReport record, @Param("example") ApiTestReportExample example);
int updateByExampleWithBLOBs(@Param("record") ApiTestReport record, @Param("example") ApiTestReportExample example);
int updateByExample(@Param("record") ApiTestReport record, @Param("example") ApiTestReportExample example);
int updateByPrimaryKeySelective(ApiTestReport record);
int updateByPrimaryKeyWithBLOBs(ApiTestReport record);
int updateByPrimaryKey(ApiTestReport record);
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="io.metersphere.base.mapper.FucTestReportMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.FucTestReport">
<mapper namespace="io.metersphere.base.mapper.ApiTestReportMapper">
<resultMap id="BaseResultMap" type="io.metersphere.base.domain.ApiTestReport">
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="test_id" jdbcType="VARCHAR" property="testId" />
<result column="name" jdbcType="VARCHAR" property="name" />
@ -10,7 +10,7 @@
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
<result column="status" jdbcType="VARCHAR" property="status" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.FucTestReport">
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.metersphere.base.domain.ApiTestReport">
<result column="content" jdbcType="LONGVARCHAR" property="content" />
</resultMap>
<sql id="Example_Where_Clause">
@ -77,7 +77,7 @@
<sql id="Blob_Column_List">
content
</sql>
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.FucTestReportExample" resultMap="ResultMapWithBLOBs">
<select id="selectByExampleWithBLOBs" parameterType="io.metersphere.base.domain.ApiTestReportExample" resultMap="ResultMapWithBLOBs">
select
<if test="distinct">
distinct
@ -85,7 +85,7 @@
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from fuc_test_report
from api_test_report
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
@ -93,13 +93,13 @@
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="io.metersphere.base.domain.FucTestReportExample" resultMap="BaseResultMap">
<select id="selectByExample" parameterType="io.metersphere.base.domain.ApiTestReportExample" resultMap="BaseResultMap">
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from fuc_test_report
from api_test_report
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
@ -112,29 +112,29 @@
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from fuc_test_report
from api_test_report
where id = #{id,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from fuc_test_report
delete from api_test_report
where id = #{id,jdbcType=VARCHAR}
</delete>
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.FucTestReportExample">
delete from fuc_test_report
<delete id="deleteByExample" parameterType="io.metersphere.base.domain.ApiTestReportExample">
delete from api_test_report
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="io.metersphere.base.domain.FucTestReport">
insert into fuc_test_report (id, test_id, name,
<insert id="insert" parameterType="io.metersphere.base.domain.ApiTestReport">
insert into api_test_report (id, test_id, name,
description, create_time, update_time,
status, content)
values (#{id,jdbcType=VARCHAR}, #{testId,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
#{description,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT},
#{status,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="io.metersphere.base.domain.FucTestReport">
insert into fuc_test_report
<insert id="insertSelective" parameterType="io.metersphere.base.domain.ApiTestReport">
insert into api_test_report
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
@ -188,14 +188,14 @@
</if>
</trim>
</insert>
<select id="countByExample" parameterType="io.metersphere.base.domain.FucTestReportExample" resultType="java.lang.Long">
select count(*) from fuc_test_report
<select id="countByExample" parameterType="io.metersphere.base.domain.ApiTestReportExample" resultType="java.lang.Long">
select count(*) from api_test_report
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
update fuc_test_report
update api_test_report
<set>
<if test="record.id != null">
id = #{record.id,jdbcType=VARCHAR},
@ -227,7 +227,7 @@
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
update fuc_test_report
update api_test_report
set id = #{record.id,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
@ -241,7 +241,7 @@
</if>
</update>
<update id="updateByExample" parameterType="map">
update fuc_test_report
update api_test_report
set id = #{record.id,jdbcType=VARCHAR},
test_id = #{record.testId,jdbcType=VARCHAR},
name = #{record.name,jdbcType=VARCHAR},
@ -253,8 +253,8 @@
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.FucTestReport">
update fuc_test_report
<update id="updateByPrimaryKeySelective" parameterType="io.metersphere.base.domain.ApiTestReport">
update api_test_report
<set>
<if test="testId != null">
test_id = #{testId,jdbcType=VARCHAR},
@ -280,8 +280,8 @@
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.FucTestReport">
update fuc_test_report
<update id="updateByPrimaryKeyWithBLOBs" parameterType="io.metersphere.base.domain.ApiTestReport">
update api_test_report
set test_id = #{testId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},
@ -291,8 +291,8 @@
content = #{content,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.FucTestReport">
update fuc_test_report
<update id="updateByPrimaryKey" parameterType="io.metersphere.base.domain.ApiTestReport">
update api_test_report
set test_id = #{testId,jdbcType=VARCHAR},
name = #{name,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR},

View File

@ -1,22 +0,0 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.FucTestFile;
import io.metersphere.base.domain.FucTestFileExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface FucTestFileMapper {
long countByExample(FucTestFileExample example);
int deleteByExample(FucTestFileExample example);
int insert(FucTestFile record);
int insertSelective(FucTestFile record);
List<FucTestFile> selectByExample(FucTestFileExample example);
int updateByExampleSelective(@Param("record") FucTestFile record, @Param("example") FucTestFileExample example);
int updateByExample(@Param("record") FucTestFile record, @Param("example") FucTestFileExample example);
}

View File

@ -1,37 +0,0 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.FucTest;
import io.metersphere.base.domain.FucTestExample;
import io.metersphere.base.domain.FucTestWithBLOBs;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface FucTestMapper {
long countByExample(FucTestExample example);
int deleteByExample(FucTestExample example);
int deleteByPrimaryKey(String id);
int insert(FucTestWithBLOBs record);
int insertSelective(FucTestWithBLOBs record);
List<FucTestWithBLOBs> selectByExampleWithBLOBs(FucTestExample example);
List<FucTest> selectByExample(FucTestExample example);
FucTestWithBLOBs selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") FucTestWithBLOBs record, @Param("example") FucTestExample example);
int updateByExampleWithBLOBs(@Param("record") FucTestWithBLOBs record, @Param("example") FucTestExample example);
int updateByExample(@Param("record") FucTest record, @Param("example") FucTestExample example);
int updateByPrimaryKeySelective(FucTestWithBLOBs record);
int updateByPrimaryKeyWithBLOBs(FucTestWithBLOBs record);
int updateByPrimaryKey(FucTest record);
}

View File

@ -1,36 +0,0 @@
package io.metersphere.base.mapper;
import io.metersphere.base.domain.FucTestReport;
import io.metersphere.base.domain.FucTestReportExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface FucTestReportMapper {
long countByExample(FucTestReportExample example);
int deleteByExample(FucTestReportExample example);
int deleteByPrimaryKey(String id);
int insert(FucTestReport record);
int insertSelective(FucTestReport record);
List<FucTestReport> selectByExampleWithBLOBs(FucTestReportExample example);
List<FucTestReport> selectByExample(FucTestReportExample example);
FucTestReport selectByPrimaryKey(String id);
int updateByExampleSelective(@Param("record") FucTestReport record, @Param("example") FucTestReportExample example);
int updateByExampleWithBLOBs(@Param("record") FucTestReport record, @Param("example") FucTestReportExample example);
int updateByExample(@Param("record") FucTestReport record, @Param("example") FucTestReportExample example);
int updateByPrimaryKeySelective(FucTestReport record);
int updateByPrimaryKeyWithBLOBs(FucTestReport record);
int updateByPrimaryKey(FucTestReport record);
}

View File

@ -1,11 +1,11 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.controller.request.testplan.QueryTestPlanRequest;
import io.metersphere.dto.FunctionalTestDTO;
import io.metersphere.dto.ApiTestDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtFunctionalTestMapper {
List<FunctionalTestDTO> list(@Param("request") QueryTestPlanRequest params);
public interface ExtApiTestMapper {
List<ApiTestDTO> list(@Param("request") QueryTestPlanRequest params);
}

View File

@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="io.metersphere.base.mapper.ext.ExtFunctionalTestMapper">
<mapper namespace="io.metersphere.base.mapper.ext.ExtApiTestMapper">
<resultMap id="BaseResultMap" type="io.metersphere.dto.FunctionalTestDTO"
extends="io.metersphere.base.mapper.FucTestMapper.BaseResultMap">
<resultMap id="BaseResultMap" type="io.metersphere.dto.ApiTestDTO"
extends="io.metersphere.base.mapper.ApiTestMapper.BaseResultMap">
<result column="project_name" property="projectName"/>
</resultMap>
<select id="list" resultMap="BaseResultMap" parameterType="io.metersphere.controller.request.testplan.QueryTestPlanRequest">
select fuc_test.*, project.name as project_name
from fuc_test
left join project on fuc_test.project_id = project.id
select api_test.*, project.name as project_name
from api_test
left join project on api_test.project_id = project.id
<where>
<if test="request.name != null">
and fuc_test.name like CONCAT('%', #{request.name},'%')
and api_test.name like CONCAT('%', #{request.name},'%')
</if>
<if test="request.workspaceId != null">
AND project.workspace_id = #{request.workspaceId}
@ -22,11 +22,11 @@
AND project.id = #{request.projectId}
</if>
<if test="request.id != null">
AND fuc_test.id = #{request.id}
AND api_test.id = #{request.id}
</if>
</where>
<if test="request.recent">
order by fuc_test.update_time desc
order by api_test.update_time desc
</if>
</select>

View File

@ -0,0 +1,14 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.controller.request.ReportRequest;
import io.metersphere.dto.ApiReportDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtApiTestReportMapper {
List<ApiReportDTO> getReportList(@Param("reportRequest") ReportRequest request);
ApiReportDTO getReportTestAndProInfo(@Param("id") String id);
}

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="io.metersphere.base.mapper.ext.ExtFunctionalTestReportMapper">
<mapper namespace="io.metersphere.base.mapper.ext.ExtApiTestReportMapper">
<select id="getReportList" resultType="io.metersphere.dto.FunctionalReportDTO">
<select id="getReportList" resultType="io.metersphere.dto.ApiReportDTO">
select ltr.id, ltr.name, ltr.test_id as testId, ltr.description,
ltr.create_time as createTime, ltr.update_time as updateTime, ltr.status as status, lt.name as testName
from fuc_test_report ltr left join fuc_test lt on ltr.test_id = lt.id
from api_test_report ltr left join api_test lt on ltr.test_id = lt.id
<where>
<if test="reportRequest.name != null">
AND ltr.name like CONCAT('%', #{reportRequest.name},'%')
@ -13,12 +13,12 @@
</where>
</select>
<select id="getReportTestAndProInfo" resultType="io.metersphere.dto.FunctionalReportDTO">
<select id="getReportTestAndProInfo" resultType="io.metersphere.dto.ApiReportDTO">
select ltr.id, ltr.name, ltr.test_id as testId, ltr.description,
ltr.create_time as createTime, ltr.update_time as updateTime, ltr.status as status, ltr.content as content,
lt.name as testName,
p.id as projectId, p.name as projectName
from fuc_test_report ltr left join fuc_test lt on ltr.test_id = lt.id left join project p on lt.project_id = p.id
from api_test_report ltr left join api_test lt on ltr.test_id = lt.id left join project p on lt.project_id = p.id
where ltr.id = #{id}
</select>

View File

@ -1,15 +0,0 @@
package io.metersphere.base.mapper.ext;
import io.metersphere.controller.request.ReportRequest;
import io.metersphere.dto.FunctionalReportDTO;
import io.metersphere.dto.ReportDTO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface ExtFunctionalTestReportMapper {
List<FunctionalReportDTO> getReportList(@Param("reportRequest") ReportRequest request);
FunctionalReportDTO getReportTestAndProInfo(@Param("id") String id);
}

View File

@ -2,14 +2,13 @@ package io.metersphere.controller;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import io.metersphere.base.domain.FucTestLog;
import io.metersphere.base.domain.FucTestReport;
import io.metersphere.base.domain.ApiTestReport;
import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.controller.request.ReportRequest;
import io.metersphere.dto.FunctionalReportDTO;
import io.metersphere.service.FunctionalReportService;
import io.metersphere.dto.ApiReportDTO;
import io.metersphere.service.ApiReportService;
import io.metersphere.user.SessionUtils;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
@ -19,36 +18,36 @@ import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping(value = "/functional/report")
public class FunctionalReportController {
@RequestMapping(value = "/api/report")
public class ApiReportController {
@Resource
private FunctionalReportService functionalReportService;
private ApiReportService apiReportService;
@GetMapping("/recent/{count}")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public List<FucTestReport> recentProjects(@PathVariable int count) {
public List<ApiTestReport> recentProjects(@PathVariable int count) {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
ReportRequest request = new ReportRequest();
request.setWorkspaceId(currentWorkspaceId);
PageHelper.startPage(1, count);
return functionalReportService.getRecentReportList(request);
return apiReportService.getRecentReportList(request);
}
@PostMapping("/list/all/{goPage}/{pageSize}")
public Pager<List<FunctionalReportDTO>> getReportList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ReportRequest request) {
public Pager<List<ApiReportDTO>> getReportList(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody ReportRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
return PageUtils.setPageInfo(page, functionalReportService.getReportList(request));
return PageUtils.setPageInfo(page, apiReportService.getReportList(request));
}
@PostMapping("/delete/{reportId}")
public void deleteReport(@PathVariable String reportId) {
functionalReportService.deleteReport(reportId);
apiReportService.deleteReport(reportId);
}
@GetMapping("/test/pro/info/{reportId}")
public FunctionalReportDTO getReportTestAndProInfo(@PathVariable String reportId) {
return functionalReportService.getReportTestAndProInfo(reportId);
public ApiReportDTO getReportTestAndProInfo(@PathVariable String reportId) {
return apiReportService.getReportTestAndProInfo(reportId);
}
}

View File

@ -7,9 +7,9 @@ import io.metersphere.commons.constants.RoleConstants;
import io.metersphere.commons.utils.PageUtils;
import io.metersphere.commons.utils.Pager;
import io.metersphere.controller.request.testplan.*;
import io.metersphere.dto.FunctionalTestDTO;
import io.metersphere.dto.ApiTestDTO;
import io.metersphere.service.FileService;
import io.metersphere.service.FuctionalTestService;
import io.metersphere.service.ApiTestService;
import io.metersphere.user.SessionUtils;
import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresRoles;
@ -23,28 +23,28 @@ import javax.annotation.Resource;
import java.util.List;
@RestController
@RequestMapping(value = "/functional/test")
@RequestMapping(value = "/api")
@RequiresRoles(value = {RoleConstants.TEST_MANAGER, RoleConstants.TEST_USER, RoleConstants.TEST_VIEWER}, logical = Logical.OR)
public class FunctionalTestController {
public class ApiTestController {
@Resource
private FuctionalTestService fuctionalTestService;
private ApiTestService apiTestService;
@Resource
private FileService fileService;
@GetMapping("recent/{count}")
public List<FunctionalTestDTO> recentTestPlans(@PathVariable int count) {
public List<ApiTestDTO> recentTestPlans(@PathVariable int count) {
String currentWorkspaceId = SessionUtils.getCurrentWorkspaceId();
QueryTestPlanRequest request = new QueryTestPlanRequest();
request.setWorkspaceId(currentWorkspaceId);
PageHelper.startPage(1, count, true);
return fuctionalTestService.recentTestPlans(request);
return apiTestService.recentTestPlans(request);
}
@PostMapping("/list/{goPage}/{pageSize}")
public Pager<List<FunctionalTestDTO>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanRequest request) {
public Pager<List<ApiTestDTO>> list(@PathVariable int goPage, @PathVariable int pageSize, @RequestBody QueryTestPlanRequest request) {
Page<Object> page = PageHelper.startPage(goPage, pageSize, true);
request.setWorkspaceId(SessionUtils.getCurrentWorkspaceId());
return PageUtils.setPageInfo(page, fuctionalTestService.list(request));
return PageUtils.setPageInfo(page, apiTestService.list(request));
}
@PostMapping(value = "/save", consumes = {"multipart/form-data"})
@ -52,7 +52,7 @@ public class FunctionalTestController {
@RequestPart("request") SaveTestPlanRequest request,
@RequestPart(value = "file") MultipartFile file
) {
return fuctionalTestService.save(request, file);
return apiTestService.save(request, file);
}
@PostMapping(value = "/edit", consumes = {"multipart/form-data"})
@ -60,32 +60,32 @@ public class FunctionalTestController {
@RequestPart("request") EditTestPlanRequest request,
@RequestPart(value = "file", required = false) MultipartFile file
) {
return fuctionalTestService.edit(request, file);
return apiTestService.edit(request, file);
}
@GetMapping("/get/{testId}")
public FunctionalTestDTO get(@PathVariable String testId) {
return fuctionalTestService.get(testId);
public ApiTestDTO get(@PathVariable String testId) {
return apiTestService.get(testId);
}
@GetMapping("/get-runtime-config/{testId}")
public String getAdvancedConfiguration(@PathVariable String testId) {
return fuctionalTestService.getRuntimeConfiguration(testId);
return apiTestService.getRuntimeConfiguration(testId);
}
@PostMapping("/delete")
public void delete(@RequestBody DeleteTestPlanRequest request) {
fuctionalTestService.delete(request);
apiTestService.delete(request);
}
@PostMapping("/run")
public void run(@RequestBody RunTestPlanRequest request) {
fuctionalTestService.run(request);
apiTestService.run(request);
}
@GetMapping("/file/metadata/{testId}")
public FileMetadata getFileMetadata(@PathVariable String testId) {
return fileService.getFucFileMetadataByTestId(testId);
return fileService.getApiFileMetadataByTestId(testId);
}
@PostMapping("/file/download")

View File

@ -1,6 +1,6 @@
package io.metersphere.dto;
public class FunctionalReportDTO {
public class ApiReportDTO {
private String id;
private String testId;

View File

@ -2,7 +2,7 @@ package io.metersphere.dto;
import io.metersphere.base.domain.LoadTest;
public class FunctionalTestDTO extends LoadTest {
public class ApiTestDTO extends LoadTest {
private String projectName;
public String getProjectName() {

View File

@ -0,0 +1,42 @@
package io.metersphere.service;
import io.metersphere.base.domain.ApiTestReport;
import io.metersphere.base.domain.ApiTestReportExample;
import io.metersphere.base.mapper.ApiTestReportMapper;
import io.metersphere.base.mapper.ext.ExtApiTestReportMapper;
import io.metersphere.controller.request.ReportRequest;
import io.metersphere.dto.ApiReportDTO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class ApiReportService {
@Resource
private ApiTestReportMapper ApiTestReportMapper;
@Resource
private ExtApiTestReportMapper extApiTestReportMapper;
public List<ApiTestReport> getRecentReportList(ReportRequest request) {
ApiTestReportExample example = new ApiTestReportExample();
example.setOrderByClause("update_time desc");
return ApiTestReportMapper.selectByExample(example);
}
public List<ApiReportDTO> getReportList(ReportRequest request) {
return extApiTestReportMapper.getReportList(request);
}
public void deleteReport(String reportId) {
ApiTestReportMapper.deleteByPrimaryKey(reportId);
}
public ApiReportDTO getReportTestAndProInfo(String reportId) {
return extApiTestReportMapper.getReportTestAndProInfo(reportId);
}
}

View File

@ -2,10 +2,10 @@ package io.metersphere.service;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.*;
import io.metersphere.base.mapper.ext.ExtFunctionalTestMapper;
import io.metersphere.base.mapper.ext.ExtApiTestMapper;
import io.metersphere.commons.exception.MSException;
import io.metersphere.controller.request.testplan.*;
import io.metersphere.dto.FunctionalTestDTO;
import io.metersphere.dto.ApiTestDTO;
import io.metersphere.i18n.Translator;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -20,11 +20,11 @@ import java.util.UUID;
@Service
@Transactional(rollbackFor = Exception.class)
public class FuctionalTestService {
public class ApiTestService {
@Resource
private FucTestMapper fucTestMapper;
private ApiTestMapper ApiTestMapper;
@Resource
private ExtFunctionalTestMapper extFucTestMapper;
private ExtApiTestMapper extApiTestMapper;
@Resource
private ProjectMapper projectMapper;
@Resource
@ -32,16 +32,16 @@ public class FuctionalTestService {
@Resource
private FileContentMapper fileContentMapper;
@Resource
private FucTestFileMapper fucTestFileMapper;
private ApiTestFileMapper ApiTestFileMapper;
@Resource
private FileService fileService;
public List<FunctionalTestDTO> list(QueryTestPlanRequest request) {
return extFucTestMapper.list(request);
public List<ApiTestDTO> list(QueryTestPlanRequest request) {
return extApiTestMapper.list(request);
}
public void delete(DeleteTestPlanRequest request) {
fucTestMapper.deleteByPrimaryKey(request.getId());
ApiTestMapper.deleteByPrimaryKey(request.getId());
fileService.deleteFileByTestId(request.getId());
}
@ -53,34 +53,34 @@ public class FuctionalTestService {
final FileMetadata fileMetadata = saveFile(file);
final FucTestWithBLOBs fucTest = saveFucTest(request);
final ApiTestWithBLOBs ApiTest = saveApiTest(request);
FucTestFile fucTestFile = new FucTestFile();
fucTestFile.setTestId(fucTest.getId());
fucTestFile.setFileId(fileMetadata.getId());
fucTestFileMapper.insert(fucTestFile);
ApiTestFile ApiTestFile = new ApiTestFile();
ApiTestFile.setTestId(ApiTest.getId());
ApiTestFile.setFileId(fileMetadata.getId());
ApiTestFileMapper.insert(ApiTestFile);
return fucTest.getId();
return ApiTest.getId();
}
private FucTestWithBLOBs saveFucTest(SaveTestPlanRequest request) {
private ApiTestWithBLOBs saveApiTest(SaveTestPlanRequest request) {
FucTestExample example = new FucTestExample();
ApiTestExample example = new ApiTestExample();
example.createCriteria().andNameEqualTo(request.getName()).andProjectIdEqualTo(request.getProjectId());
if (fucTestMapper.countByExample(example) > 0) {
if (ApiTestMapper.countByExample(example) > 0) {
MSException.throwException(Translator.get("function_test_already_exists"));
}
final FucTestWithBLOBs fucTes = new FucTestWithBLOBs();
fucTes.setId(UUID.randomUUID().toString());
fucTes.setName(request.getName());
fucTes.setProjectId(request.getProjectId());
fucTes.setCreateTime(System.currentTimeMillis());
fucTes.setUpdateTime(System.currentTimeMillis());
fucTes.setDescription("todo");
fucTes.setRuntimeConfiguration(request.getRuntimeConfiguration());
fucTestMapper.insert(fucTes);
return fucTes;
final ApiTestWithBLOBs ApiTes = new ApiTestWithBLOBs();
ApiTes.setId(UUID.randomUUID().toString());
ApiTes.setName(request.getName());
ApiTes.setProjectId(request.getProjectId());
ApiTes.setCreateTime(System.currentTimeMillis());
ApiTes.setUpdateTime(System.currentTimeMillis());
ApiTes.setDescription("todo");
ApiTes.setRuntimeConfiguration(request.getRuntimeConfiguration());
ApiTestMapper.insert(ApiTes);
return ApiTes;
}
private FileMetadata saveFile(MultipartFile file) {
@ -110,30 +110,30 @@ public class FuctionalTestService {
if (file != null) {
fileService.deleteFileByTestId(request.getId());
final FileMetadata fileMetadata = saveFile(file);
FucTestFile fucTestFile = new FucTestFile();
fucTestFile.setTestId(request.getId());
fucTestFile.setFileId(fileMetadata.getId());
fucTestFileMapper.insert(fucTestFile);
ApiTestFile ApiTestFile = new ApiTestFile();
ApiTestFile.setTestId(request.getId());
ApiTestFile.setFileId(fileMetadata.getId());
ApiTestFileMapper.insert(ApiTestFile);
}
final FucTestWithBLOBs fucTest = fucTestMapper.selectByPrimaryKey(request.getId());
if (fucTest == null) {
final ApiTestWithBLOBs ApiTest = ApiTestMapper.selectByPrimaryKey(request.getId());
if (ApiTest == null) {
MSException.throwException("无法编辑测试,未找到测试:" + request.getId());
} else {
fucTest.setName(request.getName());
fucTest.setProjectId(request.getProjectId());
fucTest.setUpdateTime(System.currentTimeMillis());
fucTest.setDescription("todo");
fucTest.setRuntimeConfiguration(request.getRuntimeConfiguration());
fucTestMapper.updateByPrimaryKeySelective(fucTest);
ApiTest.setName(request.getName());
ApiTest.setProjectId(request.getProjectId());
ApiTest.setUpdateTime(System.currentTimeMillis());
ApiTest.setDescription("todo");
ApiTest.setRuntimeConfiguration(request.getRuntimeConfiguration());
ApiTestMapper.updateByPrimaryKeySelective(ApiTest);
}
return request.getId();
}
public void run(RunTestPlanRequest request) {
final FucTestWithBLOBs fucTest = fucTestMapper.selectByPrimaryKey(request.getId());
// if (fucTest == null) {
final ApiTestWithBLOBs ApiTest = ApiTestMapper.selectByPrimaryKey(request.getId());
// if (ApiTest == null) {
// MSException.throwException("无法运行测试,未找到测试:" + request.getId());
// }
//
@ -147,7 +147,7 @@ public class FuctionalTestService {
// MSException.throwException("无法运行测试无法获取测试文件内容测试ID" + request.getId());
// }
//
// System.out.println("开始运行:" + fucTest.getName());
// System.out.println("开始运行:" + ApiTest.getName());
// final Engine engine = EngineFactory.createEngine(fileMetadata.getType());
// if (engine == null) {
// MSException.throwException(String.format("无法运行测试未识别测试文件类型测试ID%s文件类型%s",
@ -157,7 +157,7 @@ public class FuctionalTestService {
//
// boolean init = true;
// try {
//// init = engine.init(EngineFactory.createContext(fucTest, fileMetadata, fileContent));
//// init = engine.init(EngineFactory.createContext(ApiTest, fileMetadata, fileContent));
// } catch (Exception e) {
// MSException.throwException(e);
// }
@ -170,16 +170,16 @@ public class FuctionalTestService {
/// todo通过调用stop方法能够停止正在运行的engine但是如果部署了多个backend实例页面发送的停止请求如何定位到具体的engine
}
public List<FunctionalTestDTO> recentTestPlans(QueryTestPlanRequest request) {
public List<ApiTestDTO> recentTestPlans(QueryTestPlanRequest request) {
// 查询最近的测试计划
request.setRecent(true);
return extFucTestMapper.list(request);
return extApiTestMapper.list(request);
}
public FunctionalTestDTO get(String testId) {
public ApiTestDTO get(String testId) {
QueryTestPlanRequest request = new QueryTestPlanRequest();
request.setId(testId);
List<FunctionalTestDTO> testDTOS = extFucTestMapper.list(request);
List<ApiTestDTO> testDTOS = extApiTestMapper.list(request);
if (!CollectionUtils.isEmpty(testDTOS)) {
return testDTOS.get(0);
}
@ -187,8 +187,8 @@ public class FuctionalTestService {
}
public String getRuntimeConfiguration(String testId) {
FucTestWithBLOBs fucTestWithBLOBs = fucTestMapper.selectByPrimaryKey(testId);
return Optional.ofNullable(fucTestWithBLOBs).orElse(new FucTestWithBLOBs()).getRuntimeConfiguration();
ApiTestWithBLOBs ApiTestWithBLOBs = ApiTestMapper.selectByPrimaryKey(testId);
return Optional.ofNullable(ApiTestWithBLOBs).orElse(new ApiTestWithBLOBs()).getRuntimeConfiguration();
}
}

View File

@ -3,7 +3,7 @@ package io.metersphere.service;
import io.metersphere.base.domain.*;
import io.metersphere.base.mapper.FileContentMapper;
import io.metersphere.base.mapper.FileMetadataMapper;
import io.metersphere.base.mapper.FucTestFileMapper;
import io.metersphere.base.mapper.ApiTestFileMapper;
import io.metersphere.base.mapper.LoadTestFileMapper;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
@ -19,7 +19,7 @@ public class FileService {
@Resource
private LoadTestFileMapper loadTestFileMapper;
@Resource
private FucTestFileMapper fucTestFileMapper;
private ApiTestFileMapper ApiTestFileMapper;
@Resource
private FileContentMapper fileContentMapper;
@ -43,10 +43,10 @@ public class FileService {
return fileMetadataMapper.selectByExample(example);
}
public FileMetadata getFucFileMetadataByTestId(String testId) {
FucTestFileExample fucTestFileExample = new FucTestFileExample();
fucTestFileExample.createCriteria().andTestIdEqualTo(testId);
final List<FucTestFile> loadTestFiles = fucTestFileMapper.selectByExample(fucTestFileExample);
public FileMetadata getApiFileMetadataByTestId(String testId) {
ApiTestFileExample ApiTestFileExample = new ApiTestFileExample();
ApiTestFileExample.createCriteria().andTestIdEqualTo(testId);
final List<ApiTestFile> loadTestFiles = ApiTestFileMapper.selectByExample(ApiTestFileExample);
if (CollectionUtils.isEmpty(loadTestFiles)) {
return null;

View File

@ -1,45 +0,0 @@
package io.metersphere.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.metersphere.base.domain.FucTestLog;
import io.metersphere.base.domain.FucTestReport;
import io.metersphere.base.domain.FucTestReportExample;
import io.metersphere.base.mapper.FucTestReportMapper;
import io.metersphere.base.mapper.ext.ExtFunctionalTestReportMapper;
import io.metersphere.controller.request.ReportRequest;
import io.metersphere.dto.FunctionalReportDTO;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
@Service
@Transactional(rollbackFor = Exception.class)
public class FunctionalReportService {
@Resource
private FucTestReportMapper fucTestReportMapper;
@Resource
private ExtFunctionalTestReportMapper extFunctionalTestReportMapper;
public List<FucTestReport> getRecentReportList(ReportRequest request) {
FucTestReportExample example = new FucTestReportExample();
example.setOrderByClause("update_time desc");
return fucTestReportMapper.selectByExample(example);
}
public List<FunctionalReportDTO> getReportList(ReportRequest request) {
return extFunctionalTestReportMapper.getReportList(request);
}
public void deleteReport(String reportId) {
fucTestReportMapper.deleteByPrimaryKey(reportId);
}
public FunctionalReportDTO getReportTestAndProInfo(String reportId) {
return extFunctionalTestReportMapper.getReportTestAndProInfo(reportId);
}
}

View File

@ -182,9 +182,9 @@ CREATE TABLE IF NOT EXISTS `workspace` (
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_bin;
-- funcional start
-- api start
CREATE TABLE IF NOT EXISTS `fuc_test` (
CREATE TABLE IF NOT EXISTS `api_test` (
`id` varchar(50) NOT NULL COMMENT 'Test ID',
`project_id` varchar(50) NOT NULL COMMENT 'Project ID this test belongs to',
`name` varchar(64) NOT NULL COMMENT 'Test name',
@ -199,15 +199,15 @@ CREATE TABLE IF NOT EXISTS `fuc_test` (
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_bin;
CREATE TABLE IF NOT EXISTS `fuc_test_file` (
CREATE TABLE IF NOT EXISTS `api_test_file` (
`test_id` varchar(64) DEFAULT NULL,
`file_id` varchar(64) DEFAULT NULL,
UNIQUE KEY `load_test_file_unique_key` (`test_id`, `file_id`)
UNIQUE KEY `api_test_file_unique_key` (`test_id`, `file_id`)
)
ENGINE = InnoDB
DEFAULT CHARSET = utf8mb4 COMMENT ='功能测试和文件的关联表';
DEFAULT CHARSET = utf8mb4 COMMENT ='Api test test file relevance table';
CREATE TABLE IF NOT EXISTS `fuc_test_report` (
CREATE TABLE IF NOT EXISTS `api_test_report` (
`id` varchar(50) NOT NULL COMMENT 'Test report ID',
`test_id` varchar(50) NOT NULL COMMENT 'Test ID this test report belongs to',
`name` varchar(64) NOT NULL COMMENT 'Test report name',
@ -222,7 +222,7 @@ CREATE TABLE IF NOT EXISTS `fuc_test_report` (
DEFAULT CHARSET = utf8mb4
COLLATE = utf8mb4_bin;
-- funcional end
-- api end
-- track start

View File

@ -46,10 +46,12 @@
<!--要生成的数据库表 -->
<!--<table tableName="test_plan"/>-->
<table tableName="test_case_node">
<generatedKey column="id" sqlStatement="MySql" identity="true"/>
</table>
<table tableName="api_test"/>
<table tableName="api_test_file"/>
<table tableName="api_test_report"/>
<!--<table tableName="test_case_node">-->
<!--<generatedKey column="id" sqlStatement="MySql" identity="true"/>-->
<!--</table>-->
<!--<table tableName="test_case"/>-->
<!--<table tableName="test_plan_test_case"/>-->

View File

@ -15,11 +15,11 @@
import HeaderMenus from "../common/head/HeaderMenus";
export default {
name: "FunctionalTest",
name: "ApiTest",
components: {HeaderMenus},
data() {
return {
beaseUrl: "functional"
beaseUrl: "api"
}
}
}

View File

@ -1,13 +1,13 @@
<template>
<div>
<h1>功能测试首页</h1>
<h1>API测试首页</h1>
</div>
</template>
<script>
export default {
name: "PerformanceTestHome"
name: "ApiTestHome"
}
</script>

View File

@ -6,7 +6,7 @@
</div>
<el-menu-item :key="p.id" v-for="p in recentProjects"
:index="'/functional/' + p.id" :route="{name:'fucPlan', params:{projectId:p.id, projectName:p.name}}">
:index="'/api/' + p.id" :route="{name:'fucPlan', params:{projectId:p.id, projectName:p.name}}">
{{ p.name }}
</el-menu-item>
</el-menu>
@ -18,7 +18,7 @@
import {hasRoles} from "../../../../common/utils";
export default {
name: "FunctionalRecentProject",
name: "ApiRecentProject",
mounted() {
if (hasRoles(ROLE_TEST_VIEWER, ROLE_TEST_USER, ROLE_TEST_MANAGER)) {

View File

@ -5,7 +5,7 @@
{{$t('load_test.recent')}}
</div>
<el-menu-item :key="p.id" v-for="p in recentReports"
:index="'/functional/report/view/' + p.id" :route="{path: '/functional/report/view/' + p.id}">
:index="'/api/report/view/' + p.id" :route="{path: '/api/report/view/' + p.id}">
{{ p.name }}
</el-menu-item>
</el-menu>
@ -15,13 +15,13 @@
import {ROLE_TEST_MANAGER, ROLE_TEST_USER, ROLE_TEST_VIEWER} from "../../../../common/constants";
export default {
name: "FunctionalRecentReport",
name: "ApiRecentReport",
mounted() {
const rolesString = localStorage.getItem("roles");
const roles = rolesString.split(',');
if (roles.indexOf(ROLE_TEST_MANAGER) > -1 || roles.indexOf(ROLE_TEST_USER) > -1 || roles.indexOf(ROLE_TEST_VIEWER) > -1) {
this.$get('/functional/report/recent/5', (response) => {
this.$get('/api/report/recent/5', (response) => {
this.recentReports = response.data;
});
}

View File

@ -52,7 +52,7 @@
import ResultDetails from './components/ResultDetails';
export default {
name: "FunctionalReportView",
name: "ApiReportView",
components: {
MsReportLogDetails,
ResultDetails
@ -68,7 +68,7 @@
methods: {
initBreadcrumb() {
if(this.reportId){
this.result = this.$get("/functional/report/test/pro/info/" + this.reportId, res => {
this.result = this.$get("/api/report/test/pro/info/" + this.reportId, res => {
let data = res.data;
if(data){
this.report = data;

View File

@ -81,15 +81,15 @@
<script>
export default {
name: "FunctionalTestReport",
name: "ApiTestReport",
created: function () {
this.initTableData();
},
data() {
return {
result: {},
queryPath: "/functional/report/list/all",
deletePath: "/functional/report/delete/",
queryPath: "/api/report/list/all",
deletePath: "/api/report/delete/",
condition: "",
projectId: null,
tableData: [],
@ -131,7 +131,7 @@
},
handleEdit(report) {
this.$router.push({
path: '/functional/report/view/' + report.id
path: '/api/report/view/' + report.id
})
},
handleDelete(report) {

View File

@ -4,7 +4,7 @@
<i class="el-icon-time"/>
{{$t('load_test.recent')}}
</div>
<el-menu-item :key="t.id" v-for="t in recentTestPlans" :index="'/functional/test/edit/' + t.id">
<el-menu-item :key="t.id" v-for="t in recentTestPlans" :index="'/api/edit/' + t.id">
{{ t.name }}
</el-menu-item>
</el-menu>
@ -15,11 +15,11 @@
import {hasRoles} from "../../../../common/utils";
export default {
name: "PerformanceRecentTestPlan",
name: "ApiRecentTestPlan",
mounted() {
if (hasRoles(ROLE_TEST_VIEWER, ROLE_TEST_USER, ROLE_TEST_MANAGER)) {
this.$get('/performance/recent/5', (response) => {
this.$get('/api/recent/5', (response) => {
this.recentTestPlans = response.data;
});
}

View File

@ -83,8 +83,8 @@
data() {
return {
result: {},
queryPath: "/functional/test/list",
deletePath: "/functional/test/delete",
queryPath: "/api/list",
deletePath: "/api/delete",
condition: "",
projectId: null,
tableData: [],
@ -141,7 +141,7 @@
},
handleEdit(testPlan) {
this.$router.push({
path: '/functional/test/edit/' + testPlan.id,
path: '/api/edit/' + testPlan.id,
})
},
handleDelete(testPlan) {

View File

@ -24,10 +24,10 @@
<el-tabs class="testplan-config" v-model="active" type="border-card" :stretch="true">
<el-tab-pane :label="$t('load_test.basic_config')">
<functional-test-scene-config :test-plan="testPlan" />
<api-test-scene-config :test-plan="testPlan" />
</el-tab-pane>
<el-tab-pane :label="$t('load_test.runtime_config')">
<functional-test-runtime-config :test-plan="testPlan" ref="runtimeConfig"/>
<api-test-runtime-config :test-plan="testPlan" ref="runtimeConfig"/>
</el-tab-pane>
</el-tabs>
</el-card>
@ -36,33 +36,33 @@
</template>
<script>
import FunctionalTestSceneConfig from './components/FunctionalTestSceneConfig';
import FunctionalTestRuntimeConfig from './components/FunctionalTestRuntimeConfig';
import ApiTestSceneConfig from './components/ApiTestSceneConfig';
import ApiTestRuntimeConfig from './components/ApiTestRuntimeConfig';
export default {
name: "EditFunctionalTestPlan",
name: "EditApiTestPlan",
components: {
FunctionalTestSceneConfig,
FunctionalTestRuntimeConfig,
ApiTestSceneConfig,
ApiTestRuntimeConfig,
},
data() {
return {
result: {},
testPlan: {},
listProjectPath: "/project/listAll",
savePath: "/functional/test/save",
editPath: "/functional/test/edit",
runPath: "/functional/test/run",
savePath: "/api/save",
editPath: "/api/edit",
runPath: "/api/run",
projects: [],
active: '0',
tabs: [{
title: this.$t('load_test.basic_config'),
id: '0',
component: 'FunctionalTestSceneConfig'
component: 'ApiTestSceneConfig'
}, {
title: this.$t('load_test.runtime_config'),
id: '1',
component: 'FunctionalTestRuntimeConfig'
component: 'ApiTestRuntimeConfig'
}]
}
},
@ -75,7 +75,7 @@
}
let testId = to.path.split('/')[4]; // find testId
if (testId) {
this.$get('/functional/test/get/' + testId, response => {
this.$get('/api/get/' + testId, response => {
this.testPlan = response.data;
});
}
@ -85,7 +85,7 @@
created() {
let testId = this.$route.path.split('/')[4];
if (testId) {
this.$get('/functional/test/get/' + testId, response => {
this.$get('/api/get/' + testId, response => {
this.testPlan = response.data;
});
}
@ -111,7 +111,7 @@
type: 'success'
});
this.$refs.runtimeConfig.cancelAllEdit();
this.$router.push({path: '/functional/test/all'})
this.$router.push({path: '/api/test/all'})
});
},
saveAndRun() {
@ -165,7 +165,7 @@
};
},
cancel() {
this.$router.push({path: '/functional/test/all'})
this.$router.push({path: '/api/test/all'})
},
validTestPlan() {
if (!this.testPlan.name) {

View File

@ -42,7 +42,7 @@
<script>
export default {
name: "FunctionalTestRuntimeConfig",
name: "ApiTestRuntimeConfig",
data() {
return {
resourcePool: {
@ -86,7 +86,7 @@
methods: {
validConfig() {
if (this.resourcePool.value == '') {
this.$message.error(this.$t('fuc_test.select_resource_pool'));
this.$message.error(this.$t('api_test.select_resource_pool'));
return false;
}
return true;

View File

@ -58,14 +58,14 @@
import {Message} from "element-ui";
export default {
name: "FunctionalTestSceneConfig",
name: "ApiTestSceneConfig",
props: ["testPlan"],
data() {
return {
result: {},
getFileMetadataPath: "/functional/test/file/metadata",
jmxDownloadPath: '/functional/test/file/download',
jmxDeletePath: '/functional/test/file/delete',
getFileMetadataPath: "/api/file/metadata",
jmxDownloadPath: '/api/file/download',
jmxDeletePath: '/api/file/delete',
fileList: [],
tableData: [],
};

View File

@ -11,7 +11,7 @@
index="3" popper-class="submenu" v-permission="['test_manager']" >
<template v-slot:title>{{$t('commons.project')}}</template>
<performance-recent-project v-if="beaseUrl == 'performance'"/>
<functional-recent-project v-if="beaseUrl == 'functional'"/>
<api-recent-project v-if="beaseUrl == 'api'"/>
<track-recent-project v-if="beaseUrl == 'tack'"/>
<el-divider/>
<el-menu-item :index="'/' + beaseUrl + '/project/all'">
@ -23,11 +23,11 @@
</el-menu-item>
</el-submenu>
<el-submenu v-if="isCurrentWorkspaceUser && (beaseUrl == 'performance' || beaseUrl == 'functional')"
<el-submenu v-if="isCurrentWorkspaceUser && (beaseUrl == 'performance' || beaseUrl == 'api')"
index="4" popper-class="submenu" v-permission="['test_manager', 'test_user']">
<template v-slot:title>{{$t('commons.test')}}</template>
<performance-recent-test-plan v-if="beaseUrl == 'performance'"/>
<functional-recent-test-plan v-if="beaseUrl == 'functional'"/>
<api-recent-test-plan v-if="beaseUrl == 'api'"/>
<el-divider/>
<el-menu-item :index="'/' + beaseUrl + '/test/all'">
<font-awesome-icon :icon="['fa', 'list-ul']"/>
@ -38,11 +38,11 @@
</el-menu-item>
</el-submenu>
<el-submenu v-if="isCurrentWorkspaceUser && (beaseUrl == 'performance' || beaseUrl == 'functional')"
<el-submenu v-if="isCurrentWorkspaceUser && (beaseUrl == 'performance' || beaseUrl == 'api')"
index="5" popper-class="submenu" v-permission="['test_manager', 'test_user', 'test_viewer']">
<template v-slot:title>{{$t('commons.report')}}</template>
<performance-recent-report v-if="beaseUrl == 'performance'"/>
<functional-recent-report v-if="beaseUrl == 'functional'"/>
<api-recent-report v-if="beaseUrl == 'api'"/>
<el-divider/>
<el-menu-item :index="'/' + beaseUrl + '/report/all'">
<font-awesome-icon :icon="['fa', 'list-ul']"/>
@ -77,7 +77,7 @@
</el-menu-item>
</el-submenu>
<router-link v-if="isCurrentWorkspaceUser && (beaseUrl == 'performance' || beaseUrl == 'functional')"
<router-link v-if="isCurrentWorkspaceUser && (beaseUrl == 'performance' || beaseUrl == 'api')"
class="header-bottom" :to="'/' + beaseUrl + '/test/create'" v-permission="['test_user','test_manager']">
<el-button type="primary" size="small">{{$t('load_test.create')}}</el-button>
</router-link>
@ -90,19 +90,19 @@
<script>
import PerformanceRecentTestPlan from "../../performance/test/PerformanceRecentTestPlan";
import FunctionalRecentTestPlan from "../../functional/test/FunctionalRecentTestPlan";
import ApiRecentTestPlan from "../../api/test/ApiRecentTestPlan";
import PerformanceRecentProject from "../../performance/project/PerformanceRecentProject";
import FunctionalRecentProject from "../../functional/project/FunctionalRecentProject";
import ApiRecentProject from "../../api/project/ApiRecentProject";
import PerformanceRecentReport from "../../performance/report/PerformanceRecentReport";
import FunctionalRecentReport from "../../functional/report/FunctionalRecentReport";
import ApiRecentReport from "../../api/report/ApiRecentReport";
import {checkoutCurrentWorkspace} from "../../../../common/utils";
import TrackRecentProject from "../../track/project/TrackRecentProject";
import RecentCasePlan from "../../track/case/RecentCasePlan";
export default {
name: "MsMenus",
components: {PerformanceRecentReport, PerformanceRecentTestPlan, FunctionalRecentTestPlan, FunctionalRecentReport,
PerformanceRecentProject, FunctionalRecentProject, TrackRecentProject, RecentCasePlan},
components: {PerformanceRecentReport, PerformanceRecentTestPlan, ApiRecentTestPlan, ApiRecentReport,
PerformanceRecentProject, ApiRecentProject, TrackRecentProject, RecentCasePlan},
data() {
return {
isCurrentWorkspaceUser: false,

View File

@ -11,8 +11,8 @@
<el-menu-item index="/track" v-permission="['test_manager','test_user','test_viewer']">
{{$t('test_track.test_track')}}
</el-menu-item>
<el-menu-item index="/functional" v-permission="['test_manager','test_user','test_viewer']">
{{$t('commons.functional')}}
<el-menu-item index="/api" v-permission="['test_manager','test_user','test_viewer']">
{{$t('commons.api')}}
</el-menu-item>
<el-menu-item index="/performance" onselectstart="return false"
v-permission="['test_manager','test_user','test_viewer']">

View File

@ -15,15 +15,15 @@ import PersonSetting from "../../settings/personal/PersonSetting";
import SystemWorkspace from "../../settings/system/SystemWorkspace";
import PerformanceChart from "../../performance/report/components/PerformanceChart";
import PerformanceTestReport from "../../performance/report/PerformanceTestReport";
import FunctionalTestReport from "../../functional/report/FunctionalTestReport";
import FunctionalTest from "../../functional/FunctionalTest";
import ApiTestReport from "../../api/report/ApiTestReport";
import ApiTest from "../../api/ApiTest";
import PerformanceTest from "../../performance/PerformanceTest";
import EditFunctionalTestPlan from "../../functional/test/EditFunctionalTestPlan";
import EditApiTestPlan from "../../api/test/EditApiTestPlan";
import PerformanceTestHome from "../../performance/home/PerformanceTestHome";
import FunctionalTestPlan from "../../functional/test/FunctionalTestPlan";
import FunctionalTestHome from "../../functional/home/FunctionalTestHome";
import ApiTestPlan from "../../api/test/ApiTestPlan";
import ApiTestHome from "../../api/home/ApiTestHome";
import PerformanceReportView from "../../performance/report/PerformanceReportView";
import FunctionalReportView from "../../functional/report/FunctionalReportView";
import ApiReportView from "../../api/report/ApiReportView";
import TrackHome from "../../track/home/TrackHome";
import TestPlan from "../../track/plan/TestPlan";
import TestPlanView from "../../track/plan/TestPlanView";
@ -82,27 +82,27 @@ const router = new VueRouter({
]
},
{
path: "/functional",
name: "functional",
redirect: "/functional/home",
path: "/api",
name: "api",
redirect: "/api/home",
components: {
content: FunctionalTest
content: ApiTest
},
children: [
{
path: 'home',
name: 'fucHome',
component: FunctionalTestHome,
component: ApiTestHome,
},
{
path: 'test/create',
name: "createFucTest",
component: EditFunctionalTestPlan,
component: EditApiTestPlan,
},
{
path: "test/edit/:testId",
name: "editFucTest",
component: EditFunctionalTestPlan,
component: EditApiTestPlan,
props: {
content: (route) => {
return {
@ -114,7 +114,7 @@ const router = new VueRouter({
{
path: "test/:projectId",
name: "fucPlan",
component: FunctionalTestPlan
component: ApiTestPlan
},
{
path: "project/:type",
@ -124,12 +124,12 @@ const router = new VueRouter({
{
path: "report/:type",
name: "fucReport",
component: FunctionalTestReport
component: ApiTestReport
},
{
path: "report/view/:reportId",
name: "fucReportView",
component: FunctionalReportView
component: ApiReportView
}
]
},

View File

@ -38,7 +38,7 @@ export default {
'personal_setting': 'Personal Setting',
'test_resource_pool': 'Resource Pool',
'system_setting': 'Settings',
'functional': 'Functional',
'api': 'Api',
'performance': 'Performance',
'interface': 'Interface test',
'input_content': 'Please enter content',
@ -167,7 +167,7 @@ export default {
'select_resource_pool': 'Please Select Resource Pool',
'resource_pool_is_null': 'Resource Pool is empty',
},
fuc_test: {
api_test: {
'select_resource_pool': 'Please select resource pool'
},
test_track: {

View File

@ -38,7 +38,7 @@ export default {
'personal_setting': '个人设置',
'test_resource_pool': '测试资源池',
'system_setting': '系统设置',
'functional': '功能测试',
'api': '接口测试',
'performance': '性能测试',
'interface': '接口测试',
'input_content': '请输入内容',
@ -167,7 +167,7 @@ export default {
'select_resource_pool': '请选择资源池',
'resource_pool_is_null': '资源池为空',
},
fuc_test: {
api_test: {
'select_resource_pool': '请选择资源池'
},
test_track: {