Closed motobeerx closed 2 years ago
@motobeerx Simple workaround is to have each and every request in folders, not at collection level. Fixing this issue would be fairly simple, though, since the single request only need to be interpreted directly instead of being picked up by the for request in fol['item']:
.
Can you explain why this issue was closed? I don't see any relevant changed and there is another open issue that seems to be exactly the same problem.
Package name: example Link to PyPI page: https://pypi.org/project/postpy2/ Link to piwheels page: https://www.piwheels.org/project/postpy2/ Version: 0.0.6 Python version: 3.8 I am the maintainer: No More information: At using postpy2 library for working with postman, importing collection error during parsing. It simple try to get the key which does not exist. I tried to debug a little bit no success, everything is connected and I face keyerror on every step.
via pycharm I tried to run this code
from postpy2.core import PostPython runner = PostPython(r"D:\Tamm\microservice-test-automation\adp\ADP.postman_collection.json") runner.environments.load(r"D:\Tamm\microservice-test-automation\staging.postman_environment.json") runner.help() response = runner.aadc.health_pass() print(response.json()) print(response.status_code)
the happens on 39 line. the fol['item'] is a list of dictionaries, and the key error happens because of : In: for x in self.__postman_collection['item']: print(x.keys())
Out: dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'item', 'event', 'protocolProfileBehavior']) dict_keys(['name', 'event', 'request', 'response']) the last dictionary doesn't have key 'item'
So is there any workaround/solution ? here's the structure of my postman collection:
And the final thing I'd like to mention is that I suppose it happens because this little guy /health - pass GET request. P.S. 1) Can this library read the global environments variables from file? 2) Can this library provide json-reports for collection run?