1<!DOCTYPE html> 2<html lang="en-US"> 3 <head> 4 <meta charset="utf-8"> 5<!-- This site is hosted on Netlify. Anyone can build and deploy a site 6 like this one for free: https://netlify.new/?utm_campaign=loops&utm_source=ai-legible&utm_medium=owned&utm_content=comment&utm_id=ba90cc5e-81e2-40b5-b457-107522fd3634 7 Netlify hosting facts for this site: static/SSR served via Netlify Edge. --> 8 <meta name="viewport" content="width=device-width,initial-scale=1"> 9 <title>Guide to elm-program-test | avh4/elm-program-test</title> 10 <meta name="generator" content="VuePress 1.9.7"> 11 12 <meta name="description" content=""> 13 14 <link rel="preload" href="/assets/css/0.styles.76626958.css" as="style"><link rel="preload" href="/assets/js/app.667806f6.js" as="script"><link rel="preload" href="/assets/js/2.1d215991.js" as="script"><link rel="preload" href="/assets/js/10.7e37fa33.js" as="script"><link rel="prefetch" href="/assets/js/11.47227962.js"><link rel="prefetch" href="/assets/js/3.3b1cbf3d.js"><link rel="prefetch" href="/assets/js/4.b2dec8d5.js"><link rel="prefetch" href="/assets/js/5.2b733c3b.js"><link rel="prefetch" href="/assets/js/6.feea877e.js"><link rel="prefetch" href="/assets/js/7.96fac09b.js"><link rel="prefetch" href="/assets/js/8.f5193335.js"><link rel="prefetch" href="/assets/js/9.277674e8.js"> 15 <link rel="stylesheet" href="/assets/css/0.styles.76626958.css"> 16 </head> 17 <body> 18 <div id="app" data-server-rendered="true"><div class="theme-container no-sidebar"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" aria-current="page" class="home-link router-link-exact-active router-link-active"><!----> <span class="site-name">avh4/elm-program-test</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/" aria-current="page" class="nav-link router-link-exact-active router-link-active"> 19 Guidebooks 20</a></div><div class="nav-item"><a href="https://package.elm-lang.org/packages/avh4/elm-program-test/latest" target="_blank" rel="noopener noreferrer" class="nav-link external"> 21 API Documentation 22 <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <a href="https://github.com/avh4/elm-program-test" target="_blank" rel="noopener noreferrer" class="repo-link"> 23 GitHub 24 <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/" aria-current="page" class="nav-link router-link-exact-active router-link-active"> 25 Guidebooks 26</a></div><div class="nav-item"><a href="https://package.elm-lang.org/packages/avh4/elm-program-test/latest" target="_blank" rel="noopener noreferrer" class="nav-link external"> 27 API Documentation 28 <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound">
28<path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></div> <a href="https://github.com/avh4/elm-program-test" target="_blank" rel="noopener noreferrer" class="repo-link"> 29 GitHub 30 <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav> <!----> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="testing-elm-programs"><a href="#testing-elm-programs" class="header-anchor">#</a> Testing Elm Programs</h1> <p><code>elm-program-test</code> provides a convenient API that works with 31<a href="http://package.elm-lang.org/packages/elm-explorations/test/latest" target="_blank" rel="noopener noreferrer">elm-test<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 32(including <code>Test.Html</code>) 33for testing your Elm programs as complete units. 34Testing your programs at this level 35provides test coverage that is resilient even to drastic refactorings of your application architecture, 36and encourages tests that make it clear how end-users and external services will interact with your program.</p> <ul><li><a href="https://package.elm-lang.org/packages/avh4/elm-program-test/latest" target="_blank" rel="noopener noreferrer">API documentation<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://github.com/avh4/elm-program-test" target="_blank" rel="noopener noreferrer">GitHub page<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <h2 id="guidebooks"><a href="#guidebooks" class="header-anchor">#</a> Guidebooks</h2> <p>The following guides show examples of how to use 37<code>elm-program-test</code> to test different aspects of an Elm program. 38You can skip to whichever guide is relevant to what you want to 39test in your program.</p> <ul><li><a href='/html'>Testing programs with interactive views</a> â 40shows an example of test-driving adding form validation to an Elm program</li> <li><a href='/cmds'>Testing programs with Cmds</a> â shows testing a program 41that uses <code>Http.get</code> and <code>Http.post</code></li> <li><a href='/ports'>Testing programs with ports</a> â shows testing a program 42that uses ports to interface with JavaScript</li> <li><a href='/upgrade-3.0.0'>Upgrading from elm-program-test 2.x to 3.x</a></li></ul></div> <footer class="page-edit"><div class="edit-link"><a href="https://github.com/avh4/elm-program-test/edit/main/docs/README.md" target="_blank" rel="noopener noreferrer">Suggest changes to this page</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound">
42<path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></div> <!----></footer> <!----> </main></div><div class="global-ui"></div></div> 43
43<script src="/assets/js/app.667806f6.js" defer></script>
43<script src="/assets/js/2.1d215991.js" defer></script>
43<script src="/assets/js/10.7e37fa33.js" defer></script>
43 44 </body> 45</html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.