i have a doubt about the tests in drf, did you use the test drf or postman?
or maybe you do both because in postman you create the documentation and and you can do a constant monitoring, what thing do you recommend me?
Use postman or other tool to check how your api is working and then make the tests. Tests are always good as if you change a code related to certain test you can immediately perform the test and check how it behaves.
Related
I am implementing load testing in Jmeter for my web application which uses google oauth.
I have generated access token and refresh token and passed it to my HTTP request, but the request fails with an Invalid state parameter.
I checked various posts on passing a random string of 30 characters but the value is not being recognised.
I am not sure how to use the google API library for python to generate one as there is only snippet available in the official site and am quite unsure if that value will be recognised.
Any suggestions on how to achieve my usecase?
We are not telepathic enough to guess how exactly you "generated" the tokens and how they're "passed to your HTTP request"
My expectation is that you need to pass only one token: the "access" one "to your HTTP Request", refresh token can be exchanged for the new access token when the previous one expires. Passing 2 tokens doesn't make sense and may cause the problem you're facing.
As per the main page of JMeter project
The Apache JMeter™ application is open source software, a 100% pure Java application designed to load test functional behavior and measure performance. It was originally designed for testing Web Applications but has since expanded to other test functions.
hence you cannot use Python libraries directly in JMeter, either look for a Java library, I think this one is a good choice and use it from JSR223 Test Elements
If you still want (or have to) use Python - you can run Python scripts from JMeter using OS Process Sampler
I am trying to run performance test using Jmeter for my client application which uses Signicat, a third part identity verification site for SSO login. I cannot get through with jmeter execution for login. There is a dynamic token appended in one of the http requests related to login but I cannot find it in any of the previous responses to correlate.
Has anybody tried Performance tests with Signicat or any other SSO login ? I appreciate any suggestions or leads. Thank you.
PS: I tried to monitor the traffic in fiddler while accessing the site . I don't see the token source there as well.
Unfortunately your question doesn't contain sufficient level of details.
If you're seeing the dynamic token there are following possible options:
It needs to be correlated (extracted from the previous response), the possible sources are:
URL (as a part of a redirect)
response headers
response body
It needs to be generated, if the dynamic value is being generated by client-side JavaScript JMeter won't be able to execute the JavaScript, you will have to replicate the code using JSR223 PreProcessor and preferably Groovy as the language in order to generate the same value as the real browser does
Looking into Connecting your application chapter there are several possible protocols/options and it will require rather a story than a chapter to provide comprehensive instructions on each of them:
for some of them like "Other third party software" it is not even possible doing this remotely without knowing the infrastructure and the authentication/authorization processes.
I created a REST API with Spring and want to test it. I saw WireMock but I dont really know how this library can help me. Can I use it to test my Rest API or ist it to mock another API my API uses, so that I can ensure that a mistake is coming from my Service?
What exactly do you mean by "want to test it"? How would you be "testing" your API? What would a pass/failure look like?
WireMock is a mock server service. It acts as an API that can feed in responses that you have defined (or even proxy an existing API and feed in responses it gets from there.) I usually use it in place of an unreliable API, to act as the back end for the app that I am using.
If you are looking for a library that you can use to ping your API, I've had success using REST-Assured. If you are looking for a program you can use to ping your API, Postman is my app of choice.
I am upgrading our implementation of AWS to V2. I would like to create an AWS client object in my tests, whose web requests are stubbed. The problem I have is getting this test client to correspond to the real client, such that I can test methods that may be called on the client in the code.
My test suite is RSpec. To give you an illustration of the problem:
aws_client = Aws::DynamoDB::Client.new(stub_responses: true)
is its own object. If created in the test, it won't correspond to the client in the code as an instance_double would:
let(:client) { instance_double(Aws::DynamoDB::Client) }
before do
allow(Aws::DynamoDB::Client).to receive(:new).and_return(client)
allow(client).to receive(<some_method>).with(<some parameters>)...
end
You can see that "client" is being used to test whether the code is communicating with the API in the desired way. The test depends on whether the code uses the correct methods with the correct parameters.
How can I get an object like aws_client (as opposed to an instance double) to correspond to client so there are no unauthorized calls to the API, and so I can test the methods that are called on the client in the code?
When I tried to globally or partially stub the AWS config responses in the spec_helper or the test file (Aws.config[:stub_responses] = true), I still see unauthorized API requests.
You may look at https://relishapp.com/rspec/rspec-mocks/docs/working-with-legacy-code/message-chains
(receive_message_chain)
allow(double).to receive_message_chain(:foo, :bar).and_return(:baz)
I am writing an app that access a local that lives on a separate path on my own server via ajax requests. However, I want to test the app with cucumber and mock out the backend. Is there something like artiface or sham_rack that would let me do this?
I'd recommend using VCR:
http://relishapp.com/myronmarston/vcr
It allows you to record the requests to the external service once, and then play back the recorded responses when running your tests.
I use MockJson to simulate the response:
MockJson website
How about something like http://fakeweb.rubyforge.org/?