Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | 1x 1x 1x 1x 1x 1x | /** GPII Acceptance Testing Copyright 2013 Raising the Floor International Copyright 2013 OCAD University Copyright 2014 Lucendo Development Ltd. Licensed under the New BSD license. You may not use this file except in compliance with this License. The research leading to these results has received funding from the European Union's Seventh Framework Programme (FP7/2007-2013) under grant agreement no. 289016. You may obtain a copy of the License at https://github.com/GPII/universal/blob/master/LICENSE.txt */ "use strict"; var fluid = require("infusion"), gpii = fluid.registerNamespace("gpii"), child_process = require("child_process"); // Component which manages execution and observation of an arbitrary process // By default, will make 12 attempts spaced by 500ms to execute it with the expected output fluid.defaults("gpii.test.acceptance.exec", { gradeNames: ["gpii.test.common.exec"], invokers: { exec: { funcName: "gpii.test.acceptance.exec.exec", args: ["{that}", "{arguments}.0", "{arguments}.1"] } }, timeout: 500, maxTimeouts: 12 }); gpii.test.acceptance.exec.exec = function (that, processSpec, expected) { var command = processSpec.command, timeout = processSpec.timeout || that.options.timeout, maxTimeouts = processSpec.maxTimeouts || that.options.maxTimeouts; fluid.log("Executing: ", command); child_process.exec(command, function (err, stdout, stderr) { if (stderr) { fluid.log("stderr from command \"", command, "\": ", stderr); } if (stdout.trim() === expected) { that.events.onExecExit.fire(true, processSpec); } else { processSpec.count = processSpec.count || 0; if (processSpec.count >= maxTimeouts) { that.events.onExecExit.fire(false, processSpec); return; } processSpec.count++; setTimeout(function () { gpii.test.acceptance.exec.exec(that, processSpec, expected); }, timeout); } }); }; fluid.defaults("gpii.test.acceptance.testCaseHolder", { gradeNames: ["gpii.test.common.testCaseHolder"], components: { exec: { type: "gpii.test.acceptance.exec" } } }); |