Gatling version: 3.11.2
Gatling flavor: scala
Gatling build tool: maven
I have written script to login ,get token and create page.
and Virtual users are 5.But only 1 page created .Also create page request count =5 But create page redirect has only 1 request generated. Could someone have any solution for this issue.
Hi @Poonam123,
Welcome aboard!
Can you provide some code?
We cannot tell you what is wrong without knowing what you tried.
One possible reason may be because each user try to create the same page, actually replacing the only referenced page.
Without code, we cannot know if the behavior is from your script or from your server.
Cheers!
Login
val password = "[redacted]"
private val csvFeeder = csv("testdata/confluence_csv_files/NavigatetoSpacePageDev.csv").queue
val loginConfluence = scenario(("LogintoConfluence"))
.feed(csvFeeder)
.exec(
http("/Login")
// .post("/confluence/login.action?auth_fallback")
.post("/confluence/dologin.action")
.formParam("os_username", "#{username}")
.formParam("os_password", password)
.formParam("os_cookie", "true")
//.formParam("login", "Log+in")
.formParam("os_destination", "")
// .check(status.is(200),bodyString.saveAs("loginresponse"))
)
.exec(http("GetToken")
.get("/confluence/pages/createpage.action")
.queryParam("spaceKey", "~svc.conflu.testuser1")
.queryParam("src", "quick-create")
// .header("Cookie", "JSESSIONID=F277301FA8B26788ACB467A3D1D7E8F2; seraph.confluence=415924234%3Afb29ce9d414235ee074fd42109d3220057198f8e")
// .header("Host", "confluence-dev.aexp.com")
// .header("Origin","https://qa-confluence.aexp.com")
.header("X-AUSERNAME", "svc.conflu.testuser1")
.header("X-Requested-With", "XMLHttpRequest")
.header("sec-ch-ua", "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"")
.check(bodyString.saveAs("BODY"))
.check(regex("""name="atlassian-token" content="(.+?)"""").exists.saveAs("atl_token"))
.check(regex("""name="draftId" value="(.+?)"""").exists.saveAs("draftId"))
.check(regex("""name="entityId" value="(.+?)"""").exists.saveAs("entityId"))
.check(regex("""id="fromPageId" value="(.+?)"""").exists.saveAs("fromPageId"))
)
CreatePage
val createPage = scenario(("CreatePage"))
.feed(csvFeeder)
.exec(confluenceCommonUtility.loginConfluence)
// .exec(confluenceNavigateToHomePageSimulation.navigateToHomePage).pause(2)
//.exec(confluenceNavigateToSpaceSimulation.navigateToSpace).pause(2)
.exec(
http("CreatePage")
.post("/confluence/pages/docreatepage.action")
.queryParam("spaceKey", "#{SpaceKey}")
.queryParam("src", "quick-create")
.header("X-Ausername", "svc.conflu.testuser1")
.header("Cookie", "isTFLicensed=true; seraph.confluence=414121993%3Ad91cad3459ef359dc0511b4309338825f27a07bc; JSESSIONID=C254316D60E71B3E35B464DBAD2DE3C7; rxVisitor=1713329869822V0KS9UCVK6QKM1S0NKML9AQG3IF5T8RH; dtCookie=v_4_srv_81_sn_2CA7BA1A6DF0D1EE00FE491975AEE4A4_perc_100000_ol_0_mul_1_app-3Ad23dc6f673e83215_1_rcs-3Acss_0; dtSa=-; rxvt=1713333378309|1713329869824; dtLatC=3; dtPC=81$331578115_559h-vUHNDVCCSKUFWRMJKIOMBNRKMRKARFGPP-0e0; ajs_user_id=b56ff49c6113db7029af7c0cd6c641cc91d09ae4; ajs_anonymous_id=b1a422e9-6a8e-4de8-a512-09a3004408d6")
.header("Referer", "https://qa-confluence.aexp.com/confluence/display/#{SpaceKey}/")
.header("User-Agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36")
.formParam("atl_token", "#{atl_token}")
.formParam("fromPageId", "#{fromPageId}")
.formParam("originalReferrer","https://qa-confluence.aexp.com/confluence/display/#{SpaceKey}/")
.formParam("title", customFeeder)
// .formParam("title", "#{PageName}")
.formParam("parentPageString", "Conf Test Space Home")
.formParam("draftId", "#{draftId}")
.formParam("entityId", "#{entityId}")
.formParam("newSpaceKey", "#{SpaceKey}")
.formParam("syncRev", "dummy-sync-rev")
.check(status.is(200),bodyString.saveAs("response"))
Hi @Poonam123,
I’m not sure to understand your code.
In CreatePage, you instantiate a scenario, you feed (ie read an entry of the feeder), and you exec another scenario (should not be possible) that itself feed (read another entry).
I’m not sure this is wanted.
Are you sure of your feeder? (if it contains only duplicates, it may be normal that it produces the same page whatever the user)
What is the “customFeeder” about?
Please, review your code to be the shorter but still correct to help us help you.
Cheer!
Sharing code again
class ConfluenceCreatePageSimulation extends Simulation {
val commonUtility = new CommonUtility
val confluenceCommonUtility = new ConfluenceCommonUtility
val confluenceNavigateToHomePageSimulation = new ConfluenceNavigateToHomePageSimulation
val confluenceNavigateToSpaceSimulation = new ConfluenceNavigateToSpaceSimulation
private val csvFeeder = csv("testdata/confluence_csv_files/NavigatetoSpacePageDev.csv").circular
val s: String = time.LocalDateTime.now().toString
time.LocalDateTime.now().toString.replace("T", "_").replace("-", "").replace(":", "")
val randomPagename = "PerformanceTestPage" + util.Random.between(1, 100000).toString
val createPage = scenario(("CreatePage"))
.feed(csvFeeder)
.exec(
http("/Login")
// .post("/confluence/login.action?auth_fallback")
.post("/confluence/dologin.action")
.formParam("os_username", "#{username}")
.formParam("os_password", commonUtility.decodeToBase64("MTZoMiNJMWU="))
.formParam("os_cookie", "true")
.formParam("os_destination", "")
)
.exec(http("GetToken")
.get("/confluence/pages/createpage.action")
.queryParam("spaceKey", "~svc.conflu.testuser1")
.queryParam("src", "quick-create")
.header("X-AUSERNAME", "svc.conflu.testuser1")
.header("X-Requested-With", "XMLHttpRequest")
.header("sec-ch-ua", "\"Not.A/Brand\";v=\"8\", \"Chromium\";v=\"114\", \"Google Chrome\";v=\"114\"")
.check(bodyString.saveAs("BODY"))
.check(regex("""name="atlassian-token" content="(.+?)"""").exists.saveAs("atl_token"))
.check(regex("""name="draftId" value="(.+?)"""").exists.saveAs("draftId"))
.check(regex("""name="entityId" value="(.+?)"""").exists.saveAs("entityId"))
.check(regex("""id="fromPageId" value="(.+?)"""").exists.saveAs("fromPageId"))
)
.exec(
http("CreatePage")
.post("/confluence/pages/docreatepage.action")
.queryParam("spaceKey", "#{SpaceKey}")
.queryParam("src", "quick-create")
.header("X-Ausername", "svc.conflu.testuser1")
.header("Cookie", "isTFLicensed=true; seraph.confluence=414121993%3Ad91cad3459ef359dc0511b4309338825f27a07bc; JSESSIONID=C254316D60E71B3E35B464DBAD2DE3C7; rxVisitor=1713329869822V0KS9UCVK6QKM1S0NKML9AQG3IF5T8RH; dtCookie=v_4_srv_81_sn_2CA7BA1A6DF0D1EE00FE491975AEE4A4_perc_100000_ol_0_mul_1_app-3Ad23dc6f673e83215_1_rcs-3Acss_0; dtSa=-; rxvt=1713333378309|1713329869824; dtLatC=3; dtPC=81$331578115_559h-vUHNDVCCSKUFWRMJKIOMBNRKMRKARFGPP-0e0; ajs_user_id=b56ff49c6113db7029af7c0cd6c641cc91d09ae4; ajs_anonymous_id=b1a422e9-6a8e-4de8-a512-09a3004408d6")
.header("Referer", "https://qa-confluence.aexp.com/confluence/display/#{SpaceKey}/")
.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36")
.formParam("atl_token", "#{atl_token}")
.formParam("fromPageId", "#{fromPageId}")
.formParam("originalReferrer", "https://qa-confluence.aexp.com/confluence/display/#{SpaceKey}/")
.formParam("title", randomPagename)
.formParam("parentPageString", "Conf Test Space Home")
.formParam("draftId", "#{draftId}")
.formParam("entityId", "#{entityId}")
.formParam("newSpaceKey", "#{SpaceKey}")
.formParam("syncRev", "dummy-sync-rev")
.check(status.is(200), bodyString.saveAs("response"))
)
}
Description:
I am executing them on single executor and having two users in the csv.
I have tried running the script using same users as well as using different users.
The result will look like this where only one page creates.
---- Requests ------------------------------------------------------------------
> Global (OK=16 KO=0 )
> /Login (OK=4 KO=0 )
> /Login Redirect 1 (OK=4 KO=0 )
> GetToken (OK=4 KO=0 )
> CreatePage (OK=3 KO=0 )
> CreatePage Redirect 1 (OK=1 KO=0 )
Are you aware that randomPagename
is a val
, so, the value is the same for the whole execution?
my suggestion:
- val randomPagename = "PerformanceTestPage" + util.Random.between(1, 100000).toString
+ def randomPagename() = "PerformanceTestPage" + util.Random.between(1, 100000).toString
and its usage:
- .formParam("title", randomPagename)
+ .formParam("title", _ => randomPagename())
(to use the formParam with function, ie the 3rd form in the example)
Cheers!
1 Like
The original issue where single page was creating now looks resolved but somehow no of expected pages are less due to below issue
---- Global Information --------------------------------------------------------
> request count 48 (OK=34 KO=14 )
> min response time 258 (OK=258 KO=261 )
> max response time 60012 (OK=8495 KO=60012 )
> mean response time 4023 (OK=1536 KO=10063 )
> std deviation 11797 (OK=1818 KO=20436 )
> response time 50th percentile 944 (OK=927 KO=3032 )
> response time 60th percentile 1498 (OK=1133 KO=3139 )
> response time 95th percentile 7791 (OK=6093 KO=60009 )
> response time 99th percentile 60010 (OK=7831 KO=60011 )
> mean requests/sec 0.151 (OK=0.107 KO=0.044 )
---- Response Time Distribution ------------------------------------------------
> t < 600 ms 10 ( 21%)
> 600 ms < t < 1000 ms 9 ( 19%)
> t > 1000 ms 15 ( 31%)
> failed 14 ( 29%)
---- Errors --------------------------------------------------------------------
> CreatePage: Failed to build request: No attribute named 'atl_t 6 (30.00%)
oken' is defined
> regex(name="atlassian-token" content="(.+?)").find.exists, fou 6 (30.00%)
nd nothing
> j.n.ConnectException: Connection refused: no further informati 6 (30.00%)
on
> i.g.h.c.i.RequestTimeoutException: Request timeout to qa-confl 2 (10.00%)
uence.aexp.com/10.2.123.8:443 after 60000 ms
So, a “thank you” is more than welcome and you can mark the answer as “Solution” and you can close this topic.
Please open a new topic with full information to reproduce.
But did you read the log you sent? I’m pretty sure some of the lines in your feeder doesn’t match with actual users on your server.