For my tests I like to add a loop around all chain execs :
Recorder produce :
val chain_0 = chain
.exec(
http("request_1")
.get(extWebapp + "/libs-release/com/me/parent/parent/3/parent-3.pom")
.headers(headers_1)
)
.exec(
http("request_2")
.get(extWebapp + "/libs-release/com/me/parent/parent/3/parent-3.pom.sha1")
.headers(headers_1)
)
.pause(extPause, MILLISECONDS)
.exec(
http("request_3")
.get(extWebapp + "/libs-release/com/me/web/1.0.0-12/web-1.0.0-12.pom")
.headers(headers_1)
)
...
and then
val scn = scenario("me-mvn-clean")
.insertChain(chain_0)
.insertChain(chain_1)
What's the normal way to add loop around chains ?
Thanks.
PS: Still Scala noob on board
Excilys
September 5, 2012, 9:08am
2
I read this doc, just wonder how to add loop in scala in construct
val chain_0 = chain(...)
-->
val chain_0 = loop (chain(...)).times(20)
or
val scn = scenario("me-mvn-clean")
.insertChain(chain_0)
.insertChain(chain_1)
--->
val scn = scenario("me-mvn-clean")
.insertChain(loop(chain_0).times(20))
.insertChain(loop(chain_1).times(20))
Remember, Scala noob on board
Excilys
September 5, 2012, 10:33am
4
Actually, that’s not Scala, that’s our DSL (which is written in Scala, but here, you’re just doing method chaining like you would with a Java or Groovy DSL).
Our DSL has 2 entry points: scenario and chain, so you can’t call loop from scratch.
So you can write:
val chain_0 = chain.loop(anotherChain).times(20)
val scn = scenario(“me-mvn-clean”)
.loop(chain_0).times(20)
.loop(chain_1).times(20)
Hope it help.
2012/9/5 Henri Gomez <henri.gomez@gmail.com >
Actually, that's not Scala, that's our DSL (which is written in Scala, but
here, you're just doing method chaining like you would with a Java or Groovy
DSL).
Ok, it's still a bit unclear where end DSL and where start Scala.
Our DSL has 2 entry points: scenario and chain, so you can't call loop from
scratch.
So you can write:
val chain_0 = chain.loop(anotherChain).times(20)
val scn = scenario("me-mvn-clean")
.loop(chain_0).times(20)
.loop(chain_1).times(20)
Hope it help.
Perfect.
Thanks
Excilys
September 5, 2012, 2:45pm
6
Don’t fear, you’ll be fine
2012/9/5 Henri Gomez <henri.gomez@gmail.com >
Don't fear, you'll be fine
Thanks
How could I apply loop to whole scenario ?
Excilys
September 6, 2012, 10:54am
8
I’ve just deprecated some instructions in the DSL, so my response would depend on the version you use.
1.2.5 or 1.3.0-SNAPSHOT?
2012/9/6 Henri Gomez <henri.gomez@gmail.com >
I've just deprecated some instructions in the DSL, so my response would
depend on the version you use.
1.2.5 or 1.3.0-SNAPSHOT?
1.2.5, I'll wait 1.3.0 release to switch
Excilys
September 6, 2012, 3:35pm
10
OK, so in 1.2.5, you have insert a loop in your scenario and pass it a chain. Things will be more simple in 1.3.0.
So if you have:
val scn = scenario(“foo”)
.insertChain(chain1)
.insertChain(chain1)
you can write:
val scn = scenario(“foo”)
.loop(
chain
.insertChain(chain1)
.insertChain(chain1)
).times(100) // or during(10, TimeUnit.MINUTE) for example
2012/9/6 Henri Gomez <henri.gomez@gmail.com >
By curiosity, how will it turn in 1.3.0 ?
Excilys
September 6, 2012, 4:21pm
13
In about 2 weeks I hope.
2012/9/6 Henri Gomez <henri.gomez@gmail.com >
In about 2 weeks I hope.
Good
Question was, how did this code (loop for scenario) would be in 1.3.0
Excilys
September 6, 2012, 4:38pm
15
Current loop DSL will be here in 1.3.0, but issue deprecation warnings, and will be removed in 1.4.0.
The new way of writing loops will be:
val scn = scenario(“foo”)
.repeat(100) { // or during(10 minutes)
chain1
.insertChain(chain2)
}
I realize we might have a better name for “insertChain” like “chainWith”.
2012/9/6 Henri Gomez <henri.gomez@gmail.com >
Ak_Ak
December 19, 2013, 3:33pm
16
Hi,
I have a problem with this syntax, I wrote :
repeat(15){home.insertChain(rollover)},processcmd
/* home, rollover and processcmd are 3 chains */
And gatling says : value insertChain is not a member of io.gatling.core.structure.ChainBuilder
Excilys
December 19, 2013, 3:36pm
17
This thread is more than 1 year old, syntax has changed since.
use exec
Ak_Ak
December 19, 2013, 4:05pm
18
My entire code is there :
val scn = scenario(“myscenar”).exec(
repeat(15){chain.insertChain(home).insertChain(rollover)},processcmd
)
Where am I wrong ?
Excilys
December 19, 2013, 4:09pm
19
As I said: home.exec(rollover).exec(processcmd)
Ak_Ak
December 19, 2013, 4:51pm
20
Ok, thank you for your help.