Forum Discussion

georgejecook's avatar
georgejecook
Streaming Star
7 years ago

Announcing Rooibos: Unit testing framework for roku.

Fellow roku developers,

I'm pleased to announce Rooibos unit testing framework. It's a fun, easy to use, and extremely powerful Brightscript unit testing framework, inspired by mocha for js.

It's open source, supported, and used in several production environments. The code is a major rewrite of the official unit testing framework for Roku: It is compatible with existing test suites.

In addition, the framework offers many more features, which make Test Drive Development, and all manner of testing far easier and more efficient.

You can incorporate it into your projects, running your existing test suites and writing more tests today!

Go visit the github: https://www.youtube.com/playlist?list=PLJRLV4QDx83vsYMD9bIs-cjoDXmNmO8Jv

Please raise issues and feel free to submit PR's. I'm actively supporting the library. You can get support on the Roku developers slack group: https://join.slack.com/t/rokudevelopers ... TVhNzJiY2M
  • Some updates - I've added 2 new videos to the training series - there's an hour's worth of rooibos training for your viewing delight!

    https://www.youtube.com/playlist?list=P ... oDXmNmO8Jv

    The new videos will teach you how to write tests (103) and how to use the powerful stubs and mocks mechanism (104) to achieve highly efficient and effective unit and integration testing.

    I've also added backward compatibility for the existing unit testing framework - you're running out of excuses to not be achieving testing zen 🙂

    Go check it out: https://github.com/georgejecook/rooibos
  • If you follow the documentation and video tutorial, you will quickly understand how to write tests like this, which will allow you to quickly mock http services, and device apis:

    '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    '@It tests getVideosRealExample
    '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

    '@Test basic test
    '@Params["mp4", ["a", "b", "c"]]
    '@Params["mp3", ["a", "b", "c", "d", "e"]]
    function VMT__getVideosRealExample_basic(videoType, returnedJson) as void
      getjsonMock = m.expectOnce(m.httpService, "getJson", [m.ignoreValue, videoType], returnedJson, true)

      videos = m.module.getVideosRealExample(videoType)
      
      m.AssertArrayContainsSubset(videos, returnedJson)
    end function

    Which results in the following test output:

  • rymawby's avatar
    rymawby
    Binge Watcher
    George this looks awesome! Thanks for developing it - I'm going to give it a go over the next couple of days. 
  • Hi guys!.

    I'm trying to configure this framework in my project, Does anyone have any tutorial to do this?.

    I'm blocked, I don't know what I need put in my makefile or manifest file.

    Thanks.

    • vikashs099's avatar
      vikashs099
      Newbie

      I am also trying to integrate Rooibos and getting error

      Error when loading plugin 'rooibos-roku': Error: Cannot find module 'brighterscript/dist/astUtils'

      in bsconfig.json I added

      {
          "plugins": [
                 "rooibos-roku"
          ]
      }

      Am I Missing something. Anyone can suggest, would be grateful 

      • ravali121's avatar
        ravali121
        Newbie

        Make sure brighterscript exists in node_modules folder. If not do `npm install brighterscript`. That should fix it