Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Search instead for 
Did you mean: 
bentoncoding
Level 7

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
Level 7

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. Smiley Sad
0 Kudos
georgejecook
Level 7

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://linkedin.com/in/georgejecook/
Roku developers slack group (http://tiny.cc/nrdf0y) : georgejecook

Contact me on roku developer slack group, or via pm to discuss consultancy/work opportunities/rooibos unit testing framework
0 Kudos