Any advice for Testing?

3 topics about testing that really bother me:

Is there a way to run the (python)code in DebugMode
Is it possible to run unit Tests involving the enjine.jar (to validate simulations)
What is the best way to analize the code for speed/performance with real data.

I have some unit tests for functionas , and actively use the script/test_algo_os with replays and a lot of debug prints, … but there realy should be a better way

  1. It is possible to use debuggers for python code. For example PyCharm has convinient built-in debugger. It allows you to examine values of variables during execution of code.

    Also there is extremely usefull tool for debugging simulations - python logging module. It works like debug prints, but you can turn off or turn on some of prints depending on input logging config. So you can decide what information to print each time and how detailed it should be. In addition all logging information could be redirected to text file.

  2. I am not sure about possibility of running unit tests with enjine.jar, but you can compare results of simulations with data from replays:

    • choose the turn, parse data from frame 0 and send it into your simulator
    • run simulator
    • compare output of simulator with data from frame -1 of next turn

    It is also possible to compare intermediate results of your simulator with frames of action phase.

  3. cProfile + snakeviz

2 Likes