I have my folder structured like:
backend
|-Process1
|-Process2
|-app
|-config
|-controllers
|-models
public
|-css
|-js
Where should I put my unit tests folder?
Test driven development(TDD) is an iterate process that begins with writing a test code for an application or function before starting out to write the application. The next steps entails writing and refactoring the application until it passes the test code.
The tools (or frameworks) used in TDD involve JUnit, TestNG, NUnit, etc. These are used to run test cases. Gherkin is used for writing scenarios in BDD. Cucumber, SpecFlow, etc., are some of the widely used test automation frameworks.
One Functionality, One Test: TDD is a form of Unit Test. The driven in the TDD means that to write code, you need to write the test first. And the best way to do is by focussing on only single functionality. Create a test that focuses on only one cause but sometimes one test is not enough.
For node projects, it's common to have a tests folder in the top level. For example, for my projects I usually have these folders:
bin
(for bins)lib
(for my node.js library files)test
(for tests)config
(for config files, if necessary)public
or static
(for static assets, if necessary)node_modules
(where npm-installed modules end up going)For the most part it's not too critical how you organize the code as long as it's organized and has obvious entry points. Basically, you should be able to type "npm test" and have it work by reading the command from the package.json.
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