[erlang-questions] Testing api with jsongen and quickcheck

Garret Smith garret.smith@REDACTED
Fri Aug 21 19:58:12 CEST 2015


On Fri, Aug 21, 2015 at 10:45 AM, Mark Bruch <mark.h.bruch@REDACTED> wrote:
> On Fri, Aug 21, 2015 at 7:33 PM, Garret Smith <garret.smith@REDACTED> wrote:
>> On Fri, Aug 21, 2015 at 10:24 AM, Kenneth Lakin <kennethlakin@REDACTED> wrote:
>>> On 08/21/2015 09:27 AM, Mark Bruch wrote:
>>>> Unfortunately [jsongen] doesn't compile on any of
>>>> my machines.
>>>
>>> It fails to compile with rebar3 on my machine, too.
>>>
>>> Stupid question, but do you have QuickCheck installed? The missing
>>> include files that the build whines about seem to be related to QuickCheck.
>>>
>>> I found an eqcmini GitHub project, but that doesn't seem to provide
>>> enough to get jsongen to build.
>>>
>>>
>>>
>>>
>>> _______________________________________________
>>> erlang-questions mailing list
>>> erlang-questions@REDACTED
>>> http://erlang.org/mailman/listinfo/erlang-questions
>>>
>>
>> Same problem with eqc.hrl here, once I replace 'make' with 'gmake'
>> since I'm on FreeBSD.
>>
>> It's a different approach than jsongen, but I have a similar setup of
>> a JSON API for an Erlang codebase.
>> I'm using aeon* to convert JSON <=> Erlang records and sanitize the
>> json input along the way.
>> Since QuickCheck (and PropEr) can use the type info in Erlang records,
>> you could:
>>  1) Write Erlang records that correspond to your JSON
>>  2) Use QC/PropEr to generate the Erlang records
>>  3) Use aeon to convert the Erlang to JSON and call your API with it
>>
>> *aeon: https://github.com/garret-smith/aeon
>>
>> Yes, aeon is my own project.  Hopefully others can use it too.
>>
>> -Garret
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>
> Yes, I've got the full version of QuickCheck installed.
> For me it complains on: "src/js_links_machine.erl:none:
> double_occurence of callouts in js_links_machine. Only grouped
> functions or ungrouped functions, not both"
>
> Thanks for the pointers Garret, that sounds like a good and easy way
> to do it. Will give your aeon a go :)

I'd love to hear your experiences.  Hopefully doing it this way will
give you better control over the testing since you're using Erlang
types to generate the JSON.



More information about the erlang-questions mailing list