kiranz / just-api

:boom: Test REST, GraphQL APIs
https://kiranz.github.io/just-api/
MIT License
813 stars 35 forks source link

Difference in execution plan depending on how spec is called? #27

Closed humbienri closed 4 years ago

humbienri commented 4 years ago

Hello,

I am struggling to use just-api for more advanced requests and workflows. Surely I don't understand fully how to use it. Is a spec, or a test, run differently depending on whether the spect itself is being run directly, i.e. it is the spec of interest, versus when said spec is being called from another spec in a different suite, or even if the spec is in the same suite but is a different spec?

If a spec A that has a before_test hook gets called from another spec B in the same suite, does the before_test hook of spec A also get executed? Or are test-context hooks only exercised when the spec/test itself that the hook pertains to gets executed itself?

Please advise...I have been beating my head at this for numerous hours. It's been slooow progress :)

Thanks!

humbienri commented 4 years ago

Hmn, I found this: https://github.com/kiranz/just-api/issues/19

I think this should be explained as part of your main README or in a more obvious place in the documentation. The issue above kind of dictates to use hooks a bit more sparingly IMHO.

humbienri commented 4 years ago

I now see that usage of dependency specs via runSpec doesn't fully exercise the spec since hooks are left out of execution.