REST API calls using Gatling tools - performance-testing

Actually am new to Gatling tool, just i want to make REST API using the Gatling tools.So any one suggest how to do and some related links about Gatling tool API calls.
Thanks in Advance!!!

hi few example below for reference :-
exec(
http("Poll")
.get(Configuration._URL + "/getData").check(status.is(200))
)
or
exec(
http("Request")
.put(Configuration.URL + "/createData").check(status.is(200))
.body(("${xmlRequest}"))
)

Related

How to integrate sqlite3 in Sveltekit?

I have been using sqlite3 for most of my fullstack applications (node/express, django/drf + svelte on the front end as the consumer of the api endpoints) and have been trying to figure out how to integrate sqlite3.
As far as I know, better-sqlite3 is a synchronous library.
I notice you're using await with better-sqlite3. Removing await might solve your problem.
index.json.ts didn't work for me for some reason. I had to change it to list.json.ts.
Also, they changed the endpoint handler to all uppercase GET in this discussion.

How to apply a pagination on IBM vs code chaincode for fabric?

I'm using an IBM-Blockchain platform VS code extension for one of my POC development. I want pagination on the Query function in fabric. Here is my demo example:
let queryString =
{
"selector": {
"isLink": isLink,
"f_id":f_id
}
}
How can I put pagination (like when 5 data comes on the first page and then continue like another page) on this chaincode selector query which is created on the IBM-Blockchain platform? Can anyone help me?
Thanks.
pagination is done using a pagination api, so suggest you take a look here
https://hyperledger.github.io/fabric-chaincode-node/release-1.4/api/fabric-shim.ChaincodeStub.html#getQueryResultWithPagination__anchor
For the api reference. Sorry I don't know if there is any example of use of this in any of the fabric samples, if not then hopefully there are some examples in the test suite for fabric-chaincode-node on github.

How to create a 500 error on an rest API for error testing purpose?

I am writing some test code for my rest api using nodejs and chai.
I would like to create a 500 error on purpose to be sure my API react well, but I have no idea on how to do that.
Any help or tips about best practices would be really appreciated.
Thanks in advance
Try this URL, this is dedicated for testing purpose :
https://httpstat.us/500
Or expose a php script with garbage in it, like :
<?php
foobarbase
You can use following syntax:
res.status(500).json({your message});

Groovy Couchbase help needed

I am beginner in Groovy and Couchbase. Used Groovy-console to script some basic Groovy. Used couchbase console tool with UI to meddle with documents on couchbase. Now I wanna combine them. I want to meddle with documents in couchbase using Groovy script.
Where can I find an apt tutorial? Or an example code of Groovy-couchbase connection and operation will also help a lot.
(I couldn't find on Google searches, so had to turn to my fellow experts on stackoverflow)
Thank you so much! :-)
All you need is the Java client.
#Grab('com.couchbase.client:java-client:2.2.6')
import com.couchbase.client.java.CouchbaseCluster
// Connect to localhost
def cluster = CouchbaseCluster.create()
// Open the default bucket and the "beer-sample" one
def defaultBucket = cluster.openBucket()
def beerSampleBucket = cluster.openBucket("beer-sample")
// Disconnect and clear all allocated resources
cluster.disconnect()
The Java client documentation is here: http://developer.couchbase.com/documentation/server/4.0/sdks/java-2.2/java-intro.html

Problems consuming web service from groovy script

I'm having some problems trying to consume a web service from a groovy script. I'm using WSClient lib.
If I execute the example posted at groovy's website:
#Grab(group='org.codehaus.groovy.modules', module='groovyws', version='0.5.2')
import groovyx.net.ws.WSClient
proxy = new WSClient("http://www.w3schools.com/webservices/tempconvert.asmx?WSDL", this.class.classLoader)
proxy.initialize()
result = proxy.CelsiusToFahrenheit(0)
println "You are probably freezing at ${result} degrees Farhenheit"
Works fine, but once I try to consume another service it crashes with this error:
INFO: Created classes: javac: no
source files Usage: javac
use -help for a list
of possible options 07-jul-2010
9:55:57
org.apache.cxf.endpoint.dynamic.DynamicClientFactory
createC lient GRAVE: Could not compile
java files for http://xxx:8080/x/services/xxx?wsdl.
Caught:
groovyx.net.ws.exceptions.InvokeException:
java.lang.NullPointerExceptio n
at groovy-ws.run(groovy-ws.groovy:13)
The code it's exactly the same (apart from wsdl url which correponds to one internal server). The main difference I found between them is that the second wsdl is RPC style while the first one isn't. I've read that there's some problems to consume RPC like webservices from groovy with WSClient lib. ¿Does anyone know how to consume RPC like webservices with WSClient? ¿Could anyone enlighten me please?
Thank you very much
There seems to be a bug in GroovyWS, documented here on their JIRA.
It's currently Unresolved and was added in 2010.
I'm personally getting the same error with anything other than the trivial example service, with Groovy 1.8.0, GroovyWS 0.5.2
Hopefully somebody can find the issue and fix it - WSClient could definitely be a great alternative to traditional CXF/JAXB
Don't use WSClient is the best answer I can give you. For anything but simple services I've found WSClient does not work well. Instead use what ever java based web service client your most comfortable with and call it from Groovy.

Resources