7

Given a simple application diagram how would you test it or what will be your test plan or test strategy. The only answer to a question like this is: "There is no such thing as 'go there and test'". Testing is performing a risk investigation activity. Any investigation has goals and questions to be answered. So, what type of testing one usually do ...


3

Json won't support multiline string, so you have to stringify free text before sending, (meaning convert space, tab etc to equivalent escape characters like \n, \t etc) You can use the below site to stringify text to JSON string: https://onlinetexttools.com/json-stringify-text You can use below online website for character count: https://charactercounttool....


3

Try the petstore - it's a common API used in examples. I used it when working with JMeter and it's a useful API to practice with. https://petstore3.swagger.io/ You can do all sorts of different things there.


3

That's a broad question. I recommend taking one or two resources and start exploring from there. You can find some ideas about API testing here and specifically if you ask about security, you can focus on OWASP API security In general, some ideas relating to security: authentication: what endpoints could be used only when authenticated? are there some that ...


3

Testing APIs is potentially endless, just like almost anything in testing. I recommend focusing on one area rather than drowning yourself in something completely new. That would be a recipe for failure. If you're completely new to the world of APIs, I recommend installing Postman (or any other client) and playing around with some endpoints for a bit. No need ...


2

Just to add one more explanation. In REST API, the / indicates a hierarchical relationship between resources. This one rule is already broken when you send a POST req to /api/v1/product/2 and 2 means a category id. Category is not hierarchically under products. In this example, what category a product belongs to should go into the request body: { ...


2

As QA you are correctly getting a weird feeling. REST aims to do CRUD on resources in a standardized way. By adhering to that standard, you decrease the mental load on the next developer trying to figure out how the application works. Making exceptions to the standard would increase technical debt. So this issue needs to be addressed and if the one person ...


2

If you want to go for the CSV file you can use the following __groovy() function: ${__groovy(new File('/path/to/your/file.csv').readLines().get(ctx.getThreadNum()),)} for 1st thread it will return 1st row from csv for 2nd thread it will return 2nd row etc. It might be better/easier to use Inter-Thread Communication Plugin which can pass data between ...


2

TL;DR: Jenkins supports pipelines from code. Make your build, test and deploy pipeline in code and you are not dependent on a specific CD tool. If you can do it from the command line and with API's you can combine and chain any tool or test-step. Use Pipelines as Code! Is it possible to automate this complete process? Probably, but not out of the box with ...


2

If you need to unzip some files and don't want JMeter to measure this time there are multiple workarounds for this: Use setUp Thread Group to prepare test data Use i.e. PreProcessors to prepare test data, JMeter doesn't include the time taken by Pre/Post Processors, Timers and Assertions into the sample result unless you have Transaction Controller ...


2

The file path should be relative to class path , try statusCode(200).and().body(matchesJsonSchemaInClasspath("\\test\\java\\com\\rest\\api\\schema\\getuserschema.json")); or statusCode(200).and().body(matchesJsonSchemaInClasspath(".\\test\\java\\com\\rest\\api\\schema\\getuserschema.json")); or statusCode(200).and().body(...


2

make sure you are importing org.testng.annotations.Test and not org.junit.Test


2

Given you will be using Taurus to run existing .jmx files you can also specify existing JMeter installation with all .properties files you want to use, they will be picked up. If you want to just pass some properties to JMeter script from Taurus you can either use properties section in YAML or pass them via -o command line argument According to Pass/Fail ...


2

Restful-Booker is purpose made for learning to test an API. You can either use the online version, or you can check out the repo and run it locally if you prefer. I think it's a pretty useful site to practice with, and it does seem to be actively maintained - the author has written a couple of courses on API testing which are pretty useful (linked from the ...


2

According to JMeter Test Elements execution order listeners are being executed after post processors and your prev.setIgnore() instruction prevents passing the sample result to the listeners. One of possible options is writing the response data into a file in the JSR223 Post Processor itself, the relevant code would be something like: new File('/path/to/your/...


2

The answer depends on many other factors including the infrastructure. Even POST requests can create unwanted changes in production DB so GET is mostly the only safe method, investigate if this is the case for your product. Do you have a staging server where you do rest of the use cases (if you plan to use only POST and GET in production) What is your team ...


2

I need to check if the “dna” contains at least 10 “Ngg” sites. That means if there are a minimum of 10 [acgt]gg sites (agg or cgg or tgg or ggg). How do I write a test for that? You need to first find all such occurences: resultArray = [...dna.matchAll(/[acgt]gg/g)] then you need to assert the length: pm.test('Number of occurences if equal or greater than ...


2

I need to check if the “dna” contains at least 10 “Ngg” sites. That means if there are a minimum of 10 [acgt]gg sites (agg or cgg or tgg or ggg). How do I write a test for that? pm.test('length validation', function () { pm.expect((pm.response.json().dna.match(/[acgt]gg/g) || []).length).to.be.greaterThan(10) }); Is the following test for validating ...


1

Parallel test are dangerous when you don't think of state of system while executing test . You are testing the same system in parallel,so one test can affect other test For example , you have one suite that test delete user feature and suite that test create user feature. In delete user , you deletes all users and validates the user list to be empty. This ...


1

On JMeter level it would be something like: Add tearDown Thread Group to your Test Plan Add JSR223 Sampler to the tearDown Thread Group and put the following code into "Script" area: def start = vars.get('TESTSTART.MS') as long def end = System.currentTimeMillis() if ((end - start) > 5000) { SampleResult.setSuccessful(false) ...


1

It is possible to "ignore" them on JMeter level, just add JSR223 PostProcessor as the child of the request(s) you want to ignore or if you want to ignore the whole Thread Group - put it at the same level as Samplers (see JMeter Scoping Rules for more details) Use the following code to discard the sample result: prev.setIgnore() where prev is the ...


1

Add the next line to user.properties file: sample_variables=phone Restart JMeter to pick up the change Instead of ${phone} in the Flexible File Writer use variable#0 If you need to write more than one variable: sample_variables=phone,device_id and then in the Flexible File Writer: variable#0 - instead of ${phone} variable#1 - instead of ${device_id} ...


1

You cannot, as per Execution Order chapter of JMeter documentation Configuration Elements are executed before anything else so being a configuration element CSV Data Set Config is being run before your code which modifies its path. The only way to use dynamic paths to CSV files is using __CSVRead() function, check out How to Pick Different CSV Files at ...


1

This and this GitHub repositories provide a curated list of service projects, many open source, and buildable by running a couple of Docker commands. You may also want to visit this site. As an example of a simple API from a "real site" is Trello. I've written a blog post showing a CRUD cycle in it for Postman. Nonetheless, it's direct to ...


1

Can you set up env params and then use those to control which apis your app talks to? You could use that to easily set development, test and production api addresses.


1

If you accept mocking with other packages than Postman, then I suggest using MockServer or WireMock, both having support for describing matching rules in Java and JSON. For instance, with WireMock you can match HTTP Request by URL and query string as follows: Regex matching on path and query Java: urlMatching("/your/([a-z]*)\\?and=query") JSON: { ...


1

According to Postman docs: If there is no exact match found, Postman will return the best matching response based on its algorithm. I have tested the mock server and it does work with query parameters, however the algorithm points to a default value when you do not mock the parameter. In my case: ?id=1 points to 200 with ok page ?id=2 points to 404 with ...


1

We have a good experience with json-server. We found it really flexible. Get a full fake REST API with zero coding in less than 30 seconds (seriously) Created with <3 for front-end developers who need a quick back-end for prototyping and mocking. https://github.com/typicode/json-server It can server from static json files, where each ID returns a ...


1

You can path your environmentA.properties or whatever else properties file you want to use to JMeter via -p or -q command-line arguments Non-GUI mode: jmeter -q environmentA.properties -n -t test.jmx -l result.jtl GUI mode: jmeter -q environmentA.properties in this case JMeter GUI will open and all the properties defined in the environmentA.properties ...


1

I'd also take into account how much code the "creating new user" part is. In pytest/Python, it really boils down to just one line of code, something like: response = requests.post(f"{Config.base_url()}/create_user", headers=headers, json=user_body) So the question is whether or not it's worth it creating a new fixture for only one line ...


Only top voted, non community-wiki answers of a minimum length are eligible