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

“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.

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();
})