Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template strings eg. backticks not supported #60

Open
jjj-holger opened this issue Sep 20, 2021 · 3 comments
Open

Template strings eg. backticks not supported #60

jjj-holger opened this issue Sep 20, 2021 · 3 comments
Labels
bug Something isn't working

Comments

@jjj-holger
Copy link

If Postman test uses template strings like shown below, then these are not parsed correctly because regex used for detecting tests does not take backticks into account.

pm.test(`Should include ${sectorName} in the records list`, function () {
	  const countries = pm.response.json().success.data.countries;
	  const countryUS = countries.find
	    (data => data.name === "United States");
	  const responseSector = countryUS.sectors.find
	    (data => data.name === sectorName);
	  pm.expect(responseSector.name).to.eql(sectorName)
});
@dantench
Copy link

@jjj-holger this looks the same as my issue :) #63

If you take the variable out the name, it might be alright.

@jjj-holger
Copy link
Author

jjj-holger commented Sep 22, 2021

@dantench yeah that's the same underlying reason. I looked into it and found that the launch remains in progress forever due to code line in reporter.js file in the finishStep function:
const currentStepIndex = testObj.steps.findIndex(step => step.name === testAssertion.assertion)
The problem here is that the step name is taken literally from Postman tests using regex, but the assertion which it's compared to is processed by Newman. Which in my case means that the comparison is made between Should include ${sectorName} in the records list and Should include Industrial-sector in the records list.
Meaning that when Postman JS agent tries to send a request to ReportPortal that "hey, that test result you sent previously is PASSED/FAILED" then it can't find any match from the previous test steps it sent before (it needs the stepID from the first request).

TLDR the best solution is to remove the variables for time being; although altering some code lines I was able to fix this permanent in progress issue (this "hack" still has some problems though).

@chivekrodis
Copy link
Contributor

Hello @dantench @jjj-holger
We will investigate this case and make a decision on it.
similar issue #63

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants