• Home
  • Raw
  • Download

Lines Matching +full:no +full:- +full:unit +full:- +full:test

1 # Unity - Getting Started
9 Unity is a unit test framework. The goal has been to keep it small and
10 functional. The core Unity test framework is three files: a single C file and a
14 Unity was designed to be cross-platform. It works hard to stick with C standards
26 Unity. This is going to be your unit testing bread and butter. You'll spend more
69 - `src` - This is the code you care about! This folder contains a C file and two
71 - `docs` - You're reading this document, so it's possible you have found your way
74 - `examples` - This contains a few examples of using Unity.
75 - `extras` - These are optional add ons to Unity that are not part of the core
78 - `test` - This is how Unity and its scripts are all tested. If you're just using
82 - `auto` - Here you will find helpful Ruby scripts for simplifying your test
86 ## How to Create A Test File
88 Test files are C files. Most often you will create a single test file for each C
89 module that you want to test. The test file should include unity.h and the
92 Next, a test file will include a `setUp()` and `tearDown()` function. The setUp
93 function can contain anything you would like to run before each test. The
94 tearDown function can contain anything you would like to run after each test.
95 Both functions accept no arguments and return nothing. You may leave either or
96 both of these blank if you have no need for them.
98 If you're using Ceedling or the test runner generator script, you may leave these off
103 The majority of the file will be a series of test functions. Test functions
107 to looking for test functions to be prefixed this way. Test functions take no arguments
108 and return nothing. All test accounting is handled internally in Unity.
110 Finally, at the bottom of your test file, you will write a `main()` function.
111 This function will call `UNITY_BEGIN()`, then `RUN_TEST` for each test, and
112 finally `UNITY_END()`.This is what will actually trigger each of those test
116 Remembering to add each test to the main function can get to be tedious. If you
120 have followed the suggested naming conventions. In this case, there is no need
121 for you to include the main function in your test file at all.
123 When you're done, your test file will look something like this:
138 //test stuff
142 //more test stuff
158 ### Running Test Functions
159 When writing your own `main()` functions, for a test-runner. There are two ways
160 to execute the test.
170 These macros perform the necessary setup before the test is called and
173 ### Ignoring Test Functions
174 There are times when a test is incomplete or not valid for some reason.
176 returned to the caller of the test, and no failures will be returned.
177 This is useful when your test runners are automatically generated.
183 Ignore this test and return immediately
189 Ignore this test and return immediately. Output a message stating why the test was ignored.
192 … a test will contain an infinite loop on error conditions, or there may be reason to escape from t…
200 Abort Test macro
216 ## How to Build and Run A Test File
218 This is the single biggest challenge to picking up a new unit testing framework,
226 unit tests on your hardware.
228 - On hardware, you have too many constraints (processing power, memory, etc),
229 - On hardware, you don't have complete control over all registers,
230 - On hardware, unit testing is more challenging,
231 - Unit testing isn't System testing. Keep them separate.
243 In either case, a test is built by linking unity, the test file, and the C
245 test set for that module. Then, this process is repeated for the next test file.
247 much more thoroughly unit test our system and it keeps all the test code out of