Elm Test does support test case minimization. From the Fuzz documentation
<http://package.elm-lang.org/packages/elm-community/elm-test/3.1.0/Fuzz>:

Fuzzers will often generate edge cases likely to find bugs. If the fuzzer
> can make your test fail, it also knows how to "shrink" that failing input
> into more minimal examples, some of which might also cause the tests to
> fail. In this way, fuzzers can usually find the smallest or simplest input
> that reproduces a bug.


I don't think it's possible to unit test ports. Since they are interfaces
to another environment, they would need to be integration tests. And I am
pretty sure such tests are not possible within Elm at the moment. To quote
again from the elm-test (that sure is some educational documentation!)

For integration or end-to-end testing, use your favorite PhantomJS or
> Selenium webdriver, such as Capybara.


As far as unit testing type constructors goes, the question I would ask is,
"Is it possible for this test to fail?" In the example you provide, I think
the answer is no. If the record you are constructing has multiple fields
with the same type, then you could get a test failure by mixing up the
order you pass the arguments. But even so, this would be implicitly tested
by every other unit test that used that type, wouldn't it?

On Fri, Mar 17, 2017 at 7:27 AM, 'Rupert Smith' via Elm Discuss <
elm-discuss@googlegroups.com> wrote:

> On Thursday, March 16, 2017 at 6:52:04 PM UTC, Pedro Castilho wrote:
>>
>> I believe Elm lends itself best to property-based testing
>> <http://blog.jessitron.com/2013/04/property-based-testing-what-is-it.html>
>> of pure code rather than unit testing. Property-based testing can make
>> stronger assertions than unit testing, as long as your code is pure (yet
>> another reason for why you should keep the part of your code that interacts
>> with the "real world" minimal)
>>
>> In general, you do not need to test whether a constructor creates an item
>> of a given type - that's what the type system is for (and a small part of
>> the beauty of using a strongly-typed language)
>>
>
> Hi, elm-test provides Fuzzers for property based testing. Is it missing
> something though compared with Scala Check (and possibly QuickCheck, but
> never used that)? That would be automatic test case minimization, is that
> in elm-test or some other testing library for Elm?
>
> The idea is that if you present say a list to a test case, and that list
> fails the test, the test code will then try the same list again but with
> one element missing, and it will continue repeating that and report the
> smallest list that fails the test.
>
> --
> 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.
>

-- 
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.

Reply via email to