How to record jmeter script with fiddler [duplicate] - json

Has there any option(s) / work around to export fiddler trace files as .jmx files to be imported into JMeter?

Have a look at this:
http://www.perftesting.co.uk/creating-jmeter-test-plans-with-fiddler/2013/03/01/
Another option is to use HAR format (chrome or firefox+firebug+plugin) and use this:
https://blog.flood.io/convert-har-files-to-jmeter-test-plans/
Edit on 25 october 2020:
Since version 5.3 of JMeter, you can use menu Tools > Import from cURL which will allow you to import in JMeter a session exported as a set of cURL commands
See:
https://jmeter.apache.org/usermanual/curl.html#hints

Blazemeter have a free tool where you can convert exported HAR files from fiddler and save them as jmx files.
Worked very good for me.

I've created an extension which can transform HTTP request to any other text format as long as you can create a simple Mustache template for it. Recently I created a template to convert Fiddler Http request to JMeter project i.e. JMX file. It's a basic template but you can customize as per your needs.
https://github.com/hemantsharma-io/MockingBird#convert-a-get-http-request-to-jmx-ie-jmeter-for-perf-testing-in-fiddler

Related

Where the Swagger pretty HTML code?

There are only ugly HTML pages as download (HTML, HTML2 and dynamic all ugly), but the site, eg. edited https://app.swaggerhub.com/apis/{user}/{project}/{version}
(and many others!) offers pretty HTML interface... How to download this pretty HTML?
Complete and autonomous HTML code (file or zip of files).
I have a good and valid swagger.yaml or swagger.json file of my API, so another solution is to run a open sourse (plug and play!) tool with my API-description file.
The pretty:
The ugly:
The "pretty interface" on your screenshot is Swagger UI. It's free and open-source. There's a demo at http://petstore.swagger.io, where you can load your own YAML/JSON files from an URL and see how they would be rendered.
To use Swagger UI locally:
Go to https://github.com/swagger-api/swagger-ui and download the repository as ZIP:
Edit the dist\index.html file and change the line
url: "http://petstore.swagger.io/v2/swagger.json",
to the URL of your Swagger .json or .yaml file, e.g.
url: "http://api.mysite.com/swagger.json",
(Optional) Add/change other configuration parameters in the SwaggerUIBundle initialization code in dist\index.html.
Open the dist\index.html file in your browser to preview your API docs.
Note: If the spec does not load or "try it out" does not work, you probably need to enable CORS on the your server. See https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/cors.md and https://enable-cors.org.
Upload the files from the dist folder somewhere to your server - and now you have pretty API docs too!
Alternatively, SwaggerHub (which you mentioned) provides cloud hosting for Swagger specs among other things, and has Swagger UI integrated. You can import your Swagger .json/.yaml files there and have your API docs hosted on SwaggerHub. A free plan is available.
Thanks to #tleyden at swagger-ui/issues for good clues!
Use the index and assets folder of this project, https://github.com/okfn-brasil/swagger-ui-html

How to download a file in Jmeter with just the original file content?

I'm working on functional testing of a REST API using Jmeter and JSON. I've got file uploading working but I cant seem to get the file downloading to work in jmeter. I'm saving the response as noted in this post: JMeter - File upload and file download scenario
When I do this, I am getting close but not quite exactly what I need. This is and example of what I am getting:
--0rVAdzesdQq7VrwJaRoYGm_UHdMD5nhi9_5w4u
Content-Disposition: form-data; name="api-test"; filename="LIBFILE1.txt"
Content-Type: text/plain
Content-Transfer-Encoding: binary
Library File for Automated Smoke Test
This file is used to test file library upload for automated smoke tests.
--0rVAdzesdQq7VrwJaRoYGm_UHdMD5nhi9_5w4u--
How can I get the download to only save the file contents? In this example, it should only be:
Library File for Automated Smoke Test
This file is used to test file library upload for automated smoke tests.
This is a simple textfile. I would also like to download the other formats that I'm uploading including jpg, png, docx, pdf but it wont be right if it has this extra data coming with it. I figure once I get a simple text file working, it will help me get the more difficult file types.
Well, Save Responses to a file listener will store the data you can observe in the "Response Data" tab of the View Results Tree listener. If you see these Content-Type, Content-Disposition, etc. headers as response data - most probably your upload wasn't successful as you should not be getting the headers this way.
I would recommend double checking that the same request being executed via browser or i.e. Postman tool returns the same response and fix your JMeter script in case of differences.
See Performance Testing: Upload and Download Scenarios with Apache JMeter article for details on how to properly mimic file operations with JMeter.
Alternative way of saving response data into a file is using JSR223 Listener, given you select "groovy" in the language dropdown you should be able to save the response using the following simple script:
new File("/path/to/your/file.txt").setBytes(prev.getResponseData())

