Session and cookies issue testing a PHP website

HI all,

I’m pretty new using the great gatling tool (and also scala).

I need to test my php website but I noticed an issue which prevents me from leading my tests.

What I just do is recording a scenario with the DSL tool, and then, when I just play it, it seems that my $_SESSION variables are empty (I traced that in my php log file).

I’ve read on the documentation that cookies were supposed to be handled as a browser would do but in my case that seems not to work (and I can’t keep going with my scenario)

I actually don’t know where to start in order to fix this issue.

I started my scala project using this archetype http://repository.excilys.com/content/groups/public/archetype-catalog.xml

Maybe I should use an updated version of gatling ? Or is there something else I should check ?

Many Thanks in advance.

Regards

Hi,
Which version of Gatling do you use?

Regards
Nicolas

Hi, thanks for your help

I also need to add that I’m testing a secured website, but tried with http instead and still the same issue.

here is my pom.xml

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns=“http://maven.apache.org/POM/4.0.0” xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance

xsi:schemaLocation=“http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”>

4.0.0

test5

test5

0.0.1-SNAPSHOT

excilys

Excilys Repository

http://repository.excilys.com/content/groups/public

never

false

<maven.compiler.source>1.6</maven.compiler.source>

<maven.compiler.target>1.6</maven.compiler.target>

<scala.version>2.10.2</scala.version>

UTF-8

<gatling.version>2.0.0.20130628</gatling.version>

<gatling-highcharts.version>2.0.0.20130628</gatling-highcharts.version>

<scala-maven-plugin.version>3.1.5</scala-maven-plugin.version>

io.gatling

gatling-app

${gatling.version}

io.gatling

gatling-recorder

${gatling.version}

io.gatling.highcharts

gatling-charts-highcharts

${gatling-highcharts.version}

org.scala-lang

scala-library

${scala.version}

io.gatling.highcharts

gatling-charts-highcharts

io.gatling

gatling-app

io.gatling

gatling-recorder

org.scala-lang

scala-library

src/main/scala

src/test/scala

net.alchim31.maven

scala-maven-plugin

${scala-maven-plugin.version}

net.alchim31.maven

scala-maven-plugin

compile

testCompile

Forget about this ooooooold timestamp.
Please go with the snapshot, there were many cookie fixes since then.

set version to 2.0.0-SNAPSHOT and repository to https://oss.sonatype.org/content/repositories/snapshots

Thanks you again,

I apologize but I’m not sure to understand,

what I have just done is take modify my pom.xml like this :

test5

2.0.0-SNAPSHOT

excilys

Excilys Repository

https://oss.sonatype.org/content/repositories/snapshots

never

false

I guess I’m missing something…

You have to enable snapshots :slight_smile:

true

Yes, this is much better.

I’ll go on with my tests.

Thank you so much

Regards

Glad to hear.
Beware that syntax is slightly different from what you can find in the documentation.
Check upcoming doc here: https://github.com/excilys/gatling/tree/master/src/sphinx

Hello and thanks for you reply,

Actually, going further with my tests show me that I still have issues with session.

According to the console, I can see that session variables are used :

