gatling

Index of value in json responsebody (Gatling/Scala)

一笑奈何 提交于 2020-07-10 10:32:06
问题 Given my json response body [{"brukergruppeSperret":false,"virksomhetsnavn":"HELFO","brukerGruppe":"Brukerstøtte"},{"brukergruppeSperret":false,"virksomhetsnavn":"Klubbgaten Legesenter","brukerGruppe":"Lege"},{"brukergruppeSperret":false,"virksomhetsnavn":"Sjøsiden Legesenter","brukerGruppe":"Lege"},{"brukergruppeSperret":false,"virksomhetsnavn":"Athene legekontor Helsedirektoratet","brukerGruppe":"Lege"},{"brukergruppeSperret":false,"virksomhetsnavn":"Xeon Legekontor","brukerGruppe":"Lege"},

How to pass correlated value in next request in Gatling script

久未见 提交于 2020-06-01 05:09:50
问题 How can I replace "details1" in "request_2" with correlated value "SynchToken" from "request_1". I am trying to replace with ${SynchToken} but it is not reflecting the correlated value. val Transaction_Name_1 = group("Transaction_Name_1") { exec(http("request_1") .get(session => "/abc/details1?_=" + System.currentTimeMillis()) .check(regex("""name="SYNCHRONIZER_TOKEN" value="(.*?)"""").saveAs("SynchToken"))) .pause(5) .exec(http("request_2") .get(session => "/abc/details1?_=" + System

How to pass correlated value in next request in Gatling script

孤人 提交于 2020-06-01 05:09:26
问题 How can I replace "details1" in "request_2" with correlated value "SynchToken" from "request_1". I am trying to replace with ${SynchToken} but it is not reflecting the correlated value. val Transaction_Name_1 = group("Transaction_Name_1") { exec(http("request_1") .get(session => "/abc/details1?_=" + System.currentTimeMillis()) .check(regex("""name="SYNCHRONIZER_TOKEN" value="(.*?)"""").saveAs("SynchToken"))) .pause(5) .exec(http("request_2") .get(session => "/abc/details1?_=" + System

Gatling: Get REST resource, change JSON leaf, Post back

☆樱花仙子☆ 提交于 2020-05-16 02:28:06
问题 I am working on a test script, testing a REST interface in Gatling using Scala. For a specific REST resource, this is what I would like to achieve: Get the resource (which will give me JSON data in the body). Use jsonpath to change a value in the body. Post the modified body back to the same url I have managed to success with 1 and 3. The only problem left is to change the json data which seem to be in string format. Test steps object WebTestCollection { def getAccountDetails() = http("Get

How to invoke a SOAP Web service using Gatling 2.2.0

北战南征 提交于 2020-05-13 06:29:08
问题 I am new to Gatling and Scala. How to invoke / test a java SOAP web service using Gatling 2.2.0 ? I had searched google and gatling documentation, but could not find any link for that code: val httpProtocol = http .baseURL("http://PUNITP83267L:8081/WebServiceProject/services/MyService") val headers_0 = Map( "accept-encoding" -> "gzip, deflate", "Content-Type" -> "text/xml;charset=UTF-8", "SOAPAction" -> "", "Content-Length" -> "275", "Host" -> "PUNITP83267L:8081", "Connection" -> "alive",

使用Gatling进行性能测试(一)Gatling初识&使用maven创建Gatling项目

淺唱寂寞╮ 提交于 2020-05-06 20:16:07
引言 《使用Gatling进行性能测试》是一个专栏,一共有5篇文章,包括Gatling项目创建、录制脚本、脚本调试、模拟设置、报告解读几部分,主要适用于刚开始学习使用Gatling的小白,或者看Gatling官方英文文档困难的小伙伴。我也是第一次学Gatling,都是按官方文档来的,过程中如果有任何问题,欢迎大家评论或私信交流。 文章目录 引言 为什么要使用Gatling进行性能测试? 创建你的第一个Gatling项目 环境准备 创建项目 将项目推送到github 项目结构详解 为什么要使用Gatling进行性能测试? Gatling是一款开源的性能测试工具,它有两个版本,一个是免费版,一个是企业版。企业版相对于免费版来说,多出的功能主要有:支持云平台分布式测试,更多类型的CI集成(比如Bamboo、TeamCity),有一个可视化的管理页面,可以查看实时报告,也支持LDAP认证。本专栏使用的是Gatling免费版的,所以基于此讲一下它的优点。如下: (1)可以适用于任何操作系统; (2)性能好,一个线程可以模拟多个用户; (3)case as code,脚本语言是scala,是一款基于java的DSL,易于扩展; (4)CI集成简单,可以和Jenkins集成; (5)和Git集成,方便管理代码版本; (6)支持HTTP代理脚本录制和HAR File脚本录制; (7

给EmpMapper开放Restful接口

自古美人都是妖i 提交于 2020-04-29 15:19:17
本文例程下载: https://files.cnblogs.com/files/xiandedanteng/gatling20200428-3.zip 接口控制器代码如下: 请求url和响应都写在了每个接口的注释上。 package com.ufo.gatling.ctrl; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ufo.gatling.entity.Emp; import com.ufo.gatling.mapper.EmpMapper; @RestController @RequestMapping( "/emp" ) public class EmpCtrl { @Autowired private EmpMapper empMapper= null ;

Gatling in scala how to get url from redirect

主宰稳场 提交于 2020-03-22 09:08:18
问题 I using gatling ver 2.3.0 in scala. Is it possible after send request get a url from redirect to variable? e.g. I request for 192.168.1.30:8080/ and this link redirect me to 192.168.1.30:8080/token/123, can I get /token/123? I tried with this code but occurs error header.find.exists, found nothing but in Fiddler I see this header val httpConf = http .baseURL("http://192.168.1.30:8080") .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") .acceptEncodingHeader("gzip

Gatling in scala how to get url from redirect

此生再无相见时 提交于 2020-03-22 09:08:09
问题 I using gatling ver 2.3.0 in scala. Is it possible after send request get a url from redirect to variable? e.g. I request for 192.168.1.30:8080/ and this link redirect me to 192.168.1.30:8080/token/123, can I get /token/123? I tried with this code but occurs error header.find.exists, found nothing but in Fiddler I see this header val httpConf = http .baseURL("http://192.168.1.30:8080") .acceptHeader("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8") .acceptEncodingHeader("gzip

Crashed with 'j.l.NullPointerException' when i try to run karate-gatling test reports

馋奶兔 提交于 2020-03-03 07:41:10
问题 I am trying to get some gatling report using karate.gatling project, but i always get the fallowing error. I am using karete version 0.9.3 and gatling-olugin 3.0.1. any idea of what i am doing wrong? 18:38:05.318 [GatlingSystem-akka.actor.default-dispatcher-5] ERROR c.intuit.karate.gatling.KarateAction - 'classpath:com.it.service/service.feature' crashed on session Session(hello,100,1561847885316,Map(),0,OK,List(),io.gatling.core.protocol.ProtocolComponentsRegistry$$Lambda$320/1088104996