简体   繁体   English

如何评估更改对单行代码或变量的影响?

[英]How to evaluate the impact of change for a single line of code or a variable?

During unit testing it is possible to estimate the code coverage to see which share of the code base is covered by the tests.在单元测试期间,可以估计代码覆盖率以查看测试覆盖了代码库的哪些部分。

For one part (the simple calculatable one) of a risk estimation we need to estimate the impact when a single line or a variable changes on the code base.对于风险评估的一个部分(简单的可计算部分),我们需要评估代码库中单行或变量发生变化时的影响。

Eg if a variable changes and a pointer to that variable is passed around or used in several places that would result in a rather "impactful" change.例如,如果一个变量发生变化并且指向该变量的指针在多个地方被传递或使用,这将导致相当“有影响”的变化。

The approach I am looking for is some mixture of introspection and code coverage, but I could not find anything useful so far.我正在寻找的方法是自省和代码覆盖的某种混合,但到目前为止我找不到任何有用的东西。

Sure, small changes can completely break the code while large changes might not have an important impact.当然,小的更改可以完全破坏代码,而大的更改可能不会产生重要影响。 But this is only supposed to be one part of the impact analysis, the other one is done by a reviewer.但这应该只是影响分析的一部分,另一部分是由审阅者完成的。

If such a software or approach does not exist, how is this handled in rather large projects?如果这样的软件或方法不存在,那么在相当大的项目中如何处理? Is is useful at all or would you recommend a different approach?是有用的还是你会推荐不同的方法?

您可能可以使用 console.time 函数来跟踪执行时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM