You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When putting together this issue #670 I was looking at the test cases and come up with an idea on how the tests cases could potentially be improved. Just an idea or opinion I'm sharing not trying to be critical :-)
A data provider is used for the test case but potentially break the test out and making each test case explicit will help with maintainability.
For example when validation fails and the user is redirected the test case name could be as follows.
testLoginActionInvalidFormRedirectTrue()
The test takes no arguments and its clear what it does.
Another idea might just be to change the test name. I feel with the current test name is not clear as to what its testing. The current data arguments are (true, false) or (true, true) etc but the test name has the words Valid and False in the name. testLoginActionValidFormRedirectFalse($isValid, $wantRedirect). In the scenario I was looking at testLoginActionValidFormRedirectFalse(false, true) is a little confusing.
The test name could perhaps be a bit more abstract. testLoginActionFormAndRedirect or testLoginActionFormStatusRedirectStatus as the arguments then from the data provider (true, true),(true,false) etc make more sense.
Just an idea feel free to close the issue if you think its not worthwhile.
The text was updated successfully, but these errors were encountered:
jeremyquinton
changed the title
Idea around the controller tests thought worth sharing.
Idea around the controller tests for improvement I thought worth sharing.
Jul 9, 2017
When putting together this issue #670 I was looking at the test cases and come up with an idea on how the tests cases could potentially be improved. Just an idea or opinion I'm sharing not trying to be critical :-)
https://github.com/ZF-Commons/ZfcUser/blob/3.x/tests/ZfcUserTest/Controller/UserControllerTest.php#L154
A data provider is used for the test case but potentially break the test out and making each test case explicit will help with maintainability.
For example when validation fails and the user is redirected the test case name could be as follows.
testLoginActionInvalidFormRedirectTrue()
The test takes no arguments and its clear what it does.
Another idea might just be to change the test name. I feel with the current test name is not clear as to what its testing. The current data arguments are (true, false) or (true, true) etc but the test name has the words Valid and False in the name.
testLoginActionValidFormRedirectFalse($isValid, $wantRedirect)
. In the scenario I was looking attestLoginActionValidFormRedirectFalse(false, true)
is a little confusing.The test name could perhaps be a bit more abstract.
testLoginActionFormAndRedirect
ortestLoginActionFormStatusRedirectStatus
as the arguments then from the data provider (true, true),(true,false) etc make more sense.Just an idea feel free to close the issue if you think its not worthwhile.
The text was updated successfully, but these errors were encountered: