Welcome Guest, Not a member yet? Register   Sign In
Unit testing - fix bugs which I think are imposible to happen in reality?
#1

[eluser]SPeed_FANat1c[/eluser]
hello,

lets say I have function which inserts row. But one of the fields is lets say clients_id. I cannot insert that row if clients_id is not in another table (foreign key does not exist), then database throws error.

So my unit test will get errors with wrong client id.

But actually I see in my application that it is imposible situation because, cliens_id is taken from session, and if session is gone, then page will be redirected to login page, so no insert will be made anyway.

So now the question - what in your opinion is best practice - to fix still that error, or not even test that insert function if I see its imposible that wrong client_id is passed?





Theme © iAndrew 2016 - Forum software by © MyBB