config.properties file with multiple urls - maven

I have a configuration file with multiple url's and needs to be sent depending on test scenario.
But in one scenario the url is being sent and in another it is not. Please suggest the change
Tried modifying the names , loops but could not find the correct solution.
the TPurl property is being returned as null either while running as testNG suite or as an individual test.

Related

Use envars on swagger for dynamic configuration

this may be trivial question, but I am having problems understanding server variables and how to modify them on swagger.
My objective is to create a server using the specs below (5G 3gpp definitions for of its interfaces).
https://www.3gpp.org/ftp/Specs/archive/OpenAPI/Rel-16/TS29122_PfdManagement.yaml.
As you can see at the top of this file we have a server variable called apiRoot which defines the root of the url of the server. That is set up to default value of example.com. That url will later be used by swagger-ui to provide a graphic interface to the API.
servers:
- url: '{apiRoot}/nnef-eventexposure/v1'
variables:
apiRoot:
default: https://example.com
description: apiRoot as defined in clause 4.4 of 3GPP TS 29.501
I am trying to generate the server with the swagger-codegen which generates a consolidated file with all the elements this spec needs (since the original yaml file contains references to other files)
swagger-codegen generate -i https://www.3gpp.org/ftp/Specs/archive/OpenAPI/Rel-16/TS29122_PfdManagement.yaml -l go-server -o server
The problem is the file embeds the default value. So I can not use that file on multiple hosts.
Is there any way to modify variable apiRoot when executing swagger-codegen? Or even better, is there any way to change the value of the default using some kind of envar? Or is there any way to pass swagger the value of apiRoot
The idea is we can use the same specs in different servers without having to modify the original spec file or the generated one. The problem with modifying the yaml files is that there will be more versions comming from 3gpp which will include apiRoot variable, so we don't wang to keep modifying every single time. We would like to overwrite it somehow on runtime.

JMeter Query - Different User use different file locations for same HTTP Request

Suppose a total of 50 users and one HTTP request/sampler were created so in that case we provide one input file when run Api then all 50 users use the same input files (same input file location )and some requests failed.
We want to make ideas or scripts for users to use different file locations so not chance to fail request or file not found exception.
You can parameterize the file name/location just like any other request parameter, username, etc.
The configuration element which is most frequently user for parameterization is CSV Data Set Config.
However if you don't want to manually manage the file content and protect yourself from "file not founds" it makes sense to consider going for Directory Listing Config plugin which reads the files in the given folder and stores them into a JMeter Variable so each thread/iteration will pick the next file from the pool.
You can install Directory Listing Config plugin using JMeter Plugins Manager

delete uploaded file from folder using JMeter

I am sending a HTTP request to upload a file. And the request is setup like this:
uploadFile
And, the Directory Listing plugin pointing to a directory with all files and the request picks one file at a time. It works fine when run with one thread but, when i run in multiple threads, i see that already uploaded file is picked again to upload which leads to error.
I have added regular expression extrator to get the filename from the request body like this:
extract-filename-from-requestbody
And then, I am trying to use a post processor beanshell script to either delete the file from the folder or move to a different folder. But, not been successful. Need some help on this.
The first issue is i am not sure if i am extracting the value the right way. The value is to be got from request body and not request header. But, i dont see that option in the extractor.
Second, i am unable to use/retrieve the value from the extractor. Tried vars.get, vars.getObject and simply "${fileName}". Nothing works.
I don't think that deleting the file will help because Directory Listing Config reads the folder at the beginning of the test (see Execution Order chapter) so no matter whether the file is physically present or not JMeter will try to upload it
If you want to get unique files without repetitions just untick "Rewind on end of list" box:
This way each virtual user will read the next value so there will be no duplicates. When the last file will be used - the test will stop.
More information: Introducing the Directory Listing Config Plugin on JMeter
Also going forward consider using JSR223 Test Elements and Groovy language instead of Beanshell, it's the recommended option since JMeter 3.1

Error while executing checkout script in JMeter

[404-Not found]
Hello All,
I'm running one script having Checkout functionality but my script gets fail at particular page instance giving me "404 - Not found" error in logs.
But while executing manually I'm able to go to the page successfully.Below is the error message. Do i need to pass cookies in the same while execution.
Any help will be appreciated
Most likely this is due to missing or not properly working correlation. You can record the test scenario using HTTP(S) Test Script Recorder but it will be only a "skeleton" of the test containing hard-coded values like IDs or URLs or whatever.
So given you checked something out and recorded the relevant request(s) next time you will try to replay the recorded script you will get an error as the item has already been checked out, so basically you need to find another one to work with.
Normally the situation is worked around as follows:
Record the test 2 times
Identify request parameters which are changing
Using JMeter PostProcessors (the most commonly used is Regular Expression Extractor, however it may vary depending on your response data nature) convert hard-coded recorded values into JMeter Variables
Use Debug Sampler and View Results Tree listener combination to inspect:
JMeter Variables values
Request details
Server responses

VS Load testing: delete file test case

I am testing my share point site by uploading/downloading/deleting files using webtest in Visual Studio Ulitmate.
The upload and download file test cases are working as expected.
But the delete file test cases are not working and getting test case failed error.
Even I tried upload and delete file in same test cases also, but this test case also failed.
Kindly assist how to perform delete file test case in VS Load test.
Regards,
David.
Load testing is all about replaying the same scenario multiple times. Note the difference between file upload, download and delete test cases. You can upload a file and download the same file multiple times. However you cannot just delete the same file multiple times.
The problem with the delete test case is likely caused by your script trying to delete the same file multiple times which is causing a SharePoint error.
If this is the case, to fix your script you need to correlate the identifier of the file you're trying to delete.
Currently the request that triggers file delete transaction, contains a constant identifier of the file that you deleted during recording. You need to replace it with an extractor of the file identifier which you will delete during the test execution. For example, if you record a test scenario where you delete the top file on the webpage list, you need to create an extractor from this webpage's response that retrieves the top file identifier. Then use it in the subsequent request that deletes the file.
It looks like Visual Studio did not auto-correlate this test case, so you have to do it manually.
Keep in mind that the "identifier" here can be more than just a single id. It depends on your SharePoint version and some configuration settings.
If you cannot figure out how to find a file identifier in the response, or how to extract it, here's a hint: our load testing tool StresStimulus auto correlates SharePoint. Download it, record the delete file test case and examine the parameter used in file-delete request and what extractor it uses.
After that recreate them in VS.

Resources