fix(接口测试): 修复环境变量添加不上断言时间的问题
--bug=1020176 --user=宋天阳 【接口测试】项目环境-全局变量,添加响应时间断言添加不上 https://www.tapd.cn/55049933/s/1303290
This commit is contained in:
parent
dfee90ba49
commit
f58ef4e7d8
|
@ -2,12 +2,10 @@ package io.metersphere.service;
|
|||
|
||||
import io.metersphere.api.dto.automation.ApiTestReportVariable;
|
||||
import io.metersphere.api.exec.scenario.ApiEnvironmentRunningParamService;
|
||||
import io.metersphere.base.domain.ApiDefinitionExecResultExample;
|
||||
import io.metersphere.base.domain.ApiDefinitionExecResultWithBLOBs;
|
||||
import io.metersphere.base.domain.ApiScenarioReport;
|
||||
import io.metersphere.base.domain.ApiScenarioWithBLOBs;
|
||||
import io.metersphere.base.domain.*;
|
||||
import io.metersphere.base.mapper.ApiDefinitionExecResultMapper;
|
||||
import io.metersphere.base.mapper.ApiScenarioMapper;
|
||||
import io.metersphere.base.mapper.ApiTestCaseMapper;
|
||||
import io.metersphere.commons.constants.ApiRunMode;
|
||||
import io.metersphere.commons.constants.NoticeConstants;
|
||||
import io.metersphere.commons.constants.PropertyConstant;
|
||||
|
@ -56,6 +54,8 @@ public class TestResultService {
|
|||
private ApiScenarioExecutionInfoService scenarioExecutionInfoService;
|
||||
@Resource
|
||||
private ApiScenarioReportStructureService apiScenarioReportStructureService;
|
||||
@Resource
|
||||
private ApiTestCaseMapper apiTestCaseMapper;
|
||||
|
||||
// 场景
|
||||
private static final List<String> scenarioRunModes = new ArrayList<>() {{
|
||||
|
@ -202,6 +202,14 @@ public class TestResultService {
|
|||
ApiDefinitionExecResultExample example = new ApiDefinitionExecResultExample();
|
||||
example.createCriteria().andIdEqualTo(dto.getReportId()).andStatusEqualTo(ApiReportStatus.RUNNING.name());
|
||||
apiDefinitionExecResultMapper.updateByExampleSelective(record, example);
|
||||
|
||||
if (StringUtils.isNotEmpty(dto.getTestId())) {
|
||||
ApiTestCaseWithBLOBs apiTestCase = new ApiTestCaseWithBLOBs();
|
||||
apiTestCase.setLastResultId(dto.getReportId());
|
||||
apiTestCase.setId(dto.getTestId());
|
||||
apiTestCaseMapper.updateByPrimaryKeySelective(apiTestCase);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,21 +2,51 @@
|
|||
<div>
|
||||
<el-row :gutter="10" type="flex" justify="space-between" align="middle">
|
||||
<el-col>
|
||||
<el-input :disabled="isReadOnly" :value="value" v-bind="$attrs" step="100" size="small" type="number"
|
||||
@change="change" @input="input" :min="1"
|
||||
:placeholder="$t('api_test.request.assertions.response_in_time')"
|
||||
onKeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
|
||||
<el-input
|
||||
:disabled="isReadOnly"
|
||||
:value="value"
|
||||
v-bind="$attrs"
|
||||
step="100"
|
||||
size="small"
|
||||
type="number"
|
||||
@change="change"
|
||||
@input="input"
|
||||
:min="1"
|
||||
:placeholder="$t('api_test.request.assertions.response_in_time')"
|
||||
onKeypress="return (/[\d]/.test(String.fromCharCode(event.keyCode)))"
|
||||
/>
|
||||
</el-col>
|
||||
<el-col class="assertion-btn">
|
||||
<el-tooltip :content="$t('test_resource_pool.enable_disable')" placement="top" v-if="edit">
|
||||
<el-switch v-model="duration.enable" class="enable-switch" size="mini" :disabled="isReadOnly"
|
||||
style="width: 30px;margin-right: 10px"/>
|
||||
<el-tooltip
|
||||
:content="$t('test_resource_pool.enable_disable')"
|
||||
placement="top"
|
||||
v-if="edit"
|
||||
>
|
||||
<el-switch
|
||||
v-model="duration.enable"
|
||||
class="enable-switch"
|
||||
size="mini"
|
||||
:disabled="isReadOnly"
|
||||
style="width: 30px; margin-right: 10px"
|
||||
/>
|
||||
</el-tooltip>
|
||||
<el-button :disabled="isReadOnly" type="danger" size="mini" icon="el-icon-delete" circle @click="remove"
|
||||
v-if="edit"/>
|
||||
<el-button :disabled="isReadOnly" type="primary" size="mini" @click="add" v-else>
|
||||
{{ $t('api_test.request.assertions.add') }}
|
||||
<el-button
|
||||
:disabled="isReadOnly"
|
||||
type="danger"
|
||||
size="mini"
|
||||
icon="el-icon-delete"
|
||||
circle
|
||||
@click="remove"
|
||||
v-if="edit"
|
||||
/>
|
||||
<el-button
|
||||
:disabled="isReadOnly"
|
||||
type="primary"
|
||||
size="mini"
|
||||
@click="add"
|
||||
v-else
|
||||
>
|
||||
{{ $t("api_test.request.assertions.add") }}
|
||||
</el-button>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
@ -24,7 +54,6 @@
|
|||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
export default {
|
||||
name: "MsApiAssertionDuration",
|
||||
|
||||
|
@ -35,43 +64,41 @@ export default {
|
|||
callback: Function,
|
||||
isReadOnly: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
}
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
|
||||
methods: {
|
||||
add() {
|
||||
if (this.validate()) {
|
||||
this.duration.value = this.value;
|
||||
this.duration.enable = true;
|
||||
this.$set(this.duration, "value", this.value);
|
||||
this.$set(this.duration, "enable", true);
|
||||
this.callback();
|
||||
}
|
||||
},
|
||||
remove() {
|
||||
this.duration.value = undefined;
|
||||
|
||||
},
|
||||
change(value) {
|
||||
if (this.validate()) {
|
||||
this.$emit('change', value);
|
||||
this.$emit("change", value);
|
||||
}
|
||||
},
|
||||
input(value) {
|
||||
this.$emit('input', value);
|
||||
this.$emit("input", value);
|
||||
},
|
||||
validate() {
|
||||
if (this.value === '' || Number(this.value) <= 0) {
|
||||
this.$warning(this.$t('commons.response_time_warning'));
|
||||
if (this.value === "" || Number(this.value) <= 0) {
|
||||
this.$warning(this.$t("commons.response_time_warning"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
.assertion-btn {
|
||||
text-align: right;
|
||||
width: 180px;
|
||||
|
|
Loading…
Reference in New Issue