VS Load testing: delete file test case - visual-studio

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.

Related

check if file exist on Sharepoint Online by File Name with Power Automate

I am trying to create a flow in Power Automate Cloud that allows me to extract some files from Google Drive and copy them to a Sharepoint folder. But before copying it, it has to check by the file name, that the file does not already exist in the sharepoint folder. I have managed to do the whole flow, except the checking.
I would be very grateful for your help.
Thank you very much. Best regards.
A File exists action doesn't currently exist but you can use the Get file metadata using path action from the SharePoint connector to do the same sort of thing.
This flow below shows you an example of what you can do ...
For demonstration purposes, I've created an array with a list of file names (full path required) that I will then test the existence for.
One of those files doesn't exist.
I then loop through each one of those and try and get the metadata for each file.
If the resulting statusCode from the call to get the metadata is not equal to 200, then we know the file doesn't exist.
Examples ...
To make this work however, you need to make sure that the Condition step will execute after the metadata call no matter what the result.
Do this by making sure the Configure run after settings are correct ...
So after all of that, all you need to do is deal with the true and false sections of the condition.

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

How to simple test the file download and upload?

I have two api for file download and upload. (/static/{filename} api for downloading, /upload api for uploading) For consistency, it need a test file to ensure the functionality of them two. I check the official fs_test.go, but it is too massive to use, is there a trick way to do it?
Do you need a unit test? If you are supposed to test saving the file you can use a brute force.
Create file
Check if it exists (optional: check the file data)
Delete file

Trying to upload more than one file gets an error Jmeter

I have the following request:
this will return the following error:
but, if i remove the second file, leaving only one file, the request performs ok
please advice.
My expectation that this is due to missing Parameter Name value as it correlates with Name is blank error.
Can you try the following:
Copy files you want to upload to the "bin" folder of your JMeter installation
Record your file upload event using HTTP(S) Test Script Recorder
Compare recorded script with the one you are currently have.
Another assumption is that your endpoint doesn't support multiple file uploads so you will have to either to it sequentially or use multiple threads and Synchronizing Timer to do it at the same moment but using different threads (virtual users)

Get XML Reports in TeamCity from Google Test

I am trying to figure out how to run unit tests, using Google Test, and send the results to TeamCity.
I have run my tests, and output the results to an xml, using a command-line argument --gtest_output="xml:test_results.xml".
I am trying to get this xml to be read in TeamCity. I don't see how I can get XML Reports passed to TeamCity during build/run...
Except through XML report Processing:
I added XML Report Processing, added Google Test, then...
it asks me to specify monitoring rules, and I added the path to the xml file... I don't understand what monitoring rules are, or how to create them...
[Still, I can see nowhere in the generated xml, the fact that it intends to talk to TeamCity...]
In the log, I have:
Google Test report watcher
[13:06:03][Google Test report watcher] No reports found for paths:
[13:06:03][Google Test report watcher] C:\path\test_results.xml
[13:06:03]Publishing internal artifacts
And, of course, no report results.
Can anyone please direct me to a proper way to import the xml test results file into TeamCity ? Thank you so much !
Edit: is it possible that XML Report Processing only processes reports that were created during build ? (which Google Test doesn't do?) And is ignoring the previously generated reports, as "out of date", while simply saying that it can't find them - or are in the wrong format, or... however I should read the message above ?
I found a bug report that shows that xml reports that are not generated during the build are ignored, making a newbie like me believe that they may not be generated correctly.
Two simple solutions:
1) Create a post build script
2) Add a build step that calls the command line executable with the command-line argument. Example:
Add build step
Add build feature - XML report processing
I had similar problems getting it to work. This is how I got it working.
When you call your google test executable from the command line, prepend %teamcity.build.checkoutDir% to the name of your xml file to set the path to it like this:
--gtest_output=xml:%teamcity.build.checkoutDir%test_results.xml
Then when configuring your additional build features on the build steps page, add this line to your monitoring rules:
%teamcity.build.checkoutDir%test_results.xml
Now the paths match and are in the build directory.

Resources