<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>ztest header not found</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/98306/ztest-header-not-found</link><description>Windows 11, VSCode, NCS v2.3.0 
 Hi, I have a well-working application that I would like to build ztests for. 
 I&amp;#39;m reading about how to do that on the test framework page: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/develop/test</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 08 Aug 2025 19:05:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/98306/ztest-header-not-found" /><item><title>RE: ztest header not found</title><link>https://devzone.nordicsemi.com/thread/545089?ContentTypeID=1</link><pubDate>Fri, 08 Aug 2025 19:05:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fd16b43b-00aa-47f4-a1f6-0179de79d17c</guid><dc:creator>JohnW1234</dc:creator><description>&lt;p&gt;I landed on this thread too with the same error.&amp;nbsp; A lot of folks probably have the same misunderstanding I did.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It turns out unit tests are meant to be&amp;nbsp;&lt;em&gt;their own separate projects&lt;/em&gt;.&amp;nbsp; So you&amp;#39;re not meant to merge the example prj.conf or CMakeLists.txt files with your main files, you&amp;#39;re meant to have a folder structure just like this one:&amp;nbsp;&lt;a href="https://github.com/zephyrproject-rtos/zephyr/blob/main/tests/unit/"&gt;github.com/.../&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ztest header not found</title><link>https://devzone.nordicsemi.com/thread/465218?ContentTypeID=1</link><pubDate>Mon, 22 Jan 2024 05:59:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75e29a2d-4bed-4c72-8877-b4f7d902a20e</guid><dc:creator>gacmy</dc:creator><description>&lt;h2&gt;Quick start - Integration testing&lt;a class="headerlink" title="Permalink to this heading" href="https://docs.zephyrproject.org/latest/develop/test/ztest.html#quick-start-integration-testing"&gt;&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;A simple working base is located at&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;a class="reference external" href="https://github.com/zephyrproject-rtos/zephyr/blob/main/samples/subsys/testsuite/integration"&gt;samples/subsys/testsuite/integration&lt;/a&gt;. Just copy the files to&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;tests/&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;and edit them for your needs. The test will then be automatically built and run by the twister script. If you are testing the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;bar&lt;/strong&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;component of&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;strong&gt;foo&lt;/strong&gt;, you should copy the sample folder to&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;tests/foo/bar&lt;/span&gt;&lt;/code&gt;. It can then be tested with:&lt;/p&gt;
&lt;div class="highlight-console notranslate"&gt;
&lt;div class="highlight"&gt;
&lt;pre id="codecell5"&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;./scripts/twister -s tests/foo/bar/test-identifier&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;In the example above&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;tests/foo/bar&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;signifies the path to the test and the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code class="docutils literal notranslate"&gt;&lt;span class="pre"&gt;test-identifier&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;references a test defined in the&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code class="file docutils literal notranslate"&gt;&lt;span class="pre"&gt;testcase.yaml&lt;/span&gt;&lt;/code&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;file.&lt;/p&gt;
&lt;p&gt;To run all tests defined in a test project, run:&lt;/p&gt;
&lt;div class="highlight-console notranslate"&gt;
&lt;div class="highlight"&gt;
&lt;pre id="codecell6"&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="go"&gt;./scripts/twister -T tests/foo/bar/&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The sample contains the following files:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.zephyrproject.org/latest/develop/test/ztest.html#creating-a-test-suite"&gt;Test Framework &amp;mdash; Zephyr Project Documentation&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;you might use test case incorrectly&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ztest header not found</title><link>https://devzone.nordicsemi.com/thread/442635?ContentTypeID=1</link><pubDate>Tue, 22 Aug 2023 18:27:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3e4f1ac8-9ae9-49b8-89eb-ee0a99877297</guid><dc:creator>Miguel Ferreira</dc:creator><description>&lt;p&gt;Hi &lt;a href="https://devzone.nordicsemi.com/members/douglas.malnati"&gt;douglas.malnati&lt;/a&gt;&amp;nbsp;,&lt;br /&gt;Have you found a way to use the ztest framework ? Im getting the same errors...&lt;br /&gt;Thank you!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: ztest header not found</title><link>https://devzone.nordicsemi.com/thread/418446?ContentTypeID=1</link><pubDate>Fri, 31 Mar 2023 01:34:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:07c3b547-9d6a-4d8f-86ac-0aef26c9169c</guid><dc:creator>douglas.malnati</dc:creator><description>&lt;p&gt;Actually I have subsequently understood more about how the test framework works and this was the wrong approach to be taking.&lt;/p&gt;
&lt;p&gt;I have no need for this question to be answered, it can be closed.&amp;nbsp; Better if it was just deleted.&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>