<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>eunit on Roger&#39;s Blog</title>
		<link>https://blog.differentpla.net/tags/eunit/</link>
		<description>Recent content in eunit on Roger&#39;s Blog</description>
		<generator>Hugo</generator>
		<language>en</language>
		
		
		
		
			<lastBuildDate>Thu, 16 Oct 2025 07:25:00 +0000</lastBuildDate>
		
			<atom:link href="https://blog.differentpla.net/tags/eunit/feed.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>EUnit examples: &#39;with&#39;</title>
				<link>https://blog.differentpla.net/blog/2025/10/16/eunit-with/</link>
				<pubDate>Thu, 16 Oct 2025 07:25:00 +0000</pubDate>
				<guid>https://blog.differentpla.net/blog/2025/10/16/eunit-with/</guid>
				<description>&lt;p&gt;In earlier posts, &lt;a href=&#34;https://blog.differentpla.net/blog/2023/04/02/eunit-examples-foreach-result/&#34;&gt;Passing the result from &amp;lsquo;foreach&amp;rsquo;&lt;/a&gt; and&#xA;&lt;a href=&#34;https://blog.differentpla.net/blog/2023/04/02/eunit-examples-setup-result/&#34;&gt;Passing the result from &amp;lsquo;setup&amp;rsquo;&lt;/a&gt;, I showed how to&#xA;(awkwardly) pass the result from the setup function to the test functions.&lt;/p&gt;</description>
			</item>
			<item>
				<title>erlang.mk: running multiple eunit tests</title>
				<link>https://blog.differentpla.net/blog/2025/09/05/erlang-mk-eunit-test-spec/</link>
				<pubDate>Fri, 05 Sep 2025 13:35:00 +0000</pubDate>
				<guid>https://blog.differentpla.net/blog/2025/09/05/erlang-mk-eunit-test-spec/</guid>
				<description>&lt;p&gt;If you&amp;rsquo;re using &lt;code&gt;erlang.mk&lt;/code&gt;, you can run a single unit test suite with &lt;code&gt;make eunit t=whatever&lt;/code&gt;. That&amp;rsquo;s no good if you&#xA;want to run multiple test suites. Here&amp;rsquo;s a nasty hack that makes it possible.&lt;/p&gt;</description>
			</item>
			<item>
				<title>EUnit examples: Cleaning up server processes</title>
				<link>https://blog.differentpla.net/blog/2023/04/03/eunit-examples-cleanup-server/</link>
				<pubDate>Mon, 03 Apr 2023 16:33:00 +0000</pubDate>
				<guid>https://blog.differentpla.net/blog/2023/04/03/eunit-examples-cleanup-server/</guid>
				<description>&lt;p&gt;In several of the previous posts, for example &lt;a href=&#34;https://blog.differentpla.net/blog/2023/03/31/eunit-examples-setup/&#34;&gt;Using &amp;lsquo;setup&amp;rsquo;&lt;/a&gt;, I&amp;rsquo;ve&#xA;started a server in &lt;code&gt;suite_setup/0&lt;/code&gt; and needed to kill it in &lt;code&gt;suite_cleanup/1&lt;/code&gt;. I showed a simple way to do that, but&#xA;it&amp;rsquo;s not the best. Here&amp;rsquo;s a better way to do it.&lt;/p&gt;</description>
			</item>
			<item>
				<title>EUnit examples: Passing the result from &#39;foreach&#39;</title>
				<link>https://blog.differentpla.net/blog/2023/04/02/eunit-examples-foreach-result/</link>
				<pubDate>Sun, 02 Apr 2023 11:23:00 +0000</pubDate>
				<guid>https://blog.differentpla.net/blog/2023/04/02/eunit-examples-foreach-result/</guid>
				<description>&lt;p&gt;Similar to passing the result from &lt;code&gt;{setup, Setup, ...&lt;/code&gt; to each test, you can also pass the result from &lt;code&gt;{foreach, Setup, ...&lt;/code&gt; to each test, but there are some differences.&lt;/p&gt;</description>
			</item>
			<item>
				<title>EUnit examples: Passing the result from &#39;setup&#39;</title>
				<link>https://blog.differentpla.net/blog/2023/04/02/eunit-examples-setup-result/</link>
				<pubDate>Sun, 02 Apr 2023 08:20:00 +0000</pubDate>
				<guid>https://blog.differentpla.net/blog/2023/04/02/eunit-examples-setup-result/</guid>
				<description>&lt;p&gt;The result from &lt;code&gt;setup&lt;/code&gt; is passed to &lt;code&gt;cleanup&lt;/code&gt; already. What if we want to pass it to each of our tests? It&amp;rsquo;s a bit&#xA;awkward, but it looks like the following:&lt;/p&gt;</description>
			</item>
			<item>
				<title>EUnit examples: Nested &#39;setup&#39; and &#39;foreach&#39;</title>
				<link>https://blog.differentpla.net/blog/2023/04/02/eunit-examples-nested-setup-foreach/</link>
				<pubDate>Sun, 02 Apr 2023 08:14:00 +0000</pubDate>
				<guid>https://blog.differentpla.net/blog/2023/04/02/eunit-examples-nested-setup-foreach/</guid>
				<description>&lt;p&gt;If you want to run some setup before (and cleanup after) a list of tests, and &lt;em&gt;also&lt;/em&gt; some setup and cleanup for each&#xA;test, you can nest &lt;code&gt;setup&lt;/code&gt; and &lt;code&gt;foreach&lt;/code&gt;:&lt;/p&gt;</description>
			</item>
			<item>
				<title>EUnit examples: Using &#39;foreach&#39;</title>
				<link>https://blog.differentpla.net/blog/2023/03/31/eunit-examples-foreach/</link>
				<pubDate>Fri, 31 Mar 2023 08:30:00 +0000</pubDate>
				<guid>https://blog.differentpla.net/blog/2023/03/31/eunit-examples-foreach/</guid>
				<description>&lt;p&gt;We saw that &lt;code&gt;setup&lt;/code&gt; runs setup/cleanup before &lt;em&gt;all&lt;/em&gt; tests in a list. If you want to run some setup/cleanup before &lt;em&gt;each&lt;/em&gt;&#xA;test in a list, you can use &lt;code&gt;foreach&lt;/code&gt;:&lt;/p&gt;</description>
			</item>
			<item>
				<title>EUnit examples: Using &#39;setup&#39;</title>
				<link>https://blog.differentpla.net/blog/2023/03/31/eunit-examples-setup/</link>
				<pubDate>Fri, 31 Mar 2023 08:20:00 +0000</pubDate>
				<guid>https://blog.differentpla.net/blog/2023/03/31/eunit-examples-setup/</guid>
				<description>&lt;p&gt;What if we want to run some setup before a set of tests (and cleanup afterwards)?&lt;/p&gt;</description>
			</item>
			<item>
				<title>EUnit examples: a test list</title>
				<link>https://blog.differentpla.net/blog/2023/03/31/eunit-examples-list/</link>
				<pubDate>Fri, 31 Mar 2023 08:15:00 +0000</pubDate>
				<guid>https://blog.differentpla.net/blog/2023/03/31/eunit-examples-list/</guid>
				<description>&lt;p&gt;While you could specify each test with a single function, you can also use a test &amp;ldquo;instantiator&amp;rdquo; (or generator) and have&#xA;it return a list.&lt;/p&gt;</description>
			</item>
			<item>
				<title>EUnit examples: a simple test</title>
				<link>https://blog.differentpla.net/blog/2023/03/31/eunit-examples-simple/</link>
				<pubDate>Fri, 31 Mar 2023 08:10:00 +0000</pubDate>
				<guid>https://blog.differentpla.net/blog/2023/03/31/eunit-examples-simple/</guid>
				<description>&lt;p&gt;A simple EUnit test might look like this:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-erlang&#34; data-lang=&#34;erlang&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;c&#34;&gt;% in test/meaning_test.erl&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;ni&#34;&gt;module&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;meaning_test&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;p&#34;&gt;-&lt;/span&gt;&lt;span class=&#34;ni&#34;&gt;include_lib&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;s&#34;&gt;&amp;#34;eunit/include/eunit.hrl&amp;#34;&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;).&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;nf&#34;&gt;the_test&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;-&amp;gt;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;o&#34;&gt;?&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;assertEqual&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;42&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;meaning&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;:&lt;/span&gt;&lt;span class=&#34;nf&#34;&gt;meaning_of&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;([&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;life&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;universe&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;everything&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;])).&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&#xA;&lt;p&gt;Of note:&lt;/p&gt;</description>
			</item>
			<item>
				<title>EUnit examples: Introduction</title>
				<link>https://blog.differentpla.net/blog/2023/03/31/eunit-examples-intro/</link>
				<pubDate>Fri, 31 Mar 2023 08:00:00 +0000</pubDate>
				<guid>https://blog.differentpla.net/blog/2023/03/31/eunit-examples-intro/</guid>
				<description>&lt;p&gt;Some examples of how to use Erlang&amp;rsquo;s unit-testing framework, EUnit. Starting with simple examples and getting more&#xA;advanced.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Using setup and foreach in eunit tests</title>
				<link>https://blog.differentpla.net/blog/2023/01/03/eunit-setup-foreach/</link>
				<pubDate>Tue, 03 Jan 2023 13:18:00 +0000</pubDate>
				<guid>https://blog.differentpla.net/blog/2023/01/03/eunit-setup-foreach/</guid>
				<description>&lt;p&gt;For when you want to run both per-suite and per-test setup and cleanup in eunit tests.&lt;/p&gt;</description>
			</item>
			<item>
				<title>Using eunit to test private functions</title>
				<link>https://blog.differentpla.net/blog/2022/10/25/eunit-private-functions/</link>
				<pubDate>Tue, 25 Oct 2022 17:33:00 +0000</pubDate>
				<guid>https://blog.differentpla.net/blog/2022/10/25/eunit-private-functions/</guid>
				<description>&lt;p&gt;You&amp;rsquo;ve got an Erlang module with a private (not-exported) function, and you want to add some unit tests for that&#xA;function? How should you do that?&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
