Using test data with ct

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Using test data with ct

duncan
I'm building a rebar3 application and using ct to test it. I have a bunch of test files containing data (sample json) to use as part of testing. When it was just a few, I converted them to erlang terms, and used -define in .hrl files in the include directory. But that doesn't scale well nor make for easy configuration management. I'd prefer to store each json (for a particular test) in a file since those files already exist created by others for validation. Then the test could read the file, and use jsx to convert text to json for comparison within the test.

Where can I stick a bunch of files and then access them as part of test? I understand there is a data_dir. Is that the proper way to do it? Where in the tree do I put a file so it ends up in data_dir?

Duncan Sparrell
sFractal Consulting LLC
iPhone, iTypo, iApologize

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Using test data with ct

Dmitry Kolesnikov-2
Hello,

CT has built support for it. Please check this tutorial
http://learnyousomeerlang.com/common-test-for-uncommon-tests

In the nutshell, you create a folder and store your file there mytest_SUTE_data

and you can access this files from SUITE:
Scenario = filename:join([?config(data_dir, Config), "my.json"]),

Best Regards,
Dmitry


> On Mar 30, 2017, at 8:23 PM, <[hidden email]> <[hidden email]> wrote:
>
> I'm building a rebar3 application and using ct to test it. I have a bunch of test files containing data (sample json) to use as part of testing. When it was just a few, I converted them to erlang terms, and used -define in .hrl files in the include directory. But that doesn't scale well nor make for easy configuration management. I'd prefer to store each json (for a particular test) in a file since those files already exist created by others for validation. Then the test could read the file, and use jsx to convert text to json for comparison within the test.
>
> Where can I stick a bunch of files and then access them as part of test? I understand there is a data_dir. Is that the proper way to do it? Where in the tree do I put a file so it ends up in data_dir?
>
> Duncan Sparrell
> sFractal Consulting LLC
> iPhone, iTypo, iApologize
> _______________________________________________
> erlang-questions mailing list
> [hidden email]
> http://erlang.org/mailman/listinfo/erlang-questions

_______________________________________________
erlang-questions mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-questions
Loading...