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: 
georgejecook
Streaming Star

Jenkins/CI/Automation/unit testing

Hi, I want to setup CI so that when I merge my project it will automatically build, unit test and deploy.
I'm a bit confused as to how one might do this with say, jenkins, because of the way the testing framework uses telnet.

some of you people must've done this : what did you do to get the test results back from telnet?

i.e. https://github.com/rokudev/unit-testing-framework/blob/master/docs/unit-test-framework.md
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
2 REPLIES 2
nish
Visitor

Re: Jenkins/CI/Automation/unit testing

"georgejecook" wrote:
Hi, I want to setup CI so that when I merge my project it will automatically build, unit test and deploy.
I'm a bit confused as to how one might do this with say, jenkins, because of the way the testing framework uses telnet.

some of you people must've done this : what did you do to get the test results back from telnet?

i.e. https://github.com/rokudev/unit-testing-framework/blob/master/docs/unit-test-framework.md

We built out automated functionality for this in our build tool Ukor.  It generates a test report for you which you can use to view results. It's worth noting that your build server would need to be connected to an actual Roku device to run tests.
0 Kudos
renny_oh
Reel Rookie

Re: Jenkins/CI/Automation/unit testing

open socket and run unit test and trim the result that you need by node.js from jenkins and added time out  

var net = require('net');
var fs = require('fs');

var port = 8085
var host = process.argv[2]
var fileName = process.argv[3]
var isLogging = false

var socket = net.connect(port, host, function() {
    console.log('[[ socket start ]] at ', new Date());
    socket.setTimeout(1000*60*2)
})

socket.on("error", function(err) {
    console.log("Error");
    console.log(err);
})

socket.on("close", function(err) {
    if (isLogging) {
        console.log("Connection closed");
    } else {
        console.log("Connection retry");
        socket.connect(port, host)
    }
})

socket.on("data", function (data) {
    string = data.toString()
    if (!isLogging && string.includes("TEST START")){
        isLogging = true
    } 
    if (isLogging) {
        if (string.includes("START TEST REPORT")) {
            string = "[START TEST REPORT]\n" + string.split("[START TEST REPORT]")[1]
            fs.writeFileSync(fileName, string);
        } else {
            fs.appendFileSync(fileName, string);
        }
    }
    if (isLogging && string.includes("RESULT:")) {
        isLogging = false
        console.log('- RESULT:' + string.split("RESULT:")[1]);
        console.log('[[ socket end ]] at ', new Date());
        socket.end();
        socket.destroy();
    }
})

socket.on("timeout", function(err) {
    console.log("Connection closed");
    console.log('- unit Test Time out, please check the connection, either slowness or broken script');
    console.log('[[ socket end ]] at ', new Date());
    socket.end();
    socket.destroy();
})
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.