<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="279820" data-post-id="279820">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="kanishka" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  kanishka
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>You can get around this by making a loop around the “test” instead of the “assert” and putting the test value into the test name, but I generally don’t bother with the loop because of reasons stated above.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="279820" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/explicit-vs-dry-tests/54187/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-279820" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="279820"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="279961" data-post-id="279961">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="dimitarvp" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/120/38664_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  dimitarvp
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Weird how nobody did tests to get best from both worlds:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">for n &lt;- [1, 2, 4, 7, 8] do
  n = Macro.escape(n)

  test "fizz_buzz(#{n}) returns the input number as a string" do
    n = unquote(n)
    assert fizz_buzz(n) == "#{n}"
  end
end
</code></pre>
<p>Basically have  your code generate tests. And if one fails you’ll have an exact test title + assert diff showing exactly what’s wrong.</p>
<p>I do such tests any chance I get because it helps cover several potentially-gotcha values.</p>
<hr>
<p>But if we’re going into that territory then I’ll side with <a class="mention" href="/u/hauleth" rel="nofollow">@hauleth</a> – when you need to prove properties of your code then property testing is what you want. And it’s not an overkill at all, you use it 4-5 times and you get used to it. I have never spent more than 20-30 minutes adding property tests once I learned <code>stream_data</code> (which admittedly took me a weekend of tinkering, though it was well worth it).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="279961" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/explicit-vs-dry-tests/54187/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-279961" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="279961"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="280509" data-post-id="280509">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jarmo" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jarmo/120/26312_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jarmo
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I always prefer explicit tests. Yes, they are more tedious to write, but much easier to understand when they start to fail.</p>
<p>Also, if trying to keep tests as DRY as production code then at one point they might get so complex that they need their own tests.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="280509" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/explicit-vs-dry-tests/54187/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-280509" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="280509"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>