Session(Scenario Name,0,Map(gatling.http.cookies → CookieStore=Map(//mysite.fr → List(Cookie: domain=mysite.fr, name=myhomepage, value=97rvg3798mhqsm1b6efm9lfa10, path=/, maxAge=-1, secure=false))),1396974171535,32,List(),List(OK),List(),List())

But when I see my apache logs from the server, I have $_SESSION vars not set or empty.

This is so weird…

It must be something I omitted, but what ? I just don’t know unfortunately.

Session(Scenario Name,0,Map(gatling.http.cookies → **CookieStore=**Map(//mysite.fr → List(Cookie: domain=mysite.fr, name=myhomepage, value=97rvg3798mhqsm1b6efm9lfa10, path=/, maxAge=-1, secure=false))),1396974171535,32,List(),List(OK),List(),List())

I’m 100% sure that this log comes from the old 2.0.0.20130628 timestamp and not from the current snapshot.You must still be using the old jar somehow.

BTW, I’ll be removing those old timestamps from the excilys repository so people stop being confused.

Actually, I was quite surprised that only changing things in the xml file would allow me to use the newest version.

I check in my project properties/java build path/ libraries, and what I have as maven dependencies are :

gatling-charts-highcharts-2.0.0.20130628.jar
gatling-charts-2.0.0.20130628.jar

these must be the old snapshot you are talking about…

Well, should I simply delete theses two jars ?
(and the new version would download automatically ?)

thanks so much

I don’t understand what you’re doing exactly.

Do you use eclipse? Do you a simple maven project?

Please upload your project somewhere so I can try to fix it.

I’m sorry…

I do use eclipse.

I started a new project using the following archetype :

http://repository.excilys.com/content/groups/public/archetype-catalog.xml

Then I choose the artefact id : gatling-highcharts-maven-archetype version 2.0.0-m3a

But new step (enter the group id for the artefact), it only shows me version 0.0.1-SNAPSHOT with no more choice.

Is this the issue ?

I’m uploading my project somewhere

thanks

Here is the link where I uploaded the project :

https://drive.google.com/file/d/0BxH-DvupnQs2LXZkMnk2YVQtTG8/edit?usp=sharing

thanks

You didn’t change the gatling modules version in your pom.xml:

<gatling.version>2.0.0.20130628</gatling.version>
<gatling-highcharts.version>2.0.0.20130628</gatling-highcharts.version>

=>

<gatling.version>2.0.0-SNAPSHOT</gatling.version>
<gatling-highcharts.version>2.0.0-SNAPSHOT</gatling-highcharts.version>

Thanks,
I just made the change and now I have an exception thrown when I run as "scala application " the Engine.scala file :

Exception in thread “main” java.lang.NoSuchMethodError: io.gatling.app.Gatling$.fromMap(Lscala/collection/mutable/Map;)I

at Engine$delayedInit$body.apply(Engine.scala:12)

at scala.Function0$class.apply$mcV$sp(Function0.scala:40)

at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)

at scala.App$$anonfun$main$1.apply(App.scala:71)

at scala.App$$anonfun$main$1.apply(App.scala:71)

at scala.collection.immutable.List.foreach(List.scala:318)

at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)

at scala.App$class.main(App.scala:71)

at Engine$.main(Engine.scala:4)

at Engine.main(Engine.scala)

OK.
Your project was generated with the old archetype, and Engine has changed since.

Either regenerate it with snapshot archetype, or just replace Engine ant its friends with the up-to-date versions: https://github.com/excilys/gatling-highcharts-maven-archetype/tree/master/src/main/resources/archetype-resources/src/test/scala

Juste changing Engine.scala, IDEPathHelper.scala and Recorder.Scala content thrown this exception :

Exception in thread “main” java.lang.NoClassDefFoundError: io/gatling/http/request/builder/AbstractHttpRequestWithBodyAndParamsBuilder

at java.lang.Class.getDeclaredConstructors0(Native Method)

at java.lang.Class.privateGetDeclaredConstructors(Class.java:2483)

at java.lang.Class.getConstructor0(Class.java:2793)

at java.lang.Class.newInstance(Class.java:345)

at io.gatling.core.runner.Runner.run(Runner.scala:36)

at io.gatling.app.Gatling.start(Gatling.scala:231)

at io.gatling.app.Gatling$.fromMap(Gatling.scala:52)

at Engine$delayedInit$body.apply(Engine.scala:13)

at scala.Function0$class.apply$mcV$sp(Function0.scala:40)

at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)

at scala.App$$anonfun$main$1.apply(App.scala:71)

at scala.App$$anonfun$main$1.apply(App.scala:71)

at scala.collection.immutable.List.foreach(List.scala:318)

at scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:32)

at scala.App$class.main(App.scala:71)

at Engine$.main(Engine.scala:4)

at Engine.main(Engine.scala)

Caused by: java.lang.ClassNotFoundException: io.gatling.http.request.builder.AbstractHttpRequestWithBodyAndParamsBuilder

at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

at java.security.AccessController.doPrivileged(Native Method)

at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

at java.lang.ClassLoader.loadClass(ClassLoader.java:424)

at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

In eclipse, I added a repository in maven section with this url :

http://repository.excilys.com/content/groups/public/archetype-catalog.xml

Then I created a new project a project with this maven archetype.

I should start from scratch a new project with the right archetype, but i don’t know with archetype-catalogue to use (or there is something I don’t understand…sorry for that)

Thanks

Do a “clean” to force recompilation

Well,
I think it’s ok now,

I started a new project and modified the pom.xml file as you suggested.
Then, I modified the 3 scala files with what is in the github repository.

I ran a clean project but I had the following issue “there is no simulation…”
I right clicked on the eclipse project and chose maven/upgrade project.

Now things seem to be ok :slight_smile: , log traces are completely different from what I had and session variables are not empty.

Thank you so much Stéphane for you help and for your venue last day in Montpellier JUG (this is where you introduce us your great tool).

Thanks again

Regards :slight_smile: