Hi Deepak,

The flow of request is as below :

JSON Request ( with ID field value as
*${__threadNum}${__time(ddMMyyyyHHmmssSSS}* ) --> JSON Response True -->
Query the DB to check if  *${__threadNum}${__time(ddMMyyy**yHHmmssSSS}* as
column value in pre-defined table --> If value is available then success
else failure.

JSON Request ( with custom field
 ${__threadNum}${__time(ddMMyyyyHHmmssSSS}) --> JSON Response False -->
 failure.

Warm Regards,
Manish Taneja


On Tue, Oct 15, 2019 at 4:16 AM Deepak Shetty <[email protected]> wrote:

> Hi
> If your question is how do i pass in variables to JDBC sampler - see
> variable names
> https://jmeter.apache.org/usermanual/component_reference.html#JDBC_Request
>
> If your question is How do I validate response of a JDBC request then that
> can be done in a variety of ways. For e.g. If you change the query to be a
> simple select rather than count then you can change the JDBC Samplers
> Handle Resultset to be "Count Records" And then assert as a response
> assertion whether you see 0 or 1 records returned OR you could use the sql
> query as count , then use result variable Name to store that value into a
> variable and then use a response assertion (with the option selected to use
> that variable name .) to check the value of the variable
>
>
> regards
> deepak
>
> On Mon, Oct 14, 2019 at 12:39 PM Divye Mahajan <
> [email protected]> wrote:
>
> > Hi Deepak,
> >
> > Thanks for the update,
> > This will help to use the unique key value used but the actual
> requirement
> > is to add an assertion of jdbc query and giving out true response only if
> > the database has the respected value too.
> >
> > Giving a little clarity below:-
> >
> > Firing a json of below syntax will create a database entry having column
> > name event_id as 1151020190106502 from
> > ${__threadNum}${__time(ddMMyyyyHHmmssSSS}.
> > Post that a select statement will be fired as  a JDBC query and check
> > whether the record exist in the above table. If record exist only the
> true
> > response is given in the response body of a listener for ex:- *View
> > Result Tree*
> >
> > Regards,
> > Divye Mahajan
> >
> >
> > On Sat, Oct 12, 2019 at 7:29 AM Deepak Shetty <[email protected]> wrote:
> >
> >> The __time function accept a variable name that you can pass in to save
> >> the value generated at that time into a JMeter variable(
> >> https://jmeter.apache.org/usermanual/functions.html#__time ) .
> >> ${__threadNum}${__time(ddMMyyyyHHmmssSSS,yourVariableName)}
> >> Then in your DB Query you can just pass that as the variable on which
> you
> >> are querying ${yourVariableName} - In general anything that you are
> passing
> >> in the request can always be saved for use later
> >>
> >> regards
> >> deepak
> >>
> >>
> >> On Fri, Oct 11, 2019 at 10:15 AM Mantanz <[email protected]
> >
> >> wrote:
> >>
> >>> Hi All,
> >>>
> >>> Jmeter Version: 5.0
> >>>
> >>> I have a scenario where we fire custom json onto application. The
> >>> application only responds as success or failure. This is followed by
> >>> checking the fire event id in a specific table in database. So I need
> to
> >>> connect to DB and then check the event id value sent in request.
> >>> The problem here is that the response is not having the event id which
> >>> was sent for the request thus I couldn’t find a way. Is there a way I
> can
> >>> check the request event id field and fire a DB query based on that.
> >>>
> >>>
> >>>  For load testing each event is maintained as unique using the
> function;
> >>> ${__threadNum}${__time(ddMMyyyyHHmmssSSS)}
> >>>
> >>>
> >>> Request :
> >>>
> {"event_id":"${__threadNum}${__time(ddMMyyyyHHmmssSSS)}","EventSubType":"SUBEVENT","event-name":"TEST
> >>> EVENT","EventType":"Sample type","source":"fin","msgBody":"Body text"}
> >>>
> >>> Response : Success
> >>>
> >>> DB Query : select count(1) from events where
> >>> event_id=${__threadNum}${__time(ddMMyyyyHHmmssSSS)}
> >>>
> >>> Expected Response: If the count is 1 then “Test Case Successful”  else
> >>> “Test Case failed”.
> >>>
> >>> Kindly help.
> >>>
> >>> Let me know in case of any more information.
> >>>
> >>> Warm Regards,
> >>> Manish Taneja
> >>
> >>
>

Reply via email to