How do you create a DAG with JSON in Apache Apex?

I've been trying to find the documentation for populating a DAG instance using JSON. Is there formal documentation to the format somewhere?
JSON application spec is available under http://apex.apache.org/docs/apex/application_development/#json-file-dag-specification
At the current moment JSON application creation is enabled with dtAssemble, a beta feature of DataTorrent RTS. The documentation for using dtAssemble to create JSON apps is available under http://docs.datatorrent.com/dtassemble/
You can experiment with dtAssemble, and inspect the PUT operations of /ws/v2/appPackages/[user]/[package]/[version]/applications/[application] service call to see the JSON structure generated for the application you're building. You can also download the application package where the app is being saved, unzip it, and inspect app/*.json files added there.

MarkLogic Java API batch upload files (.csv)

Im trying out the MarkLogic Java API and would want to bulk upload some files with the extension .csv
I'm not sure what to use, since the Java API only supports JSON, XML, and TXT files.
How do I batch upload files using the MarkLogic Java api? Do i convert everything to JSON?
Do i convert everything to JSON?
Yes, that is a common way to do it.
If you would like additional examples of how you can wrangle CSV with the Java Client API, check out OpenCSVBatcherExample and JacksonDatabindTest.testDatabindingThirdPartyPojoWithMixinAnnotations. The first demonstrates converting the csv to XML and using a custom REST extension. The second example (well, unit test...) demonstrates converting the csv to JSON and using the batch upload (Bulk Writes) capabilities Justin linked to.
If you have CSV files on your filesystem, I’d start with mlcp, as suggested above. It will handle all of the parsing and splitting into multiple transactions/batches for you. Take a look at the mlcp documentation for more details and some example configurations.
If you’d like more control over the parsing and splitting logic than mlcp gives you out-of-the-box or you’re getting CSV from some other source (i.e. not files on the filesystem), you can use the Java Client API. The Java Client API allows you to efficiently write batches using a WriteSet. Take a look at the “Bulk Writes” example.
According to your reply to Justin, you cannot use MLCP because it is command line and you need to integrate it into a web portal.
Well, MLCP is released as open cource software under the Apache2 licence. So if you are happy with this licence, then you have the source to integrate.
But what I see as your main problem statement is more specific:
How can I create miltiple XML OR JSON documents from a CSV file [allowing the use of the java API to then upload them as documents in MarkLogic]
With that specific problem statement:
1) have a look at SplitDelimitedTextReader.java from the mlcp source
2) try some java libraries for this purpose such as http://jsefa.sourceforge.net/quick-tutorial.html

Convert Swagger JSON to RAML/YAML

How do I convert Swagger JSON to RAML/YAML and validate it? I am not looking for a programmatic way, just a one off conversion.
Here are the steps:
Export Swagger JSON into a file on your drive. This JSON should be published on your server at the following URI: /swagger/docs/v1
Go to http://editor.swagger.io/#/
On the top left corner, select File-> Import File... Point to the local Swagger JSON file you exported in step #1 to open in the Swagger Editor
Select Generate Client -> Swagger YAML option from the menu
It will generate the YAML that you can validate at http://www.yamllint.com/ site
To convert API spec between various formats (e.g. Swagger/OpenAPI, RAML, Postman, etc), you can use the following free and open source tools:
https://github.com/lucybot/api-spec-converter
https://github.com/stoplightio/api-spec-converter
Its actually pretty simple
Web version of swagger editor gives the flexibility to import your existing swagger file(JSON/YAML) and download the configuration file that is currently being shown. So just combine these two.
Note: Converting JSON to YAML exists, but not JSON to RAML
First import your swagger JSON at http://editor.swagger.io/#/ (File > Import File)
Once you see your configurations, just download the corresponding YAML version (File > Download YAML).
The YAML version of the JSON you just uploaded will be downloaded.
Conversion
If you are looking to convert from any version Swagger to RAML 0.8 then APITransformer.com can do it for you. We're almost done with RAML 1.0 export. Will release it in a week's time.
Validation
The converted description comes out of the same code-gen engine that APIMatic uses to validate an API description before generating SDKs/Client libraries. Therefore, the converted RAML will be validated by default.
API descriptions in a variety of formats can also be validated via APIMatic's CLI or APIMatic's API
While I wish there was a command line tool, this company has made a converter it seems:
https://apitransformer.com/