I guess the challenge is that the parsing and generating of the structures 
from JSON descends to several layers of functions, and the database object 
is created and inserted/updated at the lowest level.  I've tried a bulk 
insert after accumulating records into a higher level function, but 
sometimes I need to query for an item previously inserted, so I'm back to 
inserting each item as created.  The challenge is decoupling object 
creation from insertion without breaking the nested process approach.

On Friday, April 19, 2013 9:59:18 AM UTC-7, Chris Ford wrote:
>
> I'm a little unclear as to what your specific challenge is. I understand 
> you're trying to test fns that take a map produced by the JSON parser, and 
> extract specific fields.
>
> Would it be sufficient to just create literal maps to fake the output of 
> the JSON parser, use those as inputs to your extraction fns, and then just 
> compare the output to what you expected? If the issue is that the 
> extraction isn't done by top-level fns, and thus is hard to test, perhaps 
> you could just make them top-level fns?
>
> Cheers,
>
> Chris
>
>
> On 19 April 2013 15:14, Jonathon McKitrick <jmcki...@gmail.com<javascript:>
> > wrote:
>
>> As a relatively new Clojure user, I have a relatively simple app which 
>> parses a complex JSON structure into a database.
>>
>> I have test code which verifies all the basic database functions, but I'm 
>> not sure how best to exercise all the parsing code.  The JSON parser is 
>> built-in, and most of my code is navigating each structure, picking out 
>> fields of interest to build the objects for the database.
>>
>> What would be a good strategy for tests that would exercise this 
>> intermediate layer of the app, between the JSON and the database, where the 
>> heart of the app logic actually lies?
>>
>> -- 
>> -- 
>> You received this message because you are subscribed to the Google
>> Groups "Clojure" group.
>> To post to this group, send email to clo...@googlegroups.com<javascript:>
>> Note that posts from new members are moderated - please be patient with 
>> your first post.
>> To unsubscribe from this group, send email to
>> clojure+u...@googlegroups.com <javascript:>
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+u...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>  
>>  
>>
>
>

-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to