refactor(项目设置): 公共脚本执行接口参数优化

This commit is contained in:
AgAngle 2024-01-24 16:11:35 +08:00 committed by jianxing
parent 57f3493219
commit 4439aa2cd7
3 changed files with 8 additions and 1 deletions

View File

@ -196,7 +196,7 @@ public class ApiExecuteService {
* @return
*/
public String runScript(CustomFunctionRunRequest runRequest) {
String reportId = IDGenerator.nextStr();
String reportId = runRequest.getReportId();
String testId = runRequest.getProjectId();
// 生成执行脚本
MsCommentScriptElement msCommentScriptElement = BeanUtils.copyBean(new MsCommentScriptElement(), runRequest);

View File

@ -6,6 +6,7 @@ import io.metersphere.project.dto.customfunction.request.CustomFunctionRunReques
import io.metersphere.project.dto.environment.KeyValueParam;
import io.metersphere.sdk.constants.PermissionConstants;
import io.metersphere.system.base.BaseTest;
import io.metersphere.system.uid.IDGenerator;
import jakarta.annotation.Resource;
import org.junit.jupiter.api.MethodOrderer;
import org.junit.jupiter.api.Test;
@ -55,6 +56,7 @@ public class ApiTestControllerTests extends BaseTest {
baseResourcePoolTestService.initProjectResourcePool();
CustomFunctionRunRequest request = new CustomFunctionRunRequest();
request.setReportId(IDGenerator.nextStr());
request.setProjectId(DEFAULT_PROJECT_ID);
request.setType(ScriptLanguageType.BEANSHELL.getValue());
request.setScript("""

View File

@ -20,6 +20,11 @@ public class CustomFunctionRunRequest implements Serializable {
@Size(max = 50)
private String type;
@Schema(description = "报告ID")
@NotBlank
@Size(max = 50)
private String reportId;
@Schema(description = "参数列表")
private List<KeyValueParam> params;