feat: 场景内cookie共享
This commit is contained in:
parent
a9d6c98c09
commit
76ae0969c4
|
@ -10,6 +10,7 @@ public class Scenario {
|
|||
private String name;
|
||||
private String url;
|
||||
private String environmentId;
|
||||
private Boolean enableCookieShare;
|
||||
private List<KeyValue> variables;
|
||||
private List<KeyValue> headers;
|
||||
private List<Request> requests;
|
||||
|
|
|
@ -21,6 +21,9 @@
|
|||
</div>
|
||||
</template>
|
||||
</el-select>
|
||||
<el-form-item class="cookie-item">
|
||||
<el-checkbox v-model="scenario.enableCookieShare">{{'共享 Cookie'}}</el-checkbox>
|
||||
</el-form-item>
|
||||
</el-form-item>
|
||||
|
||||
<el-tabs v-model="activeName">
|
||||
|
@ -168,4 +171,8 @@
|
|||
font-weight: 600;
|
||||
}
|
||||
|
||||
.cookie-item {
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -328,6 +328,15 @@ export class HTTPSamplerArguments extends Element {
|
|||
}
|
||||
}
|
||||
|
||||
export class CookieManager extends DefaultTestElement {
|
||||
constructor(testName) {
|
||||
super('CookieManager', 'CookiePanel', 'CookieManager', testName);
|
||||
this.collectionProp('CookieManager.cookies');
|
||||
this.boolProp('CookieManager.clearEachIteration', false, false);
|
||||
this.boolProp('CookieManager.controlledByThreadGroup', false, false);
|
||||
}
|
||||
}
|
||||
|
||||
export class DurationAssertion extends DefaultTestElement {
|
||||
constructor(testName, duration) {
|
||||
super('DurationAssertion', 'DurationAssertionGui', 'DurationAssertion', testName);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import {
|
||||
Arguments,
|
||||
Arguments, CookieManager,
|
||||
DubboSample,
|
||||
DurationAssertion,
|
||||
Element,
|
||||
|
@ -174,6 +174,7 @@ export class Scenario extends BaseConfig {
|
|||
this.environmentId = undefined;
|
||||
this.dubboConfig = undefined;
|
||||
this.environment = undefined;
|
||||
this.enableCookieShare = false;
|
||||
|
||||
this.set(options);
|
||||
this.sets({variables: KeyValue, headers: KeyValue, requests: RequestFactory}, options);
|
||||
|
@ -765,6 +766,8 @@ class JMXGenerator {
|
|||
|
||||
this.addScenarioHeaders(threadGroup, scenario);
|
||||
|
||||
this.addScenarioCookieManager(threadGroup, scenario);
|
||||
|
||||
scenario.requests.forEach(request => {
|
||||
if (!request.isValid()) return;
|
||||
let sampler;
|
||||
|
@ -822,6 +825,12 @@ class JMXGenerator {
|
|||
}
|
||||
}
|
||||
|
||||
addScenarioCookieManager(threadGroup, scenario) {
|
||||
if (scenario.enableCookieShare) {
|
||||
threadGroup.put(new CookieManager(scenario.name));
|
||||
}
|
||||
}
|
||||
|
||||
addScenarioHeaders(threadGroup, scenario) {
|
||||
let environment = scenario.environment;
|
||||
if (environment) {
|
||||
|
|
Loading…
Reference in New Issue