How to launch one thread group from another in jmeter - jmeter

I am very new to Jmeter. In my application I have two scenarios.
1. Create: Here we book a hotel room. After booking application returns a transaction ID.
2. Cancel: We need to pass the transaction Id to the application to cancel booking.
I want to test with jmeter in such a way that after a create call is made, the cancel call of the respective create is called with the generated transaction ID automatically.
Don't have any clue how to do this. Application is written using spring, REST web service. There is one BeanShell Preprocessor in my existing .jmx file. Using that jmx file I call the create & cancel service individually.

Normally you can use a variable to store a string and use it later on, however it is not possible to pass a variable from one thread to another. To do this you need to use a property: this site explains how.
Of course if you need to save a lot of transaction ID's it might make more sense to have the first thread group store them in a csv file and have the second one read them from the file. Have a look at the CSV Data Set Config.

Create: Here we book a hotel room. After booking application returns a transaction ID.
User regular expression extractor to extract transaction Id from it and store it in a variable.
Provide the name of the parameter you get in response in regular Expression text field
Here it will extract transactionId from the response of create and stores it in transactionID variable.
Cancel: We need to pass the transaction Id to the application to cancel booking.
Provide the variable name in which transactionId is stored to as the parameter value of cancel request.

Related

I want to fetch ID based on provided name from api which returns both. I want to store this ID which will be used in another request

This api returns me dashboard_id and dashboard_name as highlighted in attached image. My requirement is to fetch dashboard_id based on dashboard_name using this api in jmeter? Both ID and Name are unique here. Is it possible to achieve this in jmeter?
Since we do not have any api which will return me dashboard_id based on dashboard_name. So wanted to use this current api which has both ID and Name, and based on Name I want to fetch ID, and ID will be used in different request.
Using Jmeter, I am providing user credentials and dashboard_id via 'CSV Data Set Config' that is being used in request, but too many ID's are confusing, so better we want to use dashboard_name which is more readable and add current api from where we want to fetch ID, so that ID can be used in another request.
I was trying to go though Beanshell Sampler to achieve this, but still didn't find a way to achieve it. Please suggest me a way to achieve this in jmeter?
You can use JSON Extractor and the following JsonPath query:
$..[?(#.name == 'New Dashboard - 6')].dashboardId
Full configuration:
You should be able to refer the extracted id as ${dashboardId} where required.
Going forward please:
Don't post code as image
Post the code fully
Don't use Beanshell as it's performance anti-pattern

Is it possible to extract data from the body of an outlook email and throw it in SQL automatically?

Situation: We get audit emails every morning. The body of the email contains a table with various columns. The column labelled 'ID' is the unique key for each row. I have to copy the data from the ID column, format it in note++, and then paste it in a pre-filled query in SQL were I run it.
Question: Is it possible to automate this process? if so, where could I start? I would be nice if I could have something that either runs automatically or manually, reads the email, extracts the data from the column, formats it, and throws it in a query and executes.
Additional Details: The emails are always from the same distro, fire at the same time every day, and the table columns are static.
My skill Level: Beginner but resourceful and eager to learn, so please don't crucify me if I am not clear.
Yes, it is possible. You can develop a VBA macro or a COM add-in if you need to distribute your solution on multiple machines. Basically you are interested in handling the NewMailEx event of the Application class which is fired when a new message arrives in the Inbox and before client rule processing occurs. You can use the Entry ID returned in the EntryIDCollection array to call the NameSpace.GetItemFromID method and process the item. This event fires once for every received item that is processed by Microsoft Outlook. The item can be one of several different item types, for example, MailItem, MeetingItem, or SharingItem.
After retrieving the incoming item you can process it by getting property values and adding them to the SQL Db.
You may find the Walkthrough: Create your first VSTO Add-in for Outlook article helpful.

Event Sourcing - Data supplied to Command and data saved in Events

I am looking into event sourcing and I have a few thoughts that I need to get my head round.
Take for example an online shop -
The customer adds an item to the basket and saves their order.
The command handler could create an order on the customer aggregate root and add an OrderCreated event which contained the customer id, order id, item id, quantity and unit price. All pretty straight forward but what if the aggregate needed to check to see if that item was on special offer?
If this was for example a basket service would it subscribe to events from the catalog service and store it's own projections of the catalog service which it could then use, so then the basket service would comprise an event store and also some form of projection of the catalog service?
Or if in the example I've just described, if the basket and catalog functionality were part of the same application and they only held event data, then when a customer creates an order the handler would pull all ordered items from the event store via a repository, apply all events to them and then return them to the handler in order to check if the item was on special offer.
what if the aggregate needed to check to see if that item was on special offer?
It needs to execute a query to get the information it needs.
From the aggregate point of view those data are external, so it (or the handler sending the command to it) needs a query to access that information.
How the query work is up to you (there are pros and cons for each way), the query handler can:
Call a repository that loads an aggregate and check for the special offer (you can also think to have event sourcing in just one part of your system and having this part using another way to store dara, or not)
Make a remote call to the Catalog Service API to check for the special offer
Do a query to a local db, that is populated reading events emitted by the catalog service and stored "locally" to the basket service

Assigned to field in Case Table- Servicenow

In Case Form,Based on the group selected in Assignment group field ,the assigned to field is listing some users which belongs to it in CRM UI.
Now I want to retrieve the same users using normal REST API. Please suggest REST API to list the users based on a group.
Users linked to groups is stored in table sys_user_grmember. In the example I search for all Users in Group named "Application Development".
GET https://YOURINSTANCE.service-now.com/api/now/table/sys_user_grmember?sysparm_query=%22groupSTARTSWITHApplication%20Development%22&sysparm_limit=10
You can easily test the REST Api with the rest api explorer from SNOW: https://YOURINSTANCE.service-now.com/nav_to.do?uri=%2F$restapi.do
Can you give more info on the exact requirement, so i can be more precise?
As far as I know, you can create a rest message to get the users inside a group and show the list wherever you want.
This would require three things from your side.
a) Creating a rest message in Snow.
b) Creating a script includes calling the rest message.
c) A client script or trigger which initiates the rest call using client script.
Hope this helps.
Regards.

How to get object instead of string from dropdown list in Spring MVC

On my JSP page i have following dropdown list:
<form:select path="companies" name="company">
<form:options items="${companies}" itemValue="name" itemLabel="name"/>
</form:select>
This list displays name attribute of Company object. when I choose value and submit form, my controller receive this attribute.
I looking for way to how to receive this object in controller instead of single attribute.
So, first of all I recommend having the company id, if there is one, instead of company name as the value that will we submitted from the drop down. You can still display the name as the description but send the id as the value. An id would usually be the primary key in your company table, if you have one. Names are not very unique.
Then when you receive this id as a parameter in your spring controller method you will get a handle to the same list that was used to render the drop down and get the object. The thing about spring is that object models only persist as long as the request by default, so the list you used to render the drop down would have disappeared by the time the user sends the id back. The first request was used to render the page, and the second request is the sending of the parameter. So, you will want to persist this list in memory longer than the request. You can make that list persist longer by keeping it in the session. Spring has an annotation for making model attributes persist at session level. Just keep in mind that the object will then live in the session as long as the user is logged in unless you remove it.
I kind of wonder why you want the object. Often times the id is all you need because you set that in the db as the users company of choice and you are all set. However, I can't tell what you are trying to do.

Resources