Comparing version 1.0.2 to 1.0.3
@@ -12,3 +12,3 @@ import './polyfills'; | ||
runAsyncFunctional(config: any, paramsOrCallback?: Loadmill.ParamsOrCallback, callback?: Loadmill.Callback): Promise<Loadmill.TestResult>; | ||
runTestSuite(suiteId: string, paramsOrCallback?: Loadmill.ParamsOrCallback, callback?: Loadmill.Callback): Promise<Loadmill.TestDef>; | ||
runTestSuite(suite: string | Loadmill.TestSuiteDef, paramsOrCallback?: Loadmill.ParamsOrCallback, callback?: Loadmill.Callback): Promise<Loadmill.TestDef>; | ||
}; | ||
@@ -25,2 +25,3 @@ declare namespace Loadmill { | ||
id: string; | ||
additionalDescription: string; | ||
} | ||
@@ -27,0 +28,0 @@ interface TestResult extends TestDef { |
@@ -179,5 +179,12 @@ "use strict"; | ||
var _this = this; | ||
var overrideParameters; | ||
var overrideParameters, suiteId, additionalDescription; | ||
return tslib_1.__generator(this, function (_a) { | ||
overrideParameters = typeof paramsOrCallback !== 'function' ? paramsOrCallback : {}; | ||
if (typeof suite === 'string') { | ||
suiteId = suite; | ||
} | ||
else { | ||
suiteId = suite.id; | ||
additionalDescription = suite.additionalDescription; | ||
} | ||
return [2 /*return*/, wrap(function () { return tslib_1.__awaiter(_this, void 0, void 0, function () { | ||
@@ -187,4 +194,4 @@ var testSuiteRunId; | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, superagent.post(testingServer + "/api/test-suites/" + suite.id + "/run") | ||
.send({ overrideParameters: overrideParameters }) | ||
case 0: return [4 /*yield*/, superagent.post(testingServer + "/api/test-suites/" + suiteId + "/run") | ||
.send({ overrideParameters: overrideParameters, additionalDescription: additionalDescription }) | ||
.auth(token, '')]; | ||
@@ -275,4 +282,3 @@ case 1: | ||
}, | ||
runTestSuite: function (suiteId, paramsOrCallback, callback) { | ||
var suite = { id: suiteId }; | ||
runTestSuite: function (suite, paramsOrCallback, callback) { | ||
return _runTestSuite(suite, paramsOrCallback, callback); | ||
@@ -279,0 +285,0 @@ } |
@@ -15,2 +15,3 @@ "use strict"; | ||
.option("-s, --test-suite", "Launch a test suite. If set then a test suite id must be provided instead of config file.") | ||
.option("--additional-description <description>", "Add an aditional description at the end of the current suite's description - available only for test suites.") | ||
.option("-a, --async", "Run the test asynchronously - affects only functional tests. " + | ||
@@ -32,7 +33,7 @@ "Use this if your test can take longer than 25 seconds (otherwise it will timeout).") | ||
return tslib_1.__awaiter(this, void 0, void 0, function () { | ||
var wait, bail, async, quiet, token, verbose, colors, local, loadTest, testSuite, _a, input, rawParams, logger, parameters, loadmill, res, running, testSuiteRunId, fileOrFolder, listOfFiles, _i, listOfFiles_1, file, res, id, method; | ||
var wait, bail, async, quiet, token, verbose, colors, local, loadTest, testSuite, additionalDescription, _a, input, rawParams, logger, parameters, loadmill, res, suite, running, testSuiteRunId, fileOrFolder, listOfFiles, _i, listOfFiles_1, file, res, id, method; | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
wait = program.wait, bail = program.bail, async = program.async, quiet = program.quiet, token = program.token, verbose = program.verbose, colors = program.colors, local = program.local, loadTest = program.loadTest, testSuite = program.testSuite, _a = program.args, input = _a[0], rawParams = _a.slice(1); | ||
wait = program.wait, bail = program.bail, async = program.async, quiet = program.quiet, token = program.token, verbose = program.verbose, colors = program.colors, local = program.local, loadTest = program.loadTest, testSuite = program.testSuite, additionalDescription = program.additionalDescription, _a = program.args, input = _a[0], rawParams = _a.slice(1); | ||
logger = new utils_1.Logger(verbose, colors); | ||
@@ -55,2 +56,4 @@ if (!token) { | ||
loadTest: loadTest, | ||
testSuite: testSuite, | ||
additionalDescription: additionalDescription, | ||
parameters: parameters | ||
@@ -65,3 +68,4 @@ }); | ||
res = void 0; | ||
return [4 /*yield*/, loadmill.runTestSuite(input, parameters)]; | ||
suite = { id: input, additionalDescription: additionalDescription }; | ||
return [4 /*yield*/, loadmill.runTestSuite(suite, parameters)]; | ||
case 1: | ||
@@ -68,0 +72,0 @@ running = _b.sent(); |
{ | ||
"name": "loadmill", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A node.js module for running load tests and functional tests on loadmill.com", | ||
@@ -10,3 +10,5 @@ "keywords": [ | ||
"ci", | ||
"functional-testing" | ||
"functional-testing", | ||
"test-suites", | ||
"api-testing" | ||
], | ||
@@ -13,0 +15,0 @@ "bin": { |
@@ -128,7 +128,11 @@ # Loadmill | ||
Test suites are launched and not awaiting the results. | ||
You can add an additional description at the end of the current suite's description by supplying the optional `additionalDescription` field. | ||
You can explicitly wait for a test to finish using the `wait` function: | ||
```js | ||
loadmill.runTestSuite("test-suite-uuid") | ||
// -> [{id: string}] | ||
.then(result => console.log(result)); | ||
loadmill.runTestSuite({ | ||
id: "test-suite-uuid", | ||
additionalDescription: "description to add" | ||
}) | ||
// -> [{id: string}] | ||
.then(result => console.log(result)); | ||
``` | ||
@@ -199,2 +203,4 @@ | ||
You can add an additional description at the end of the current suite's description by supplying the optional `--additional-description <description>` option. | ||
### Exit Status | ||
@@ -219,3 +225,4 @@ | ||
- `-l, --load-test` Launch a load test. If not set, a functional test will run instead. | ||
- `-s, --test-suite` Launch a test suite. If set then a test suite id must be provided instead of config file.. | ||
- `-s, --test-suite` Launch a test suite. If set then a test suite id must be provided instead of config file. | ||
- `--additional-description <description>` Add an aditional description at the end of the current suite's description - available only for test suites. | ||
- `-a, --async` Run the test asynchronously - affects only functional tests. Use this if your test can take longer than 25 seconds (otherwise it will timeout). | ||
@@ -222,0 +229,0 @@ - `-w, --wait` Wait for the test to finish. Functional tests are automatically waited on unless async flag is turned on. |
@@ -170,3 +170,3 @@ import './polyfills' | ||
async function _runTestSuite( | ||
suite: Loadmill.TestSuiteDef, | ||
suite: Loadmill.TestSuiteDef | string, | ||
paramsOrCallback: Loadmill.ParamsOrCallback, | ||
@@ -176,2 +176,11 @@ callback: Loadmill.Callback) { | ||
const overrideParameters = typeof paramsOrCallback !== 'function' ? paramsOrCallback : {}; | ||
let suiteId, additionalDescription; | ||
if (typeof suite === 'string') { // need to depricate the option of string in 2.x version | ||
suiteId = suite; | ||
} else { | ||
suiteId = suite.id; | ||
additionalDescription = suite.additionalDescription; | ||
} | ||
return wrap( | ||
@@ -183,4 +192,4 @@ async () => { | ||
} | ||
} = await superagent.post(`${testingServer}/api/test-suites/${suite.id}/run`) | ||
.send({ overrideParameters }) | ||
} = await superagent.post(`${testingServer}/api/test-suites/${suiteId}/run`) | ||
.send({ overrideParameters, additionalDescription }) | ||
.auth(token, ''); | ||
@@ -285,7 +294,6 @@ | ||
runTestSuite( | ||
suiteId: string, | ||
suite: string | Loadmill.TestSuiteDef, | ||
paramsOrCallback?: Loadmill.ParamsOrCallback, | ||
callback?: Loadmill.Callback): Promise<Loadmill.TestDef> { | ||
const suite = { id: suiteId }; | ||
return _runTestSuite(suite, paramsOrCallback, callback); | ||
@@ -389,2 +397,3 @@ }, | ||
id: string; | ||
additionalDescription: string; | ||
} | ||
@@ -391,0 +400,0 @@ |
@@ -15,2 +15,3 @@ import * as Loadmill from './index'; | ||
.option("-s, --test-suite", "Launch a test suite. If set then a test suite id must be provided instead of config file.") | ||
.option("--additional-description <description>", "Add an aditional description at the end of the current suite's description - available only for test suites.") | ||
.option("-a, --async", "Run the test asynchronously - affects only functional tests. " + | ||
@@ -46,2 +47,3 @@ "Use this if your test can take longer than 25 seconds (otherwise it will timeout).") | ||
testSuite, | ||
additionalDescription, | ||
args: [input, ...rawParams] | ||
@@ -71,2 +73,4 @@ } = program; | ||
loadTest, | ||
testSuite, | ||
additionalDescription, | ||
parameters, | ||
@@ -83,3 +87,4 @@ }); | ||
let res; | ||
let running = await loadmill.runTestSuite(input, parameters); | ||
const suite: Loadmill.TestSuiteDef = { id: input, additionalDescription }; | ||
let running = await loadmill.runTestSuite(suite, parameters); | ||
@@ -89,3 +94,3 @@ if (running && running.id) { | ||
const testSuiteRunId = running.id; | ||
if (wait) { | ||
@@ -95,3 +100,3 @@ logger.verbose("Waiting for test suite:", testSuiteRunId); | ||
} | ||
if (!quiet) { | ||
@@ -98,0 +103,0 @@ logger.log(res ? getObjectAsString(res, colors) : testSuiteRunId); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109687
1454
232