什么是 expectation
expectation 是 LiveMock 的核心构件。它表达的是:当请求长这样时,就这样回应它。
一条 expectation 由以下部分组成:
- 一组 matcher —— 每个 matcher 检查请求的某一部分(method、path、header、query 参数、请求体参数)。只有全部 matcher 都通过时,expectation 才算命中;没有任何 matcher 的 expectation 会匹配所有请求;
- 一个 action —— 回应什么:自定义响应(custom response)、proxy 到另一台主机,或从磁盘提供的目录;
- 时序与状态 —— 延迟(delay)、优先级(priority)、启用标志以及可选的分组(group)。

创建 expectation
点击 Expectation 页面左侧面板中的 Add Expectation。输入名称、可选的描述和一个分组(默认为 ungrouped)。
