Unit-testing – Should unit tests run on every git branch

continuous integrationgitunit testing

I am new to repo management / continuous integration.

I designed a repo in the following way

PROJ
 |-src
 |-include
 |-lib
 |-config
PROJ_Unit_Tests
 |-src
 |-config
PROJ_Doc

When I now do continuous integration, i.e., running unit test on the build server, should they run on every branch or only on the develop branch?

If they only run on the develop branch and a feature branch going on for long, I am afraid that the developer is pushing changes to his feature branch which would actually fail the build. On the other hand, if a feature branch deactivates functionality of the develop branch, then the programmer has to manually disable to corresponding unit tests.

Best Answer

Run your unit tests on every branch. How do you know your code is actually working as expected otherwise? This goes the same for any other tests you may have.

You say it yourself right here, "If they only run on the develop branch and a feature branch going on for long, I am afraid that the developer is pushing changes to his feature branch which would actually fail the build".

The latter problem you're hinting at is up to the developer to address. It is their responsibility to update the tests alongside the features they are developing.

On top of all that, investing in actual continuous integration, as suggested by your reference model, will alleviate some of the pain of feature branches straying to far from the development branch or other feature branches.

Related Topic