erlangrebareunit

Where to put test file for eunit?


I'm trying to test function that loads file from disk and do some manipulation on it. I have my project divided into src/ and test/ directories. I put test file under test/ directory and tried to run unit test that loads this file. However file seems to be not visible when running test from IDE (IntelliJ) or console using rebar.

$ ./rebar eunit
==> traffic-emas (eunit)
input_test: load_from_file_test...*failed*
in function input:load_intersection_definition/1 (src/input.erl, line 40)
in call from input_test:load_from_file_test/0 (test/input_test.erl, line 14)
**error:{badmatch,{error,enoent}}

Where should I put test files for eunit to make it visible?


Solution

  • You can print out the working directory in your eunit tests and see where it thinks it's running:

    debugVal(file:get_cwd())
    

    That should give you a good idea of where to put it.