What is the best practice to follow to create the directory structure for unit tests when using AngularJS for e.g. in general following struct
As mentioned in the link https://scotch.io/tutorials/angularjs-best-practices-directory-structure
What should be the structure to place the unit test files in...if it's an MVC Visual Studio project, should it be in the separate unit test project?
Putting them side-by-side with the file under test seems to be recommended.
For example:
folder/
file.js
file.spec.js
otherfile.js
otherfile.spec.js
This recommendation comes from a very good style guide found here: https://github.com/johnpapa/angular-styleguide#style-y197
According to the Google Best practice which has similar grouping by component you would have the tests in the same folder as the item under test. To keep the same naming convention you would name the tests like homeControllerTest.js or you could use homeController_test.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With