[elm-discuss] Re: Using flat-file JSON fixtures in elm-test and API tests

2016-12-12 Thread Jan Fornoff
Thanks Oliver, the pact project and the vocabulary of consumer driven contract 
tests was super helpful. 

One thing that came to mind when looking at the project was, that it just works 
against Ruby right now. Also, I am not certain if the approach is also 
applicable to larger API responses. 

The project also stores the 'pacts' as JSON under the hood, same direction as 
my proposal. 

So given we would establish a common base that also enabled elm-test to use 
such a system of 'mocking' the API through a predefined and verifiable fixture, 
how would that work in your imaginations? 

I'd imagine:
- a piece of data in Elm, that represents the request, e.g. a HTTP statement, 
could map to the mocked payload somehow?
- we need to declare the 'API state' that we'd like to simulate (analogous to 
what the part-time does) 

We definitely need to pass the mocked response through all the decoders, so the 
seam would be somewhere around the runtime handling Cmds, I'd think 

What are your thoughts around this? 

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Using flat-file JSON fixtures in elm-test and API tests

2016-12-11 Thread Richard Feldman
Thanks for the level of detail on this! Testing that things are wired up as 
expected is something I'd like to add to elm-test.

I hadn't thought about the "shared fixtures" angle. It's definitely 
interesting!

I'm also curious to see if anyone else has any similar use cases, and their 
similarities/differences to this one.

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[elm-discuss] Re: Using flat-file JSON fixtures in elm-test and API tests

2016-12-11 Thread Oliver Searle-Barnes
This is a slightly different approach to the problem but thought you might 
be interested to see it, https://github.com/realestate-com-au/pact.

On Monday, 12 December 2016 00:16:21 UTC+1, Jan Fornoff wrote:
>
> Hi everyone!
>
> I'd like to propose an idea that I've been playing with for a bit.
>
> *Core problem:*
>
> Testing an API is not too challenging, and the tests are pretty fast too 
> (e.g., controller and unit tests in Ruby on Rails).
> Verifying that an Elm frontend works is fairly straightforward as well and 
> fast (with elm-test).
>
> To ensure that the interactions between Elm and the API work as intended, 
> one approach is to utilize an End-To-End testing approach (such as 
> simulating user interaction through PhantomJS, Selenium or similar).
> However, those tests are slow and therefore a tradeoff between test suite 
> runtime and amount of test cases needs to be made.
>
> *Possible solution:*
>
> Given the constraints above, it is a prudent approach to focus End-To-End 
> tests to the more mission-critical features of an application.
> In my experience, such tests mostly verify that everything is plugged 
> together correctly and works "at first sight" (i.e., not exploring every 
> last bit of functionality).
>
> Compatibility between the frontend application and the API endpoints being 
> used is a point where bugs can easily sneak in and increase the desire for 
> E2E tests.
>
> To deal with this, a possible solution might include sharing fixtures 
> between API and frontend tests, such that:
> - API tests verify that responses conform with a JSON fixture file
> - Frontend test use the same JSON fixture files as "stubbed" API responses
>
> I've created a small infographic illustrating the idea with an example right 
> here .
>
>
> Please let me hear your thoughts on this! :-)
> Best regards,
> Jan
>

-- 
You received this message because you are subscribed to the Google Groups "Elm 
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to elm-discuss+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.