Lines Matching +full:test +full:- +full:book
1 # Unity - Getting Started
10 Unity is a unit test framework.
12 The core Unity test framework is three files: a single C file and a couple header files.
15 Unity was designed to be cross-platform.
59 - `src` - This is the code you care about! This folder contains a C file and two header files.
61 - `docs` - You're reading this document, so it's possible you have found your way into this folder …
63 - `examples` - This contains a few examples of using Unity.
64 - `extras` - These are optional add ons to Unity that are not part of the core project.
65 If you've reached us through James Grenning's book, you're going to want to look here.
66 - `test` - This is how Unity and its scripts are all tested.
69 - `auto` - Here you will find helpful Ruby scripts for simplifying your test workflow.
72 ## How to Create A Test File
74 Test files are C files.
75 Most often you will create a single test file for each C module that you want to test.
76 The test file should include unity.h and the header for your C module to be tested.
78 Next, a test file will include a `setUp()` and `tearDown()` function.
79 The setUp function can contain anything you would like to run before each test.
80 The tearDown function can contain anything you would like to run after each test.
84 If you're using Ceedling or the test runner generator script, you may leave these off completely.
89 The majority of the file will be a series of test functions.
90 Test functions follow the convention of starting with the word "test_" or "spec_".
92 Also, the automated scripts that come with Unity or Ceedling will default to looking for test funct…
93 Test functions take no arguments and return nothing. All test accounting is handled internally in U…
95 Finally, at the bottom of your test file, you will write a `main()` function.
96 This function will call `UNITY_BEGIN()`, then `RUN_TEST` for each test, and finally `UNITY_END()`.
97 This is what will actually trigger each of those test functions to run, so it is important that eac…
99 Remembering to add each test to the main function can get to be tedious.
102 In this case, there is no need for you to include the main function in your test file at all.
104 When you're done, your test file will look something like this:
119 //test stuff
123 //more test stuff
139 ### Running Test Functions
141 When writing your own `main()` functions, for a test-runner.
142 There are two ways to execute the test.
156 These macros perform the necessary setup before the test is called and handles clean-up and result …
158 ### Ignoring Test Functions
160 There are times when a test is incomplete or not valid for some reason.
162 Control will immediately be returned to the caller of the test, and no failures will be returned.
163 This is useful when your test runners are automatically generated.
169 Ignore this test and return immediately
175 Ignore this test and return immediately.
176 Output a message stating why the test was ignored.
180 … a test will contain an infinite loop on error conditions, or there may be reason to escape from t…
195 Abort Test macro
211 ## How to Build and Run A Test File
221 - On hardware, you have too many constraints (processing power, memory, etc),
222 - On hardware, you don't have complete control over all registers,
223 - On hardware, unit testing is more challenging,
224 - Unit testing isn't System testing. Keep them separate.
234 In either case, a test is built by linking unity, the test file, and the C file(s) being tested.
235 These files create an executable which can be run as the test set for that module.
236 Then, this process is repeated for the next test file.
237 …dual executables allows us to much more thoroughly unit test our system and it keeps all the test …