How to convert date (1991-08-23T00:00:00) which is captured in response and then convert this format (08-23-1991) in vugen? - scripting

I am working on a script where I need to submit a form and do some authentication during the steps. I am using LoadRunner Vugen for scripting. For one of the request's response I can see birthdate is coming like below:
"suffixName": ""
"birthDate": "1991-08-23T00:00:00",
"agencyName": ""
In another later request I can see in jason body the same date is used like below
"Body={\agentSuffix":null,"agentFirstName":"XYZ","agentLastName":"WSD","agentBirthDate":"08-23-1991" and so on with additional body.
I am able to capture the date from response by using web_reg_save_param_ex. But now how do I convert the value so that I can use it in next jason body in a custom request. I just need help to capture it.
Captured value: 1991-08-23T00:00:00
Expected value: 08/23/1991
Thanks in advance

Correlate for the string
Use your programming skills in the language of your virtual user to transform transform the string into a new string. Your test code might be C, JavaScript, Java, ... so use language-appropriate string conversion functions.
Hints
"LB=birthDate":"", "RB=T00:00:00"
Conside the loop and what this means for the use of substring and sprintf();
for (counter=0;counter<=strlen(lr_eval_string(MyCorrelatedVarName));counter++)
{ lr_message("%s",&lr_eval_string(MyCorrelatedVarName)[counter]); }

Related

How to pass the default language to the Registration page?

Is there a way to pass a specific UI language to the registration page? This is coming from the website and I want it to be the defaut option.
you can send the culture with these headers
c=...
uic=...
https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.AspNetCore/AspNetCore/Localization/AbpLocalizationHeaderRequestCultureProvider.cs#L12
and for MVC use culture parameter like below
/register?culture=tr
must be the first parameter of the query string
and last option; you can always override AbpUserRequestCultureProvider
https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.AspNetCore/AspNetCore/Localization/AbpUserRequestCultureProvider.cs
UPDATE:
According to the implementation it accepts query string parameters as culture like below
?culture=es-MX&ui-culture=es-MX
See https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2103
If you look at the request headers sent by the browser, it includes "Accept-Language". It can look something like this:
en-US,en;q=0.9,es-419;q=0.8,es;q=0.7
Generally, the preference runs in descending order, so here, the browser is saying it prefers U.S. english before anything else. More here about what the q values mean: What is q=0.5 in Accept* HTTP headers?
You can access this value through in the controller.
Request.Headers["Accept-Language"]

How to call whatsmate translation API on the Bowser?

subscribed to their API today, I was wondering about how I can call their API on the browser
they already provided this, I tried a lot but I didn't get anything
See Their API Reference https://whatsmate.github.io/api-reference/
Translation Endpoints
1. Translate text
Endpoint: POST /v1/translation/translate
Parameters required in JSON payload:
fromLang: String. The code representing the language of the supplied text.
toLang: String. The code representing the language you want the text to be translated to.
text: String. The piece of text you want to be translated.
List of language codes: See the next endpoint.
Response: String. The translated text.

AFNetworking invalid JSON format returned

I need to query the Yahoo stock query service in an iOS application using AFNetworking.
The query returns the following result;
YAHOO.Finance.SymbolSuggest.ssCallback({"ResultSet":{"Query":"yahoo","Result":[{"symbol":"YHOO","name":"Yahoo! Inc.","exch":"NMS","type":"S","exchDisp":"NASDAQ","typeDisp":"Equity"},{"symbol":"YHOF.EX","name":"YAHOO","exch":"EUX","type":"S","exchDisp":"EUREX Futures and Options Exchange ","typeDisp":"Equity"},{"symbol":"YOJ.BE","name":"YAHOO JAPAN","exch":"BER","type":"S","exchDisp":"Berlin","typeDisp":"Equity"},{"symbol":"YHOO.MX","name":"Yahoo! Inc.","exch":"MEX","type":"S","exchDisp":"Mexico","typeDisp":"Equity"},{"symbol":"YHO.DU","name":"YAHOO","exch":"DUS","type":"S","exchDisp":"Dusseldorf Stock Exchange ","typeDisp":"Equity"},{"symbol":"YAHOY","name":"Yahoo Japan Corporation","exch":"PNK","type":"S","exchDisp":"OTC Markets","typeDisp":"Equity"},{"symbol":"YAHOF","name":"Yahoo Japan Corporation","exch":"PNK","type":"S","exchDisp":"OTC Markets","typeDisp":"Equity"},{"symbol":"YOJ.SG","name":"YAHOO JAPAN","exch":"STU","type":"S","exchDisp":"Stuttgart","typeDisp":"Equity"},{"symbol":"YHOO.SW","name":"YAHOO","exch":"EBS","type":"S","exchDisp":"Swiss","typeDisp":"Equity"},{"symbol":"YHO.HM","name":"YAHOO","exch":"HAM","type":"S","exchDisp":"Hamburg","typeDisp":"Equity"}]}})
As the you can see, the JSON is not formatted properly. Specifically speaking, the YAHOO.Finance.SymbolSuggest.ssCallback() is not needed and causes the JSON formatter to crash.
Is there a way to tell AFNetworking to kind of skip the text that isn't part of the actual JSON?
Edit:
Upon #rckoenes request; This is how the webservice is used;
http://www.jarloo.com/yahoo-stock-symbol-lookup/
Well it looks like this is not a public API, so you might not be allowed to use it. Off course you still can. Just create your own response serializer end before you decode the JSON remove first part with seem simple string replace and remove the last charter. This should return valid JSON.

import.io Magic extractor: how to use regionText?

The API doc and support article are a bit unclear about the exact usage of the regionText parameter.
Is it supposed to be a simple string or an XPath? For example, look at http://www.circlecount.com/community/114481059214254340537 - I would like to extract the table in the middle-right. My current API request looks like this:
https://api.import.io/store/data/_magic?url=http://www.circlecount.com/community/114481059214254340537&regionText=//*[#id=follower_table_114481059214254340537]&_apikey=XXX&_user=YYY
Region text should be simple string, not an xpath

How to use Xpath extractor to extract mutiple fields using SOAP request in Jmeter?

I imported the webservice and did my first transaction passed. I see the request and reply xml
Now I want to extract ton of field values from the reply xml that I got and need to pass into Request xml.
For one field I know how to do that. I use Xpath Extractor to extract like this
//*[local-name()='Data']/text()`.
In the next action, I can just use as ${Data} which is working fine.
But I need to extract the text content from ton of fields that need to be passed into the next action.
How to do that using Xpath Extractor?
If your XPath query matches multiple /Data/text fields they will be caught as
TEXT_1=first match
TEXT_2=second match
etc.
If you need to combine results from different queries it can be done via pipe sign - | like
//*[local-name()='Data']/text()` | //*[local-name()='Something else']/text()
In this case result will go to the single variable.
Third option is using as many XPath extractors as needed.
See XPath Tutorial for general language reference and Using the XPath Extractor in JMeter guide for more tips and tricks.