Lines Matching +full:test +full:- +full:book
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
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
76 project. If you've reached us through James Grenning's book, you're going to
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.
102 The majority of the file will be a series of test functions. Test functions
103 follow the convention of starting with the word "test" or "spec". You don't HAVE
105 developers. Test functions take no arguments and return nothing. All test
108 Finally, at the bottom of your test file, you will write a `main()` function.
109 This function will call `UNITY_BEGIN()`, then `RUN_TEST` for each test, and
110 finally `UNITY_END()`.This is what will actually trigger each of those test
114 Remembering to add each test to the main function can get to be tedious. If you
119 in your test file at all.
121 When you're done, your test file will look something like this:
136 //test stuff
140 //more test stuff
156 ## How to Build and Run A Test File
168 - On hardware, you have too many constraints (processing power, memory, etc),
169 - On hardware, you don't have complete control over all registers,
170 - On hardware, unit testing is more challenging,
171 - Unit testing isn't System testing. Keep them separate.
183 In either case, a test is built by linking unity, the test file, and the C
185 test set for that module. Then, this process is repeated for the next test file.
187 much more thoroughly unit test our system and it keeps all the test code out of