where to put unit tests

Former Member
Former Member

I've created a small widget and now learning how to deal with unit tests.

I found this tutorial https://starttorun.info/tutorial-how-to-create-connect-iq-unit-test-project/ that says that the test-code ends up being compiled in to the release and advised to keep it in a separate project. Next it says to link the app project and the test project in eclipse, but I could not find a way to do that with VS-Code.

So the solution I came up with is to create an own project in a separate folder and using soft-links `ln -s ..` to get all the code across to the test folder. Git seems to understand links these days. see https://github.com/individual-it/BatteryGuesstimate/pull/1

Where do you keep the unit tests? Is there a better way?

  • what I do today is still create 2 seperate projects. VsCode indeed doesn't have the neat linking feature, as you did hardlinking through the os is an option, but I didn't like that and  as a workaround I link the files through the monkey.jungle by typing base.sourcePath = source;..\MyRealProject\source - a disadvantage of doing it this way is that you can not open the files from within vscode (unless you open both your real project and your test project in one workspace)

  • I keep my unit tests in source/t within the project. 

  • Former Member
    Former Member in reply to peterdedecker

    Thank you.
    For now I will go with the linking solution.

    From the "tests" project I can open the  "app" files and the tests, alternatively I need two VS-Code windows.

    The only think that cannot be linked is the `manifest.xml`, so I will have to be very careful not to diverse there