How to manage response assertion if the values are same but sequence changes in Jmeter - api

I am getting response, let's suppose {"profiles":{"HLS_1200":[{"profile_id":38,"quality_id":11}],"ADAPTIVE" {"L","XL","XXL"}, now every time when we hit the API the response is same but the sequence is getting changed and therefore assetion is getting failed.
Next time I will get the response like {"profiles":{"HLS_1200":[{"profile_id":38,"quality_id":11}],"ADAPTIVE" {"XL","L","XXL"},
I want to pass this response assertion even if the sequence is changed.

Go for JSONAssert library which performs "deep scans" and doesn't care about the order of the attributes
Obtain the following libraries and drop them to JMeter Classpath:
android-json-0.0.20131108.vaadin1.jar
jsonassert-1.5.0.jar
Restart JMeter to pick up the libraries
Add JSR223 Assertion as a child of the request which returns your JSON
Put the following code into "Script" area:
def expected = '{\n' +
' "profiles": {\n' +
' "HLS_1200": [\n' +
' {\n' +
' "profile_id": 38,\n' +
' "quality_id": 11\n' +
' }\n' +
' ],\n' +
' "ADAPTIVE": [\n' +
' "L",\n' +
' "XL",\n' +
' "XXL"\n' +
' ]\n' +
' }\n' +
'}'
org.skyscreamer.jsonassert.JSONAssert.assertEquals(expected, prev.getResponseDataAsString(), false)
More information:
Introduction to JSONassert
Scripting JMeter Assertions in Groovy - A Tutorial

Related

Is there a way to add line break in react-native-email?

I have a feedback page, I am looking to have a section where onPress of a button the application opens the users default email service application and sends typed user feedback to a pre-configured email. I have accomplished all of this using react-native-email.
The captured user TextInput does go into the body of the email. However, there are no line breaks and this looks cluttered. I'm hoping to understand if there are any formatting tools to use with react-native-email, or if there is a way to simply add line breaks.
Here is the sample code
handleEmail = () => {
const to = ['caleb.dockal#gmail.com'];
email(to, {
cc: ['caleb.dockal#gmail.com'],
subject: 'Feedback',
body:
'What feature would you like to see in the app?' +
'\n' +
this.state.answer1 +
'\n' +
' How could we improve your experience? ' +
'\n' +
this.state.answer2 +
'\n' +
' How can we improve the rating system? ' +
this.state.answer3 +
' What information would you like to see about listed businesses? ' +
this.state.answer4 +
' How did you hear about the app? ' +
this.state.answer5 +
' What countries would you like to see the app in? '
this.state.answer6,
}).catch(console.error);
};```
I have tried inserting '\n' in between the strings and state objects and this does not work. Does anyone know of a solution?

SDK_ERROR At least one participant (other than self is required)

Hi Once I fill the contact form in and press the submit button i'm getting the following error, can anyone provide any assistance?
Error creating new complaint Error
at new circuit.Error (C:\Users\chrisconnolly\customer-support\node_modules\circuit-sdk\circuit.js:311:22)
at C:\Users\chrisconnolly\customer-support\node_modules\circuit-sdk\circuit.js:55977:28
at new Promise (<anonymous>)
at Object.createGroupConversation (C:\Users\chrisconnolly\customer-support\node_modules\circuit-sdk\circuit.js:55966:20)
at Object.createConversation (C:\Users\chrisconnolly\customer-support\circuit.js:23:19)
at Socket.<anonymous> (C:\Users\chrisconnolly\customer-support\server.js:78:32)
at Socket.emit (events.js:200:13)
at C:\Users\chrisconnolly\customer-support\node_modules\socket.io\lib\socket.js:513:12
at processTicksAndRejections (internal/process/task_queues.js:82:9) {
code: 'SDK_ERROR',
message: 'At least one participant (other than self) is required',
stack: 'Error\n at new circuit.Error ' +
'(C:\\Users\\chrisconnolly\\customer-support\\node_modules\\circuit-sdk\\circuit.js:311:22)\n' +
' at ' +
'C:\\Users\\chrisconnolly\\customer-support\\node_modules\\circuit-sdk\\circuit.js:55977:28\n' +
' at new Promise (<anonymous>)\n at ' +
'Object.createGroupConversation ' +
'(C:\\Users\\chrisconnolly\\customer-support\\node_modules\\circuit-sdk\\circuit.js:55966:20)\n' +
' at Object.createConversation ' +
'(C:\\Users\\chrisconnolly\\customer-support\\circuit.js:23:19)\n at ' +
'Socket.<anonymous> ' +
'(C:\\Users\\chrisconnolly\\customer-support\\server.js:78:32)\n at ' +
'Socket.emit (events.js:200:13)\n at ' +
'C:\\Users\\chrisconnolly\\customer-support\\node_modules\\socket.io\\lib\\socket.js:513:12\n' +
' at processTicksAndRejections ' +
'(internal/process/task_queues.js:82:9)'
Questions on specific example apps are better post in their respective repo's issues page. I.e. https://github.com/circuit/customer-support/issues
Now looking at the error you get, it says "server.js:78" (https://github.com/circuit/customer-support/blob/master/server.js#L78) which is the createConversation API. And given the error says "At least one participant (other than self) is required", I suspect you are not passing any users as first parameter. Looking at https://github.com/circuit/customer-support/blob/master/server.js#L54 shows that those supportUsers come from the config file "config.json".
Did you rename config.json.template to config.json as per instructions in the README? And did you edit the config file (https://github.com/circuit/customer-support/blob/master/config.json.template#L26) with those support users?

How to define ApiBlueprint array values example with MSON?

Can I use MSON to specify an example values instead of + Body?
Is it possible to override predefined structure values?
I've tried like this:
+ Request (application/json)
+ Headers
Authorization: JWT <token>
+ Attributes (ClientsideCommand)
+ alias: `show-xc`
+ args (array[AppCommandArg], fixed-type)
+ (AppCommandArg)
+ arg_key: address
+ order: 1
+ required: true
+ skip_arg_name: true
+ (AppCommandArg)
+ arg_key: `-A1`
+ order: 2
+ required: true
+ skip_arg_name: false
But such definition corrupts json-schema, because AppCommandArg descibed as separate objects.
And also in the JSON generated from the MSON has 3 items where first item is deafult AppCommandArg.
Looks like it's not possible to make this things twogether. If you add elements as showed abowe Apiary renders it as it sees it, if an element noted twice the json schema also will describe it twice.

IBM MobileFirst -- get location

I have MobileFirst (V7.O) app . How do I get the current latitude/Longitude for the device. Basically, I am recording some information at various point in my app and user can be moving.. So, at various instance, I would like to get the current lat/log..
Can you please provide some hints and how to get this information
Thanks for your help
Cordova is bundled in your MobileFirst project. As such you can take use of Cordova APIs to achieve this.
See the following (scroll down to the API usage): https://github.com/apache/cordova-plugin-geolocation
// onSuccess Callback
// This method accepts a Position object, which contains the
// current GPS coordinates
//
var onSuccess = function(position) {
alert('Latitude: ' + position.coords.latitude + '\n' +
'Longitude: ' + position.coords.longitude + '\n' +
'Altitude: ' + position.coords.altitude + '\n' +
'Accuracy: ' + position.coords.accuracy + '\n' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '\n' +
'Heading: ' + position.coords.heading + '\n' +
'Speed: ' + position.coords.speed + '\n' +
'Timestamp: ' + position.timestamp + '\n');
};
// onError Callback receives a PositionError object
//
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
navigator.geolocation.getCurrentPosition(onSuccess, onError);

How to Retrieve all possible information about a LinkedIn Account ? (API using C#)

I am writting an C# app to make use of Linkedin's API.
I want to be able to query "Person" (First Name + Last Name) and retrieve all the possible information about this group of people with the same name
I am currently using my own implementation of the REST API alongside People-Search API calls.
Here's an example of a request that I know works:
https://api.linkedin.com/v1/people-search:(people:(id,first-name,last-name,headline,picture-url),num-results)?
I'm running it with: first-name=parameter&last-name=parameter after the ? mark
The problem is, I want to retrieve more information such as Title, Industry, Current-company, current-school etc. Refer here for the list of possible parameters.
This notation is what they call Field Selectors
How do i structure my API Call so i can get all the possible information about someone ?
Here is the url to get everything for a user Profile:
https://api.linkedin.com/v1/people/~:(id,first-name,last-name,headline,picture-url,industry,summary,specialties,positions:(id,title,summary,start-date,end-date,is-current,company:(id,name,type,size,industry,ticker)),educations:(id,school-name,field-of-study,start-date,end-date,degree,activities,notes),associations,interests,num-recommenders,date-of-birth,publications:(id,title,publisher:(name),authors:(id,name),date,url,summary),patents:(id,title,summary,number,status:(id,name),office:(name),inventors:(id,name),date,url),languages:(id,language:(name),proficiency:(level,name)),skills:(id,skill:(name)),certifications:(id,name,authority:(name),number,start-date,end-date),courses:(id,name,number),recommendations-received:(id,recommendation-type,recommendation-text,recommender),honors-awards,three-current-positions,three-past-positions,volunteer)?oauth2_access_token=PUT_YOUR_TOKEN_HERE
Requires an Oauth2 access token.
Here it is in a nice String list (Java):
apiUrl
+ "/v1/people/~:("
+ "id,"
+ "first-name,"
+ "last-name,"
+ "headline,"
+ "picture-url,"
+ "industry,"
+ "summary,"
+ "specialties,"
+ "positions:("
+ "id,"
+ "title,"
+ "summary,"
+ "start-date,"
+ "end-date,"
+ "is-current,"
+ "company:("
+ "id,"
+ "name,"
+ "type,"
+ "size,"
+ "industry,"
+ "ticker)"
+"),"
+ "educations:("
+ "id,"
+ "school-name,"
+ "field-of-study,"
+ "start-date,"
+ "end-date,"
+ "degree,"
+ "activities,"
+ "notes),"
+ "associations," /* Full Profile */
+ "interests,"
+ "num-recommenders,"
+ "date-of-birth,"
+ "publications:("
+ "id,"
+ "title,"
+ "publisher:(name),"
+ "authors:(id,name),"
+ "date,"
+ "url,"
+ "summary),"
+ "patents:("
+ "id,"
+ "title,"
+ "summary,"
+ "number,"
+ "status:(id,name),"
+ "office:(name),"
+ "inventors:(id,name),"
+ "date,"
+ "url),"
+ "languages:("
+ "id,"
+ "language:(name),"
+ "proficiency:(level,name)),"
+ "skills:("
+ "id,"
+ "skill:(name)),"
+ "certifications:("
+ "id,"
+ "name,"
+ "authority:(name),"
+ "number,"
+ "start-date,"
+ "end-date),"
+ "courses:("
+ "id,"
+ "name,"
+ "number),"
+ "recommendations-received:("
+ "id,"
+ "recommendation-type,"
+ "recommendation-text,"
+ "recommender),"
+ "honors-awards,"
+ "three-current-positions,"
+ "three-past-positions,"
+ "volunteer"
+ ")"
+ "?oauth2_access_token="+ token;
You've already got the notation down, all you need to do is add the rest of the field selectors, nesting them where needed:
https://api.linkedin.com/v1/people-search:(people:(id,first-name,last-name,headline,picture-url,industry,positions:(id,title,summary,start-date,end-date,is-current,company:(id,name,type,size,industry,ticker)),educations:(id,school-name,field-of-study,start-date,end-date,degree,activities,notes)),num-results)?first-name=parameter&last-name=parameter
Keep in mind that per the Profile Field docs, you can only get educations for 1st degree connections of the current user.
I use this URL to get everything including email and formatted as json:
https://api.linkedin.com/v1/people/~:(id,first-name,email-address,last-name,headline,picture-url,industry,summary,specialties,positions:(id,title,summary,start-date,end-date,is-current,company:(id,name,type,size,industry,ticker)),educations:(id,school-name,field-of-study,start-date,end-date,degree,activities,notes),associations,interests,num-recommenders,date-of-birth,publications:(id,title,publisher:(name),authors:(id,name),date,url,summary),patents:(id,title,summary,number,status:(id,name),office:(name),inventors:(id,name),date,url),languages:(id,language:(name),proficiency:(level,name)),skills:(id,skill:(name)),certifications:(id,name,authority:(name),number,start-date,end-date),courses:(id,name,number),recommendations-received:(id,recommendation-type,recommendation-text,recommender),honors-awards,three-current-positions,three-past-positions,volunteer)?format=json