HTTP headers and custom data added in Custom Asserters not cleaned up
See original GitHub issueDescribe the bug
I use Custom Asserter to add a header/custom data to an HTTP Request for some tests. I use AssertConvoBegin
to attach it and AssertConvoEnd
to remove it after the test. The problem is that if a test fails then AssertConvoEnd
method isn’t triggered and the header/data isn’t removed - it is persistent in next convo tests and it makes them fail, because the handler method depends on the existence of this particular header/data.
To Reproduce
It’s easier to show it.
Expected behavior I expect the header/data to be removed even if the test fails. Maybe you have a different idea how to attach custom headers/data to some tests? Only to some, I don’t want them in all tests (I set the header Authorization in requestHook.js), but this is the only thing I want in all tests!
Botium Flavour:
- Botium Box not used
- Botium CLI not used
- Botium Bindings 2.0.16
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (3 by maintainers)
everything is solved. thanks for helping. just one additional thing I changed. using
container.pluginInstance.view.context.location
instead ofcontainer.pluginInstance.view.location
so I have all the additional fields added on thecontext
object. a lil bit cleaner imorequestHook.js
ah, ok. thanks for the snippet. I had LOGIC_HOOKS as a field under $.botium and not $.botium.capabilities. it works! but now I would have to convert SIMPLEREST_BODY_TEMPLATE and SIMPLEREST_HEADERS_TEMPLATE values to strings instead of objects (objects look cleaner in botium.json config) and use moustache templating.
is it possible to put the { lat, long } object somewhere so I can add the location field in requestHook? yes, there is. anything you add on container.pluginInstance.view object is added to an argument that is passed to requestHook function