ESP32 Product Creation Journey: Adding Unit Tests and Coverage with Catch2 and gcovr

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 ธ.ค. 2024

ความคิดเห็น • 20

  • @Robotudent
    @Robotudent หลายเดือนก่อน

    I have been watching this entire playlist from the very beginning. Thanks for covering every inch if hardware development. I didn't have any prior experience in pcb design but after watching past episodes I can now comfortably use kiCad. I'm hoping to develop my final year project to a product I can keep in my desk. Also thanks for covering software development, I'm going to switch from Arduino framework to espidf and see how that goes.

    • @KevinSidwar
      @KevinSidwar  หลายเดือนก่อน

      Thanks so much for the comment. I really appreciate the kind words. Good luck making the switch to IDF. Can be hard at first but definitely worth it in the long run.

  • @muhabtomoum
    @muhabtomoum 3 ปีที่แล้ว +3

    if you are on windows 10 Heres what worked for me:
    1- Make sure you have the latest Microsoft visual studio installed. I am using VS2019
    2- Open the visual studio project solution ".sln" that was created when you did >cmake ..
    3- Right-click on solution > properties . A popup will appear.
    4- If not already selected go to common properties > Startup Project > Select "Single startupj project" > choose from the drop-down menu unit_tests. Note that the name of the folder you created in your project root directory if you have been following this video.
    5- Press ok and click the build local windows debugger. This should build and run.
    Note: the building process will create the executable (in \unit_tests\build\Debug the video talks about which you can use to run other commands found in minute 35:25

    • @KevinSidwar
      @KevinSidwar  3 ปีที่แล้ว

      Thanks so much for including such detailed steps to help the community. You're awesome!!

  • @gusgonnet
    @gusgonnet 2 ปีที่แล้ว +1

    This was very useful Kevin, thank you!

    • @KevinSidwar
      @KevinSidwar  2 ปีที่แล้ว

      Thanks Gustavo. I appreciate the comment. Have a great week.

  • @nhanNguyen-wo8fy
    @nhanNguyen-wo8fy 8 หลายเดือนก่อน

    12:10 state of catch2 version
    13:55 how to install

  • @lukaspetrikas6320
    @lukaspetrikas6320 9 หลายเดือนก่อน +1

    Thanks for this video. However, it is still not quite clear for me how to actually implement Unit Tests for real world scenario. For example, how would you unit test your esp32 driver that communicates with accelerometer chip? How would you unit test your code that is responsible for WiFI and BLE? It would be nice to see a real world example that performs Unit tests using mocks and simulated hardware on an actual complex code instead of simple Assert

    • @KevinSidwar
      @KevinSidwar  9 หลายเดือนก่อน

      Hey Lukas, I'm hoping to eventually get around to doing a deeper dive to show exactly the things you mention. Not sure when I'll get to it though. Thanks for watching and thanks for the feedback.

  • @yasirhassan8557
    @yasirhassan8557 3 ปีที่แล้ว +1

    This is great. One question. What not do the TDD for this whole thing.

    • @KevinSidwar
      @KevinSidwar  3 ปีที่แล้ว +1

      Really appreciate you watching Yasir and great question. I am a fan of TDD but I also struggle sometimes to take a purely TDD approach and haven't fully unlocked the magic of it to maintain the pace that I need to get this product delivered on time. Which I fully believe is possible given an expert approach to it but, at this point, it's purely a time tradeoff. I've also found that it doesn't always guide me to the best designs but, again, that could be my inexperience in using it. Hope you have a great week.

  • @DominikDufner
    @DominikDufner ปีที่แล้ว +1

    Thanks for the great tutorial. I just have one issue using gcovr 6. I am able to run the coverage but it seems to skip the actual source files to scan. E.g. it scans the MyComponent.test.cpp but not MyComponent.cpp and .h file like in your example in 44:40.
    I see that in CMakeFiles there are two folders. One ending with MyComponenet_test.dir and if I run the unit_test.exe it will create these .gcda and .gcno files. But not for the MyComponenet.dir
    Does anyone have the same problem?

    • @KevinSidwar
      @KevinSidwar  ปีที่แล้ว

      Are you running gcovr from the test folder or from the root of the project dir? If you don't specify a root directory I think it uses the current one so it would miss all of your actual source files and just get the test ones.

    • @DominikDufner
      @DominikDufner ปีที่แล้ว +1

      @@KevinSidwar Hey, I am running it from the root dir, so it should scan all the files. I think the issue is that no .gcda .gcno files are created for the source files to be tested?
      EDIT: My source file was .c and not .cpp so I had to add the compile flags for C as well.

    • @KevinSidwar
      @KevinSidwar  ปีที่แล้ว

      @@DominikDufner Sweet! So did you get it all to work then?

    • @DominikDufner
      @DominikDufner ปีที่แล้ว

      @@KevinSidwar yes, thanks 👍

  • @Antyelektronika
    @Antyelektronika 3 ปีที่แล้ว +1

    When you will start wirting software for functions etc? (I do not know how to call this), I forgot, thank you for informative video :)

    • @KevinSidwar
      @KevinSidwar  3 ปีที่แล้ว

      Hey Patryk, always great to hear from you. We will begin writing firmware functionality in the next few streams. If you mean software for the backend cloud service it will still be a bit longer. Hope you're having a great week.

  • @8wj5as712js
    @8wj5as712js 3 ปีที่แล้ว

    Hi Kevin, really enjoyed watching your video. Looks like you are all set with unit tests now, but I'd just like to mention that we've been working on adding host-based unit tests to IDF. You can see the first one here: github.com/espressif/esp-idf/tree/master/components/nvs_flash/host_test/nvs_page_test.
    This uses CMock for mocking IDF dependencies and Unity for the tests themselves, although Catch2 would have also worked. Hopefully this will be a publicly usable feature in the future.

    • @KevinSidwar
      @KevinSidwar  ปีที่แล้ว

      Hey Ivan, not sure how I missed this comment. Thanks so much for posting it here