newman -v):newman run nestedRequests.postman_collection.json -r cli,junitSteps to reproduce the problem:
./newmanDetails:
For a project I have to execute a POST request to queue a job (where I get a UUID as response). Then I have to send a GET request, using the UUID, to retrieve more details on the queued job.
I don't want to copy/paste the same GET request over and over in my collection and therefore I have implemented a nested request within the test script of a folder (and therefore for multiple requests). This works perfectly but when I try to get junit reports via newman, the xml does not include the assertions for nested requests.
The sample collection has two requests:
pm.test() defined as test-script.pm.sendRequest() and a related pm.test() as test-script.@gkaiser85 Thanks for reporting this, I was able to reproduce the described condition with the collection you provided. I'll update this thread when any progress is made. Cheers! 馃槃
Are there any news when this would be fixed? I lost couple of hours finding that my script is correct but junit reporter can`t interpret such request in a correct way.
The true is that the issue is not about nested request. The issue could be easily repeated by using pm.sendRequest in Tests - in that case, junit reporter would ignore the result, even if you have pm.test() somewhere in your test definition.
On top of JUnit not reporting pm.test calls nested inside pm.sendRequest, it also seems to ignore reporting on pm.test in Collection or Folder level scripts on the collection. Rather than have my "test for status 200" script on each individual request I use a Collection level script. Now my JUnit report in Jenkins seems to think there are only 5 tests in the collection, despite the CLI report showing over 100 assertions being tested.
+1 for fixing this issue
Until this is fixed, there is no point in hitting on the same request with multiple test data if you are relying only on junit report ( as that can be accomplished only by doing postman.setNextRequest and then passing the same request name as the argument to it).
and if the second set of data supplied to the request has resulted in failure, the jUnit report will silently ignore it and will not show up, (though the newman cli report/html report will show it up). This is bad.
@joshnorwich
I do not face the issue that you have mentioned above, the tests added at the folder level is being considered in the Junit report as expected.
Newman version used 3.9.6
Thanks
The true is that the issue is not about nested request. The issue could be easily repeated by using pm.sendRequest in Tests - in that case, junit reporter would ignore the result, even if you have pm.test() somewhere in your test definition.
Actually this is exactly the issue. Every request which holds a nested request created with pm.sendRequest fails to output a result. If the nested request is in a folder, every test in the whole folder will end up creating an empty testsuite <testsuite/>. To work around that problem we currently have a dedicated request without nesting, but it messes up our collections pretty much, additionally an entry in the list cannot run on its own now, it has to be executed in the right order eg. request1=open session, request2=read data, request3=close session (request1 and 3 should be in the pre-script/test of a folder above request2).
Most helpful comment
@gkaiser85 Thanks for reporting this, I was able to reproduce the described condition with the collection you provided. I'll update this thread when any progress is made. Cheers! 馃槃