Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

ApiDataFactory error handling #4201

Unanswered
jburke-idam asked this question in Q&A
Discussion options

I've just switched our tests over to using ApiDataFactory to create test users. It seems like calls to I.have that result in error responses return a null value, but I would have expected them to fail the test at that point. What actually happens is that the test carries on and I get an unexpected failure later on so the error doesn't make any sense. Obviously I'm not normally expecting error responses while setting up the test data, but this has made tracking down problems while writing the tests a bit tricky (turned out it was password validation that was throwing the 400)

My workaround has been to add a check that the response from I.have actually has a value, but is that the best solution? I tried using I.seeResponseCodeIsSuccessful but that didn't work either.

Or is there a way to have I.have actually fail if it doesn't get a 2xx response?

Thanks,
James

You must be logged in to vote

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet

AltStyle によって変換されたページ (->オリジナル) /