Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
bentoncoding
Visitor

Re: Unit testing on Roku?

I have setup CI server for our roku application, but it requires an external server to handle the build webhook, and parsing the test results into something meaningful. 

I am using https://github.com/rokudev/unit-testing-framework to accomplish this. 
0 Kudos
nish
Visitor

Re: Unit testing on Roku?

We built out some functionality for this on  ukor. It includes the ability to generate test reports. But unfortunately you still require a physical device to run your tests. 😞
0 Kudos
georgejecook
Streaming Star

Re: Unit testing on Roku?

I've (imho) vastly improved the framework, with the use of tags

https://github.com/georgejecook/unit-testing-framework

###New tags

'@TestSuite [NAME OF TESTSUITE] - denotes that a file is a testsuite. Must be at the top of the file (must be within the first 100 lines). e.g. '@TestSuite My super duper test suite

'@It [NAME OF TEST GROUP] - describes a block of tests - e.g. @It tests the constructor or '@It tests the generator methods. All following '@Test declarations will belong to this @It group, until the next @It group or end of file. These groups can accept the tags '@Only and '@Ignore

'@Test [NAME OF TEST] - Indicates the following method is a test case. Must be the line before a method - if name is provided, it will be used in reporting; otherwise the function name is used

'@Setup - Indicates the following method will Setup the '@It group. Must be the line before a method. This property will be applied to all following '@It groups. This allows you to specify the setup for every group in the file, or override it for specific groups.

'@Teardown - Indicates the following method will teardown the test suite. Must be the line before a method. This property will be applied to all following '@It groups. This allows you to specify the setup for every group in the file, or override it for specific groups.

'@BeforeEach - Indicates the following method will Run before EVERY test in the suite. Must be the line before a method. This property will be applied to all following '@It groups. This allows you to specify the setup for every group in the file, or override it for specific groups.

'@AfterEach - Indicates the following method will Run after EVERY test in the suite. Must be the line before a method. This property will be applied to all following '@It groups. This allows you to specify the setup for every group in the file, or override it for specific groups.

'@Ignore - Indicates that the next '@It, '@Test, '@TestSuite is to be ignored when the tests run. Must be the line before a '@Test/'@TestSuite tag

'@Only - Indicates that the ONLY this test/testsuite will run. Affects the next '@It, '@Test, '@TestSuite tag . This tag is accumluative. i.e. if you have several '@Only tags, then all of the '@Solo tagged tests will run.

Tag case is importan. ####Example


'@TestSuite [ETC] ExampleTestComponent test suite

'Note the ETC__ name space, and me putting [ETC] in the suite name, is not require. I just do it coz it works for me for namepsacing/readability

'@Setup
function ETC__SetUp()
    'This setup method will apply to all it groups in the test
    ? "setting up test suite for " ; m.Name
end function

'@BeforeEach
function ETC__BeforeEach()
    'This beforeEach method will apply to all it groups in the test
end function


'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'@It tests basic functionality
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

'@Test
function ETC__basicTest() As String
  return m.AssertEqual("true", "true")
end function

'@Ignore
'@Test
function ETC__basicTest() As String
  'This test is ignored
  return m.AssertEqual("true", "true")
end function

'@Only
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'@It tests another method
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

'@Test
function ETC__AnotherMethod1() As String
return m.AssertEqual("true", "true")
end function

'@Test
function ETC__AnotherMethod2() As String
'This test is ignored
return m.AssertEqual("true", "true")
end function

'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
'@It tests some connectivity stuff
'+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

'@Test
function ETC__Connect1() As String
return m.AssertEqual("true", "true")
end function

'@Test
function ETC__Connect2() As String
'This test is ignored
return m.AssertEqual("true", "true")
end function
George Cook
https://georgejecook.github.io/
https://linkedin.com/in/georgejecook/
Roku developers slack group (https://join.slack.com/t/rokudevelopers/shared_invite/zt-4vw7rg6v-NH46oY7hTktpRIBM_zGvwA) : georgejecook

Contact me on roku developer slack group, or via pm to discuss consultancy/work opportunities/rooibos unit testing framework
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.