{"result":{"depiction_url":null,"edges":{"relation":{"objects":[{"created":"2026-10-07T11:13:37Z","object_id":{"id":3029,"is_a":["text","documentation","developerguide"],"name":"developer_cmd_runtests","title":{"_type":"trans","tr":{"en":"runtests: Run selected core test modules"}},"uri":"https:\/\/zotonic.com\/id\/3029"},"seq":1},{"created":"2026-10-07T11:13:37Z","object_id":{"id":2983,"is_a":["text","documentation","developerguide"],"name":"developer_testing_strategy","title":{"_type":"trans","tr":{"en":"Choose checks for a change"}},"uri":"https:\/\/zotonic.com\/id\/2983"},"seq":2}],"predicate":{"id":303,"is_a":["meta","predicate"],"name":"relation","title":{"_type":"trans","tr":{"nl":"Relatie","en":"Relation"}},"uri":"http:\/\/purl.org\/dc\/terms\/relation"}},"subject":{"objects":[{"created":"2026-10-07T11:13:37Z","object_id":{"id":2554,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_how_to_guide","title":"How-to guide","uri":"https:\/\/zotonic.com\/id\/2554"},"seq":1},{"created":"2026-10-07T11:13:37Z","object_id":{"id":2564,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_backend_developer","title":"Backend developer","uri":"https:\/\/zotonic.com\/id\/2564"},"seq":2},{"created":"2026-10-07T11:13:37Z","object_id":{"id":2613,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_development_and_debugging","title":"Development and debugging","uri":"https:\/\/zotonic.com\/id\/2613"},"seq":3},{"created":"2026-10-07T11:13:37Z","object_id":{"id":2640,"is_a":["categorization","keyword","keyword_task"],"name":"zotonic_topic_validate","title":"Validate","uri":"https:\/\/zotonic.com\/id\/2640"},"seq":4}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":2984,"is_a":["text","documentation","developerguide"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2984"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"developer_testing_erlang","page_url":{"en":"https:\/\/zotonic.com\/docs\/2984\/test-erlang-behavior-with-focused-examples","x-default":"https:\/\/zotonic.com\/docs\/2984\/test-erlang-behavior-with-focused-examples"},"preview_url":null,"resource":{"body":{"_type":"trans","tr":{"en":"<p>For code that uses Zotonic models, use the repository&#39;s existing test setup and a dedicated site context. Clean up created resources so later tests do not depend on execution order.<\/p>\n<p>Select a known test module with the supported test runner. Check that the runner actually discovers it: this workspace&#39;s <code>runtests<\/code> command scans the core <code>apps\/zotonic_*\/test<\/code> directories, not every user application&#39;s test directory.<\/p>\n<p>For the pure filter example, create <code>test\/filter_garden_label_tests.erl<\/code> in the Garden application:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">-module(filter_garden_label_tests).\n-include_lib(&quot;eunit\/include\/eunit.hrl&quot;).\n\nlabel_test() -&gt;\n    ?assertEqual(&lt;&lt;&quot;Open to visitors&quot;&gt;&gt;,\n        filter_garden_label:garden_label(&lt;&lt;&quot;open&quot;&gt;&gt;, undefined)),\n    ?assertEqual(&lt;&lt;&quot;Check visiting times&quot;&gt;&gt;,\n        filter_garden_label:garden_label(undefined, undefined)).\n<\/code><\/pre>\n<p>After building the application, compile this test into a temporary directory and run it with the application&#39;s <code>ebin<\/code> on the path:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-sh\">mkdir -p \/tmp\/garden-eunit\nerlc -o \/tmp\/garden-eunit apps_user\/zotonic_mod_garden\/test\/filter_garden_label_tests.erl\nerl -noshell -pa _build\/default\/lib\/zotonic_mod_garden\/ebin \/tmp\/garden-eunit -eval &#39;case eunit:test(filter_garden_label_tests, [verbose]) of ok -&gt; halt(0); _ -&gt; halt(1) end.&#39;\n<\/code><\/pre>\n<p>Expect one passing EUnit test. These commands run a pure helper test without a site; use the site&#39;s integration test setup for database or permission behaviour.<\/p>"}},"category_id":{"id":317,"is_a":["meta","category"],"name":"developerguide","title":"Developer guide","uri":"https:\/\/zotonic.com\/id\/developerguide"},"content_group_id":{"id":339,"is_a":["meta","content_group"],"name":"default_content_group","title":{"_type":"trans","tr":{"en":"Default Content Group"}},"uri":"https:\/\/zotonic.com\/id\/default_content_group"},"created":"2026-10-07T11:12:57Z","creator_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"doc_editorial_bundle":true,"doc_editorial_edges":{"relation":[2983,3029],"subject":[2554,2564,2613,2640]},"is_authoritative":true,"is_dependent":false,"is_featured":false,"is_protected":false,"is_published":true,"is_unfindable":false,"language":["en"],"modified":"2026-10-07T20:45:40Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"name":"developer_testing_erlang","pivot_geocode":null,"pivot_location_lat":null,"pivot_location_lng":null,"privacy":0,"publication_end":"9999-06-01T00:00:00Z","publication_start":"2026-10-07T11:12:57Z","slug":"test-erlang-behavior-with-focused-examples","summary":{"_type":"trans","tr":{"en":"Keep domain logic in small functions that accept explicit inputs. Test expected results, boundary values, and meaningful error cases without starting a full site when the function does not need one."}},"title":{"_type":"trans","tr":{"en":"Test Erlang behavior with focused examples"}},"title_slug":{"_type":"trans","tr":{"en":"test-erlang-behavior-with-focused-examples"}},"tz":"UTC","uri":null,"version":17,"visible_for":0},"uri":"https:\/\/zotonic.com\/id\/2984","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2984"}},"status":"ok"}