Continuous Delivery - Part 3 - Feature Toggles
Cleaning feature toggles
Feature Toggles should not exist forever in your code. After a feature is opened and you decide there is no need to change the toggle back to inactive, developers should go back to the code and remove the "if" statement from the code, cleaning it from unnecessary if statements and unused toggles. A Feature toggle manager can help you with that since it shows you all the features and how long they are active. Also you can do a quick search in the code to find the places feature toggles are used.
Testing with feature toggles
Testing features can be a challenge. Remember, doing Continuous Delivery means that you have to work using Test Driven Development. Usually with unit test you would not have any problems, because you test the actual methods, and in most cases bypassing the feature toggle flow management. However when you write your integration tests you may have a problem, since you are testing end to end flows and have to pass through the Feature Toggle "if" statement, when it is both "closed", to test regression, and "open" to test the new feature flow.
This is another case where Feature Toggle Manager can help you. In your tests during setup you can set the values in the Feature Toggle Manager to whatever flow you are testing. Since Feature Toggles always have default values (that are usually off) all the old tests should work as before, since you do not change the old behavior. However when you write integration tests for the new feature you need to set the feature toggle to "on" during your test setup and thus enable the flow go through the new feature and test that too.
Read full article from Continuous Delivery - Part 3 - Feature Toggles
No comments:
Post a Comment