Post-mortem unit testing

前端 未结 4 2147
半阙折子戏
半阙折子戏 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:30

    Use git bisect for this, please see this page.

    Since you're testing JavaScript, you will probably have to run the tests by hand and run git bisect good and git bisect bad as appropriate. However, if you can run your unit test from the command line, then you can use git bisect run to have Git execute the test repeatedly and track down the faulty commit automatically:

    $ git bisect run my-script.sh
    

    That's pure magic the first time you see it! :-)

提交回复
热议问题