Towards reusable thread-group code #121
AntonioSun
started this conversation in
Ideas
Replies: 1 comment 4 replies
-
Hi, it seems valid request. So as understand you what you would like to have is something like: // test.groovy
start {
// simple case
insert 'fragments/group.groovy', properties: [ users: 1, rampUp: 10]
// load test
insert 'fragments/group.groovy', properties: [users: 1000, rampUp: 300]
}
// fragments/group.groovy
fragment {
group users: users, rampUp: rampUp, {
cookies()
simple {
http 'GET sample.com'
}
}
}
This should be quite doable but you can try to do it in some other way e.g. // test.groovy
@GrabConfig(systemClassLoader=true)
@Grab('net.simonix.scripts:groovy-jmeter')
@groovy.transform.BaseScript net.simonix.dsl.jmeter.TestScript script
start {
plan 'Test plan', {
group users: 1, rampUp: 10, {
insert 'fragments/group.groovy'
}
group users: 1000, rampUp: 300, {
insert 'fragments/group.groovy'
}
}
}
// fragments/group.groovy
fragment {
cookies()
simple {
http 'GET sample.com'
}
} Hope it helps |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I know the DSL groovy-jmeter provides currently is focus on wrapping over JMeter ones, but am hoping it can go one level up to achieve the following --
In our testing, we have standalone tests that focus on one specific area, and mixed load test that put them all together. The current situation is, both in groovy-jmeter and JMeter, it's rather difficult to reuse the thread-group code for both cases, as the load design/requirement is very different. As the result, we have to break the following natually grouped code into two parts, the
group
line and its content:Such break-up doesn't feel natual. the
group
line and its content are seprated.If somehow we can design a DSL that allows the insert code file can have the
group
line within it, and pass every prameter thatgroup
can accept to it, it'll looks ideal, ..., but, having written it all out, I'm now wondering if it is worth the trouble 😊😊...Beta Was this translation helpful? Give feedback.
All reactions