在jenkins构建中一定时间后停止JMeter脚本

时间:2019-06-04 05:50:23

标签: jenkins jmeter continuous-integration

虽然在jenkin中运行JMeterbuild,但即使在JMX中设置了配置,它也将以无限模式“永不停止”运行。 一段时间后如何停止JMeter构建?

我曾试图提供命令行参数,以为它对jmx配置没有好处。

PATH/jmeter -Jjmeter.save.saveservice.output_format=xml -Jduration=60 -n -t Main.jmx -l Mainreport.csv

预计JMeterbuild将在60秒后停止,但它永远不会停止,受到30分钟的监视。

1 个答案:

答案 0 :(得分:0)

您需要在JMeter Scheduler的工期字段中使用${__P(duration,30)} 来获得价值:

您可以在第二个参数中添加__P default value,例如,默认值为30

export class Permissions extends Component {
  constructor() {
    super();

    this.state = {
      schemas: [],
      checked: []
    };
  }
  componentDidMount() {
    this.selectedCheckboxes = new Set();
    PermissionsApi.getAllPermissionList()
      .then(
        result => {
          this.setState({ schemas: result });
        },
        error => {
          this.handleError(error);
        }
      )
      .catch(this.handleError);
  }

  //this will handle the check action to your checkboxes
  handleCheck(permission) {
    const { permissionId } = permission;

    //store your checked state in a temporary variable so we can mutate it
    const tempchecked = this.state.checked;

    //check if the object already exist in the checked array
    if (this.state.checked.find(item => item.permissionId === permissionId)) {
      //if already exist, it means the action is uncheck, thus remove
      tempchecked.splice(tempchecked.indexOf(permission), 1);
    } else {
      //if didnt exist, it means the action is check, thus add
      tempchecked.push(permission);
    }

    console.log(tempchecked);

    //set checked state
    this.setState({ checked: tempchecked });
  }

  render() {
    return (
      <div className="App">
        {this.state.schemas.map((permissions, permissionId) => {
          return (
            <div>
              <input
                type="checkbox"
                name="{permissions.permissionName}"
                value="{permissions.permissionId}"
                onChange={() => this.handleCheck(permissions)}
              />
              <label>{permissions.permissionName}</label>
            </div>
          );
        })}

        <br />
        <button>Convert Into JSON when this button is clicked.</button>
      </div>
    );
  }
}