You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update instructions for UT creation
* Remove unecessary step
---------
Co-authored-by: Thomas Boyer-Chammard <49786685+thomas-bc@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/led-blinker.md
+17-23Lines changed: 17 additions & 23 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -761,17 +761,7 @@ This exercise will walk through development of basic unit tests for the `Led` co
761
761
762
762
To start off, use `fprime-util` to generate a unit test outline for the `Led` component.
763
763
764
-
First, register unit tests for the `Led` component with the build system by adding these lines at the very end of the component `CMakeLists.txt` file in your `led-blinker/Components/Led` directory, **after** the `register_fprime_module()` call.
Next, generate a unit test build cache by running the following terminal commands:
764
+
First, generate a unit test build cache by running the following terminal commands:
775
765
776
766
```shell
777
767
#In led-blinker/Components/Led
@@ -780,7 +770,6 @@ fprime-util generate --ut
780
770
> [!NOTE]
781
771
> Unit tests run with special build settings and as such need their own build cache generated.
782
772
783
-
784
773
Next we will generate unit test template files. This is similar to the component implementations we have run, but will set up the complete unit test harness.
785
774
786
775
To do so, run the implementation command in the terminal within your `led-blinker/Components/Led` directory:
@@ -789,24 +778,29 @@ To do so, run the implementation command in the terminal within your `led-blinke
789
778
fprime-util impl --ut
790
779
```
791
780
792
-
This step should create the files `LedTester.cpp`, `LedTester.hpp`, and `LedTestMain.cpp` in your current directory. Move them to a new subdirectory called `test/ut`.
781
+
This step should create the files `LedTester.template.cpp`, `LedTester.template.hpp`, and `LedTestMain.template.cpp` in `led-blinker/Components/Led/test/ut`.
793
782
794
-
This is done with:
795
-
```shell
796
-
#In led-blinker/Components/Led
797
-
mkdir -p test/ut
798
-
mv LedTest* test/ut/
783
+
Since this is the start of the test's implementation, we use the generated template files for our initial test implementation. Inside your `led-blinker/Components/Led/test/ut` directory, rename the files removing the `.template` suffix:
784
+
785
+
```bash
786
+
# In led-blinker/Components/Led/test/ut
787
+
mv LedTester.template.hpp LedTester.hpp
788
+
mv LedTester.template.cpp LedTester.cpp
789
+
mv LedTestMain.template.cpp LedTestMain.cpp
799
790
```
800
791
801
-
Next, update the `CMakeLists.txt` file in your `led-blinker/Components/Led` directory to add those files to the list of unit-test source files. That section should look like this:
792
+
Then, register the unit test files with the build system by uncommenting these lines at the very end of the component `CMakeLists.txt` file in your `led-blinker/Components/Led` directory:
0 commit comments