TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How do you write tests when feature toggles are involved?

3 点作者 tiriplicamihai超过 6 年前
Hey, I am working on an application and I started using feature toggles recently. I&#x27;m not sure how to test my code (both unit and integration&#x2F;service test) for all the states of the toggle.<p>For unit tests I duplicated my test cases and patched the feature toggle checker to return either true or false (depending on the test case). The plan is to remove the test cases for the &quot;off&quot; toggle case when I remove the code. The downside of this approach is that number of test cases grows exponentially with the number of toggles we use.<p>For integration&#x2F;acceptance tests I plan to build a framework to somehow enable&#x2F;disable the toggle for a user (maybe using an HTTP header to override the toggle value).<p>Are you using any other approaches?

暂无评论

暂无评论