我试图在测试中使用助手。我的文件夹结构是这样的:
config/
lib/
test/
test/test_helper.exs
test/provider_test/(the test files are here)
现在我想做的是
config/
lib/
test/
test/test_helper.exs
test/provider_test/(the test files are here)
test/provider_test/helpers/(the helpers files... more or less, one for helper)
我尝试使用此功能(在测试中):
HelperModuler.calling_function(args)
但是我得到这个错误:
(UndefinedFunctionError) undefined function HelperModuler.calling_function/1 (module HelperModuler is not available)
最佳答案
您还可以在运行时使用test.helpers设置中的Code.require_file
加载代码以进行测试。
Code.require_file("test/provider_test/helpers/helper.exs")