Best practices for combinging Juno debug and Test

I’m developing a package called MyPkg in Juno with the following directory structure:

MyPkg/
- MyPkg.jl 
- test/
-- runtests.jl

How do I…

  1. do test-driven development (using MyPkg/test/runtests.jl)
    AND
  2. use the Juno debugger to easily debug functions executed by runtests
    easily?

I’d like to do both easily from the Juno console, but everything I’ve tried is awkward/broken. Rather than regurgitate all my failed approaches, would someone more experienced please explain how you set up your paths/environment/workflow to accomplish the above? Or if you think I’m asking the wrong question–meaning, there are better ways to test–please let me know what the right question is.

Note: I have already read the Julia Unit Test docs and Juno Debugging docs. Thanks!

1 Like

Did you see

3 Likes

Roughly I follow the workflow as outlined by @ChrisRackauckas in his video.

Honestly I quite never use the debugger. I have for my major source files test files, which I include in runtests.jl. There I try to cover every source code line with a test case (following the display in codecov and coveralls).

  1. I work inside MyPkg, activate ., using Revise from my start script, then
  2. after saving my source from I do in the repl include("test/runtests.jl").
  3. In case of a bug, I can directly (with one click) jump from the displayed stack trace to the source code, which is enough in 99.9% of the cases to fix it.

For sure there are better workflows and I’m curious to hear about them.

2 Likes

thank you! Exactly what I was missing.