I want to update test case outcome status in azure test plans. How can I do this?
I found only how to get info about test plans but without update per test case.
I want to update test case outcome status in azure test plans. How can I do this?
When you manually update the test case outcome status in azure test plans, you could go to the test run and select more options:
And if you want update the test case outcome states with REST API, you could try to use following REST API Results - Update:
PATCH https://dev.azure.com/{organization}/{project}/_apis/test/Runs/{runId}/results?api-version=6.0
Request Body:
[
{
"id": 100000,
"state": "Completed",
"comment": "Website theme is looking good",
"associatedBugs": [
{
"id": 30
}
]
},
{
"id": 100001,
"state": "Completed",
"comment": "Website links are failing because of incorrect container id",
"failureType": "Known Issue"
}
]
with above result API, it's require OAuth-2 authentication. So, unable to make update the test case status not with bearer token or signing information in postman.
Related
Response code is 200 with error count 0 but response body is null.
PostMan Request: i hit the api from postman with this request body.
{"body": {
"distance": 3466567.8,
"latitude": 45.7,
"longitude": 80.7}}
Postman response: I got this reponse on postman.
"requestId": "LME2206071048390000193004",
"msgId": "LME2206071048390000191004",
"accDate": null,
"startDateTime": [
2022,
6,
7,
10,
48,
39,
100000000
],
"locale": "zh_CN",
"routeInfo": "LME"
.......................
Now if i hit the same API with same request body from the JMeter, i got the below mentioned response.
{
"msgId": null,
"source": null,
"locale": null,
"body": null,
"userId": null,
"uri": null,
"accDate": null,
"startDateTime": null,
"requestId": null,
"msgCd": "SYS00001",
"msgInfo": null}
................
Can anyone help me how to resolve this issue.
We cannot "help me how to resolve this issue" unless you share the Postman and JMeter's HTTP Request sampler configurations
It might be the case you forgot something obvious, i.e. sending a relevant Content-Type header
In general if your request works fine in Postman you can just record it using JMeter's HTTP(S) Test Script Recorder
Start HTTP(S) Test Script Recorder (it's better to use Recording Template for this)
Import JMeter's certificate into Postman
Configure Postman to use JMeter as the proxy
Run your request in Postman
That's it, JMeter should intercept the request and generate the relevant HTTP Request sampler and friends so you can replay it with increased load
More information: How to Convert Your Postman API Tests to JMeter for Scaling
Above mentioned Issue is resolved.
The main issue was the order of the fields in the request body.
I was sending this request from postman and it was working fine.
{ "body": {
"distance": 3466567.8,
"latitude": 45.7,
"longitude": 80.7
}}
And when i send this same request from jmeter it was not working fine. i was getting null values in the fields of response body. Then i realized and change the order of fields in the request body as according to my business logic and it works.
{
"body": {
"latitude": 45.7,
"longitude": 80.7,
"distance": 3466567.8
}}
I am writing Integration tests. I have a need where for a positive test case request hit an actual service and recieve the response. But for a negative test case I must get the mocked response.
I am curious to understand if there is a way that I can mock/not-mock the request on a per configuration basis. Like for example if request accepts email address in request and I provide
"invalid#email.com" - response from mockoon must be a mocked response.
"valid#email.com" - mocking must not happen but rather it must hit the actual server to get the response. may be via redirecting or calling the actual service and responding the response to the caller.
I have tried Mockoon but feature is not yet present. So trying to help from the community :)
Regards,
You can use separate stub/mappings that match on different emails.
Assuming that your url is some-Url and uses a queryParameter of email...
{
"request": {
"url": "/some-Url",
"queryParameters": {
"email": {
"equalTo": "invalid#email.com"
}
}
},
"response": {
"status": 200
}
}
{
"request": {
"url": "/some-Url",
"queryParameters": {
"email": {
"equalTo": "valid#email.com"
}
}
},
"response": {
"proxyBaseUrl": "http://my-other-url.com"
}
}
This is possible with mockswitch - it supports various request / response pairs kinda like a switch case. You can define different cases and do request matching based on for each. If one the case matches it breaks the response flow and responds. Also easy to proxy requests to actual service based on certain case.
Their docs is available here https://mockswitch.com/docs/#switch-case-responses
I have developed 4 apis using spring boot. Now i m trying to enable aws lambda for serverless. Is it possible to expose 4 api’s with single lambda.
Is it possible to expose 4 api’s with single lambda.
AWS lambda is FaaS - functions as a service, One function per Lambda.
However you can arguably achieve the intended functionality with a wrapper/proxy function as the entry point and route the request to upstream methods/functions as needed
Its described here aws api gateway & lambda: multiple endpoint/functions vs single endpoint
Take a look at the following documentation on creating an API Gateway => Lambda proxy integration:
http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html
The following is merely a reworded explanation of what's given here aws api gateway & lambda: multiple endpoint/functions vs single endpoint .
AWS example has a good explanation; A Lambda request like the following:
POST /testStage/hello/world?name=me HTTP/1.1
Host: gy415nuibc.execute-api.us-east-1.amazonaws.com
Content-Type: application/json
headerName: headerValue
{
"a": 1
}
Will end up sending the following event data to your AWS Lambda function:
{
"message": "Hello me!",
"input": {
"resource": "/{proxy+}",
"path": "/hello/world",
"httpMethod": "POST",
"headers": {
"Accept": "*/*",
"Accept-Encoding": "gzip, deflate",
"cache-control": "no-cache",
"CloudFront-Forwarded-Proto": "https",
"CloudFront-Is-Desktop-Viewer": "true",
"CloudFront-Is-Mobile-Viewer": "false",
"CloudFront-Is-SmartTV-Viewer": "false",
"CloudFront-Is-Tablet-Viewer": "false",
"CloudFront-Viewer-Country": "US",
"Content-Type": "application/json",
"headerName": "headerValue",
"Host": "gy415nuibc.execute-api.us-east-1.amazonaws.com",
"Postman-Token": "9f583ef0-ed83-4a38-aef3-eb9ce3f7a57f",
"User-Agent": "PostmanRuntime/2.4.5",
"Via": "1.1 d98420743a69852491bbdea73f7680bd.cloudfront.net (CloudFront)",
"X-Amz-Cf-Id": "pn-PWIJc6thYnZm5P0NMgOUglL1DYtl0gdeJky8tqsg8iS_sgsKD1A==",
"X-Forwarded-For": "54.240.196.186, 54.182.214.83",
"X-Forwarded-Port": "443",
"X-Forwarded-Proto": "https"
},
"queryStringParameters": {
"name": "me"
},
"pathParameters": {
"proxy": "hello/world"
},
"stageVariables": {
"stageVariableName": "stageVariableValue"
},
"requestContext": {
"accountId": "12345678912",
"resourceId": "roq9wj",
"stage": "testStage",
"requestId": "deef4878-7910-11e6-8f14-25afc3e9ae33",
"identity": {
"cognitoIdentityPoolId": null,
"accountId": null,
"cognitoIdentityId": null,
"caller": null,
"apiKey": null,
"sourceIp": "192.168.196.186",
"cognitoAuthenticationType": null,
"cognitoAuthenticationProvider": null,
"userArn": null,
"userAgent": "PostmanRuntime/2.4.5",
"user": null
},
"resourcePath": "/{proxy+}",
"httpMethod": "POST",
"apiId": "gy415nuibc"
},
"body": "{\r\n\t\"a\": 1\r\n}",
"isBase64Encoded": false
}
}
Now you have access to all headers, url params, body etc. So you could use that to handle requests differently in your wrapper/proxy Lambda function and route to upstream functions as per your routing needs.
Many people are using this methodology today as opposed to creating lambda function for each method and an api gateway resource.
There are pros and Cons to this approach
Deployment: if each lambda function is discrete then you can deploy them independently, which might reduce the risk from code changes (microservices strategy). Conversely you may find that needing to deploy functions separately adds complexity and is burdensome.
Self Description: API Gateway's interface makes it extremely intuitive to see the layout of your RESTful endpoints -- the nouns and verbs are all visible at a glance. Implementing your own routing could come at the expense of this visibility.
Lambda sizing and limits: If you proxy all -- then you'll wind up needing to choose an instance size, timeout etc. that will accommodate all of your RESTful endpoints. If you create discrete functions then you can more carefully choose the memory footprint, timeout, deadletter behavior etc. that best meets the needs of the specific invocation.
More on Monolithic lambda vs Micro Lambda here : https://hackernoon.com/aws-lambda-should-you-have-few-monolithic-functions-or-many-single-purposed-functions-8c3872d4338f
I have to post json to api_url for login.
{
"username":"testre","password":"password"
}
When I use postman to check this api, it reply successful authentication like below.
{
"status": "success",
"code": 200,
"message": "username, password validated.",
"data": [
{
"password": "password",
"username": "testre"
}
],
"links": [
{
"rel": "self",
"link": "http://localhost:2222/pizza-shefu/api/v1.0/customers/login/"
},
{
"rel": "profile",
"link": "http://localhost:2222/pizza-shefu/api/v1.0/customers/testre"
}
]
}
For an unauthorized json like below.
{
"status": "unauthorized",
"code": 401,
"errorMessage": "HTTP_UNAUTHORIZED",
"description": "credentials provided are not authorized."
}
Previously I code to retrieve it using java. But now I want to refactor it using RestTemplate in spring. The problem is every example I read is written for fixed number of variables https://spring.io/guides/gs/consuming-rest/. Here I get different numbers of variable according to the login success status. I am new to spring so I'm confused in creating the class for login reply which we get from rest template. (Such as this in the example Quote quote = restTemplate.getForObject("http://gturnquist-quoters.cfapps.io/api/random", Quote.class); But I need to return a json object). I couldn't figure out how to write the RestTemplate part.
As suggested by #Andreas:
Add the superset of all fields for all possible responses
Identify the set of fields that are mandatory for every response and make them required
Make the rest of the fields as optional
Upon receveiving a response, check the status code and implement your logic accordingly.
If you are using Jackson for Deserialization, all fields are optional by default (see this question)
Im writing an app for facebook in java.
i have a class named FacebookClient that i got from facebook.
withe this class i can connect to facebook by using
FacebookClient client = new FacebookClient();
client.login(request, response, "api_key", "sec_key");
and get user info with
client.users_getinfo
(For example: client.users_getinfo(String.class, uidJSON, "first_name , last_name , sex , pic_big , pic_small ", "format=json");
the problem is that i need the user profile url and i can't get it!!
does anyone know how to get it (the function or the Query )
Thanks
Check out the Facebook Graph API here
If you make an API call me it will return a large JSON containing various information about you, (or a specified user), and one of the entries is 'link'
Here is a sample call.
https://graph.facebook.com/me?access_token=<the access token>
and the sample return will look like:
{
"id": "01234567",
"name": "Kenny Cason",
"first_name": "Kenny",
"last_name": "Cason",
"link": "http://www.facebook.com/kenny.cason",
"about": "life only comes once",
"birthday": "00/11/2222",
"location": {
"id": "110184922344060",
"name": "Washington, District of Columbia"
},
...
a bunch more info
...
}
You can see the link entry which is a link to my facebook profile. let me know if you need more information.