nonealexq / jmeter-allure-reporting

Make JMeter report in Allure format
Apache License 2.0
30 stars 9 forks source link

Jmeter JSR223 assertion #16

Open ViktorTester opened 4 months ago

ViktorTester commented 4 months ago

@nonealexq Good afternoon, you have written an excellent guide. There is a small question: I have such an idea to put 2 assertions in my request for a response time of 500 and 1500. And if the request exceeds 500, then the test in the allure report receives the status broken, and if it exceeds 1500 (both assertions), then the test gets the status failed. I tried to write the script myself and use the JSR223 assertion, but nothing worked. Can you tell me how this can be achieved? Thank you in advance.

nonealexq commented 4 months ago

@ViktorTester The broken status is not possible in the current version, but we can implement a pattern parameter inside Declare Annotations, for example: allure.status.pattern("~/expexted 1500, but found","broken");

Will it be convenient?

ViktorTester commented 4 months ago

@nonealexq So I put 2 common assertions 500 and 1500 in my request and this string in my allure annotations?

nonealexq commented 4 months ago

Yes, the test will have an allureMainFailReason (it's all step errors in one place). You can use this field to write logic for a new annotation inside Declare Annotation.

You will have allureMainFailReason for ex "Step 1: expected X, but found Y, Step 2: expected L, but found T". And on this line you can create a new rule with the broken pattern like this: allure.status.pattern("~/expected X, but found Y","broken");

ViktorTester commented 4 months ago

@nonealexq I dont get how to make it. When I write this one, I get the mistake: error Can you please have a quick look at my file? I replaced all important variables, but its fully working test, except the allure.status.pattern("~/expected X, but found Y","broken"); test.zip

nonealexq commented 4 months ago

It hasn't been implemented yet. I say that it can be done and suggested one option. If this option is okay, I will do it

ViktorTester commented 4 months ago

@nonealexq I'm sorry. I misunderstood your words. It would be great if such functionality could be implemented. The point is that if requests take, for example, 1.5 seconds, then this is bad, but not critical, and I want to see such requests in some kind of status (not failure, we can take "broken" for example). And if requests take 3 seconds, then this is critical and should receive a status failed. It turns out that if the first assertion works (1.5 seconds), then the status is broken, and if both assertions work (1.5 and 3 seconds), then the status is failed. If you could implement this, it would be very cool. Thank you in advance.

ViktorTester commented 3 months ago

Hello, dear @nonealexq. Is your new feature already implemented? I can help you from the QA side, if needed.

nonealexq commented 3 months ago

Hi, will do until next Monday :)

ViktorTester commented 3 months ago

If you need some help from the QA side, you can count on me=)