“要包含的URL模式”在JMeter中不起作用

时间:2019-09-16 12:09:02

标签: jmeter performance-testing

试图捕获URL中仅包含特定网址(例如“ www.yahoo.com”)的请求,但JMeter捕获来自google,mozilla等的所有请求

尝试了patterm:

.*www.yahoo.com.*

但不起作用。

1 个答案:

答案 0 :(得分:0)

我无法使用最新的JMeter 5.1

重现所描述的行为

enter image description here

根据HTTP(S) Test Script Recorder documentation

  

要包含的样式与所采样的完整URL匹配的正则表达式。允许过滤记录的请求。 所有请求均通过,但是仅记录那些满足“包含/排除”字段要求的请求。如果将“包含”和“排除”都保留为空,则将记录所有内容(由于记录了图像,样式表等,因此每页都会记录数十个样本)。

这意味着您将在View Results Tree侦听器中看到所有请求,但是只有那些与您的正则表达式匹配的请求才会存储在Recording Controller

另外请注意,//A container should only contain the logic class EmployeesContainer extends React.Component { state = { employees: [{ name: '' }, { name: '' }, { name: '' }], }; //define what needs to happen if you click edit on an // employee onEdit = index => { //edit will be called with the index of the employee // the Employees component owns the list of employees // so it will have to make changes to it this.setState({ employees: this.state.employees.map((employee, i) => i === index ? { ...employee, edit: true } : employee ), }); }; //Same idea as onEdit, index needs to be passed to indicate // what employee needs to be changed onChange = (index, e) => { this.setState({ employees: this.state.employees.map((employee, i) => i === index ? { ...employee, name: e.target.value } : employee ), }); }; render() { return ( <Employees employees={this.state.employees} onEdit={this.onEdit} onChange={this.onChange} /> ); } } //The Employees presentational component, contains the jsx // you can make it a pure component by using React.memo const Employees = React.memo( ({ employees, onEdit, onChange }) => ( <div> {employees.map((employee, index) => ( <EmployeeContainer key={index} index={index} employee={employee} onEdit={onEdit} onChange={onChange} /> ))} </div> ) ); //Make this a container as well because it does more // than only produce jsx class EmployeeContainer extends React.Component { state = {}; //create onChange and onEdit only when index changes // this will prevent unnecessary renders static getDerivedStateFromProps(props, state) { const { index, onChange, onEdit } = props; if (state.index !== index) { return { index, onChange: e => onChange(index, e), onEdit: () => onEdit(index), }; } return null; } render() { const { employee } = this.props; const { onChange, onEdit } = this.state; return ( <Employee employee={employee} onChange={onChange} onEdit={onEdit} /> ); } } //presentational component, is also pure component const Employee = React.memo( ({ employee, onChange, onEdit }) => ( <div> {employee.edit ? ( <input type="text" value={employee.name} onChange={onChange} /> ) : ( <button onClick={onEdit}>edit</button> )} </div> ) ); www.yahoo.com是不同的服务器,您可能需要重新考虑测试方案。

查看JMeter Proxy Step by Step指南,了解有关在JMeter中进行录制的更多信息