chain and loop

2 422 zobrazení
Přeskočit na první nepřečtenou zprávu

Henri Gomez

nepřečteno,
5. 9. 2012 4:50:0305.09.12
komu: gat...@googlegroups.com
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 :)

Stéphane Landelle

nepřečteno,
5. 9. 2012 5:08:3805.09.12
komu: gat...@googlegroups.com
Tss tss, you'd better read the doc... 

328.png

Henri Gomez

nepřečteno,
5. 9. 2012 5:54:2005.09.12
komu: gat...@googlegroups.com
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 :)

Stéphane Landelle

nepřečteno,
5. 9. 2012 6:33:1805.09.12
komu: gat...@googlegroups.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).

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...@gmail.com>

Henri Gomez

nepřečteno,
5. 9. 2012 8:47:5705.09.12
komu: gat...@googlegroups.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

Stéphane Landelle

nepřečteno,
5. 9. 2012 10:45:4905.09.12
komu: gat...@googlegroups.com
Don't fear, you'll be fine ;)

2012/9/5 Henri Gomez <henri...@gmail.com>

Henri Gomez

nepřečteno,
6. 9. 2012 6:35:1806.09.12
komu: gat...@googlegroups.com
> Don't fear, you'll be fine ;)

Thanks

How could I apply loop to whole scenario ?

Stéphane Landelle

nepřečteno,
6. 9. 2012 6:54:2706.09.12
komu: gat...@googlegroups.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?

2012/9/6 Henri Gomez <henri...@gmail.com>

Henri Gomez

nepřečteno,
6. 9. 2012 11:26:0706.09.12
komu: gat...@googlegroups.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

Stéphane Landelle

nepřečteno,
6. 9. 2012 11:35:3806.09.12
komu: gat...@googlegroups.com
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...@gmail.com>

Henri Gomez

nepřečteno,
6. 9. 2012 12:14:4406.09.12
komu: gat...@googlegroups.com
Good

Thanks !

2012/9/6 Stéphane Landelle <slan...@excilys.com>:

Henri Gomez

nepřečteno,
6. 9. 2012 12:19:1706.09.12
komu: gat...@googlegroups.com
By curiosity, how will it turn in 1.3.0 ?

2012/9/6 Henri Gomez <henri...@gmail.com>:

Stéphane Landelle

nepřečteno,
6. 9. 2012 12:21:2206.09.12
komu: gat...@googlegroups.com
In about 2 weeks I hope.

2012/9/6 Henri Gomez <henri...@gmail.com>

Henri Gomez

nepřečteno,
6. 9. 2012 12:27:2106.09.12
komu: gat...@googlegroups.com
> In about 2 weeks I hope.

Good :-)

Question was, how did this code (loop for scenario) would be in 1.3.0 ;-)

Stéphane Landelle

nepřečteno,
6. 9. 2012 12:38:2906.09.12
komu: gat...@googlegroups.com
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...@gmail.com>

Ak Aurélien

nepřečteno,
19. 12. 2013 10:33:0219.12.13
komu: gat...@googlegroups.com
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

:( :(

Stéphane Landelle

nepřečteno,
19. 12. 2013 10:36:2319.12.13
komu: gat...@googlegroups.com
This thread is more than 1 year old, syntax has changed since.
use exec


2013/12/19 Ak Aurélien <a...@kempiak.fr>

--
You received this message because you are subscribed to the Google Groups "Gatling User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gatling+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Ak Aurélien

nepřečteno,
19. 12. 2013 11:05:1019.12.13
komu: gat...@googlegroups.com
My entire code is there :

        val scn = scenario("myscenar").exec(
                      repeat(15){chain.insertChain(home).insertChain(rollover)},processcmd
      )

Where am I wrong ?

Stéphane Landelle

nepřečteno,
19. 12. 2013 11:09:4019.12.13
komu: gat...@googlegroups.com
As I said: home.exec(rollover).exec(processcmd)


2013/12/19 Ak Aurélien <a...@kempiak.fr>

--

Ak Aurélien

nepřečteno,
19. 12. 2013 11:51:3319.12.13
komu: gat...@googlegroups.com
Ok, thank you for your help.


Le mercredi 5 septembre 2012 10:50:04 UTC+2, Henri Gomez a écrit :
Odpovědět všem
Odpověď autorovi
Přeposlat
0 nových zpráv