Post-mortem unit testing

前端 未结 4 2151
半阙折子戏
半阙折子戏 2021-02-20 03:14

I do version control with Git, and unit testing with QUnit. Sometimes I find a bug in my software that was not present in a past version. It\'s easy for me to write a unit test

4条回答
  •  一个人的身影
    2021-02-20 03:34

    Yes, this is called git bisect, and was first introduced in git.

    Principle:

    • grab a commit in the past where you know it worked, let's call it c1;
    • grab a commit after c1 you know fails, call it c2;
    • git bisect start c2 c1.

    You can even restrict the bisect to subpaths if you know where it fails, and if you have a script which can run the test non interactively, use git bisect run.

提交回复
热议问题