# Proposal: Enable unit testing Kaleidoscopes core and client plugins by Dependency Inversion

**URL:** <https://community.keyboard.io/t/proposal-enable-unit-testing-kaleidoscopes-core-and-client-plugins-by-dependency-inversion/1245>\
**Category:** Kaleidoscope Internals\
**Created:** [March 12, 2018, 11:02pm UTC](https://community.keyboard.io/t/proposal-enable-unit-testing-kaleidoscopes-core-and-client-plugins-by-dependency-inversion/1245 "2018-03-12T23:02:09Z")\
**Posts on this page:** 7\
**Page:** 2

<div class="post-metadata">

**Author:** ![jesse](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/jesse/32/361_2.png) [@jesse](https://community.keyboard.io/u/jesse)\
**Post date:** [March 21, 2018, 7:11pm UTC](https://community.keyboard.io/t/proposal-enable-unit-testing-kaleidoscopes-core-and-client-plugins-by-dependency-inversion/1245/21 "2018-03-21T19:11:27Z")

</div>

> [@noseglasses](#):
>
> Thanks, that looks like a possible way. I am just not very experienced with newsfeeds. I will see how I could do the polling automatically…

Really, you can just model it as a hosted XML API that returns a list of versions 😉

---

<div class="post-metadata">

**Author:** ![noseglasses](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/noseglasses/32/429_2.png) [@noseglasses](https://community.keyboard.io/u/noseglasses)\
**Post date:** [March 21, 2018, 7:21pm UTC](https://community.keyboard.io/t/proposal-enable-unit-testing-kaleidoscopes-core-and-client-plugins-by-dependency-inversion/1245/22 "2018-03-21T19:21:58Z")

</div>

> [@jesse](#):
>
> If getting Kaleidoscope-Builder to support a prebuild command at the top level would be ‘enough’ for you to feel comfortable using the standard build infrastructure instead of having to maintain your own, that should be a relatively tiny change that could be done quite quickly.

The build steps I need are quite complex. That’s where CMake is really great as it allows **everything** to be done completely platform independent.

I am not sure how this could be done with Kaleidoscope-Builder. I just imagine a lot of non-portable scripting or similarly non-portable Makefiles. That’s something I am less comfortable with than CMake. But if arbitrary pre-build steps could be executed from Kaleidoscope-Builder or, preferably, Arduino-Builder, that would be great. Then, everything could be separated nicely and I could continue to use CMake for the rest.

> [@jesse](#):
>
> Really, you can just model it as a hosted XML API that returns a list of versions 😉

If that was a joke, I missed it. I have no idea what you are talking about. I really haven’t worked with newsfeeds before. 😐

---

<div class="post-metadata">

**Author:** ![jesse](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/jesse/32/361_2.png) [@jesse](https://community.keyboard.io/u/jesse)\
**Post date:** [March 21, 2018, 10:11pm UTC](https://community.keyboard.io/t/proposal-enable-unit-testing-kaleidoscopes-core-and-client-plugins-by-dependency-inversion/1245/23 "2018-03-21T22:11:45Z")

</div>

> [@noseglasses](#):
>
> But if arbitrary pre-build steps could be executed from Kaleidoscope-Builder or, preferably, Arduino-Builder, that would be great. Then, everything could be separated nicely and I could continue to use CMake for the rest.

Right. From kaleidoscope-builder, it’s easyish for us to add a hook point to run some script or command of your choosing before build. Then you could use cmake for your ‘external’ stuff.

I want there to be some way to do that with arduino-builder, but I’m not aware of one

> [@noseglasses](#):
>
> If that was a joke, I missed it. I have no idea what you are talking about. I really haven’t worked with newsfeeds before. 😐

Ah, no. I was serious. I figured that you might have some experience with XML API endpoints.

And you really can treat an atom feed as a read-only XML API endpoint at a stable URL. It’ll return you a list of items + metadata that you can consume from just about any tool. The items all have timestamps. You can just parse the list to a data structure (using your own code or one of many Atom parsers), sort by date and grab the latest entry.

---

<div class="post-metadata">

**Author:** ![kriber](https://avatars.discourse-cdn.com/v4/letter/k/cdc98d/32.png) [@kriber](https://community.keyboard.io/u/kriber)\
**Post date:** [March 21, 2018, 11:57pm UTC](https://community.keyboard.io/t/proposal-enable-unit-testing-kaleidoscopes-core-and-client-plugins-by-dependency-inversion/1245/24 "2018-03-21T23:57:20Z")

</div>

> [@noseglasses](#):
>
> Leidokos-CMake was just released recently. It is build and tested automatically on Windows, MacOS and Linux.
> 
> You could contact me and ask for support. That way, I could improve the documentation where necessary to also provide a better experience for other users.
> 
> I definitely would prefer that to you writing that you failed miserably ☹

Sorry for being so blunt and thank you for providing constructive criticism in return 👍. I will try to reconstruct what i remember and report it back to you.  
If i find the time i will retry based on your recent fix and report anything i find along the way.

> [@jesse](#):
>
> Yeah. I’ve spent days of time with avrsim and simulavr, which appear to be the most developed freely available option. Neither had working support for a 32U4 that could speak USB.
> 
> As to mocking Arduino, that’s [https://github.com/keyboardio/Kaleidoscope-Hardware-Virtual](https://github.com/keyboardio/Kaleidoscope-Hardware-Virtual) - I’d love to see it generalized some.

> [@noseglasses](#):
>
> We had some discussions about this topic here.

And again i need to apologize: You guys invested tons of time investigating those areas and i jump in without a clue about many of the involved specifics. Regarding the Arduino simulators i overlooked the fact that most of them are not free. 🙁

---

<div class="post-metadata">

**Author:** ![noseglasses](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/noseglasses/32/429_2.png) [@noseglasses](https://community.keyboard.io/u/noseglasses)\
**Post date:** [March 22, 2018, 7:15am UTC](https://community.keyboard.io/t/proposal-enable-unit-testing-kaleidoscopes-core-and-client-plugins-by-dependency-inversion/1245/25 "2018-03-22T07:15:54Z")

</div>

> [@kriber](#):
>
> I will try to reconstruct what i remember and report it back to you.
> 
> If i find the time i will retry based on your recent fix and report anything i find along the way.

That would be awsome.

---

<div class="post-metadata">

**Author:** ![noseglasses](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/noseglasses/32/429_2.png) [@noseglasses](https://community.keyboard.io/u/noseglasses)\
**Post date:** [March 22, 2018, 9:14am UTC](https://community.keyboard.io/t/proposal-enable-unit-testing-kaleidoscopes-core-and-client-plugins-by-dependency-inversion/1245/26 "2018-03-22T09:14:16Z")

</div>

> [@kriber](#):
>
> And again i need to apologize: You guys invested tons of time investigating those areas and i jump in without a clue about many of the involved specifics.

You offered your expertise with different sorts of testing and came up with good ideas for possible improvements. There’s nothing wrong with that.

This forum is around for one and a half years. It already accumulated great amounts of content. Valuable nowledge of all sorts. It is just impossible to find out with 100% what has or hasn’t been discussed before - unless you can remember key words or phrases to search for, e.g. because you have taken part in a specific discussion. That’s why I tend to add links that point back to related discussions that I can remember and regard useful.

---

<div class="post-metadata">

**Author:** ![noseglasses](https://yyz1.discourse-cdn.com/flex031/user_avatar/community.keyboard.io/noseglasses/32/429_2.png) [@noseglasses](https://community.keyboard.io/u/noseglasses)\
**Post date:** [April 7, 2018, 6:12pm UTC](https://community.keyboard.io/t/proposal-enable-unit-testing-kaleidoscopes-core-and-client-plugins-by-dependency-inversion/1245/27 "2018-04-07T18:12:27Z")

</div>

> [@kriber](#):
>
> I will try to reconstruct what i remember and report it back to you.
> 
> If i find the time i will retry based on your recent fix and report anything i find along the way.

@kriber just provided me with some great detailed feedback about problems he encountered using Leidokos-CMake and Leidokos-Python. That will be a great help for improving the documentation!

[Previous page](https://community.keyboard.io/t/proposal-enable-unit-testing-kaleidoscopes-core-and-client-plugins-by-dependency-inversion/1245.md?page=1)
