Where should I put my test code in relation to the code that it is testing?

Two obvious places that I can think of would be a kind of "test" folder next to the code I'm working on. So something like:

\project-code
    \my-feature
        \production-code
        \testing
            ***my tests***
    \co-workers-feature
        \production-code
        \testing

Or I could split the testing code into a completely separate hierarchy. So something like:

\project-code
    \my-feature
    \co-workers-feature
\testing-project-code
    \my-feature
        ***my tests***
    \co-workers-feature

I saw that many frameworks use the second approach, but lately we are most likely adding our test code to the production code for convenience. Is one approach much better than the other, or is there best practice here?

+3
source share
5 answers

. , , . , , , .

:

?

+1

, . , . - " ". , , .

+2

. 1. , , , , . , , . , . , .

, make, . . , .

+1

-, , . , , , , 2, .

0

, SCM: ( ), , , , ( ).

0

Source: https://habr.com/ru/post/1725311/


All Articles