A compiler will likely catch most of these errors. The key insight is that, if one assumes that the programmer understands the program in question, the majority of errors made are very likely small transcription errors (a few tokens). Mutation Analysis provides an alternative to a curated set of faults. The mutation score obtained represents the ability of any program analysis tools to prevent faults, and can be used to judge static test suites, test generators such as fuzzers, and also static and symbolic execution frameworks. In this chapter, we see how one can implement Mutation Analysis in Python programs. The proportion of such mutants detected over all valid mutants produced is taken as the mutation score. A test suite is then judged by its capability to detect (and hence prevent) such mutations. So the set of valid tokens different from the original that make it past the compilation stage is considered to be its possible set of mutations that represent the probable faults in the program. Of course, the programmer will correct any mistakes that gets detected by the compilers (or other static analysis tools). ![]() If one assumes that the attention received by each program element in the program is sufficiently similar, one can further assume that each token in the program has a similar probability of being incorrectly transcribed. The insight from Mutation Analysis is to consider the probability of insertion of a bug from the perspective of a programmer. The mutation score thus obtained is a better indicator of the quality of a given test suite than pure coverage. ![]() gcd ( 1, 0 ) = 1 AssertionError - Ran 1 test in 0.000 s FAILED ( failures = 1 ) 1.0 gcd ( 1, 0 ) = 1 AssertionError - Ran 1 test in 0.000 s FAILED ( failures = 1 ) = FAIL : test_simple ( _main_. gcd ( 0, 1 ) = 1 > for mutant in MuProgramAnalyzer ( 'gcd', gcd_src ): > mutant. gcd ( 1, 0 ) = 1 > def test_mirror ( self ): > assert cfg. TestCase ): > def test_simple ( self ): > assert cfg.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |