Skip to content

Commit 20fc4dc

Browse files
authored
Merge pull request #10 from SmartBear/TSERV-697-add-security-test-support
TSERV-697: add security test support
2 parents bf3997e + 500d521 commit 20fc4dc

3 files changed

Lines changed: 23 additions & 10 deletions

File tree

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,11 @@ table includes the currently implemented options.
6969
| skipdeps | N/A | Do not scan project for dependencies. This will improve performance for large projects without dependences to external files |
7070
| testsuite | TestSuite1 | Name of a test suite to run|
7171
| testcase | JRA-11224 | Name of a specific test case to run. Typically used together with **testsuite** because a project can have several test cases with the same name in different test suites.|
72+
| securitytest | SecurityTest1 | Name of a security test to run. Can not be used with **testsuite** or **testcase**.
7273
| tags | smoketest | Comma separated list of tags. For a test case to be run, it should have all the listed tags. When specifying many tags, or using tags with space in the name, it is possible to surround them with either (), [] or "" but be aware that different operating systems can have special meanings for brackets which requires quoting. Tags cannot be used together with testsuite/testcase specification.|
7374
| tags | "smoketest,regression" | See description above|
7475
| output | c:\\temp\\reports | Directory to store reports in.|
75-
| reportFileName | File name for the report. If omitted, the report will get a name based on the test job ID|
76+
| reportFileName | N/A | File name for the report. If omitted, the report will get a name based on the test job ID|
7677
| format | excel | Specify the file type of the report. Currently supported formats are json, junit, excel and pdf. The default format is junit|
7778
| proxyHost | 172.0.1.10 | Hostname or IP of the server to use as a proxy for outgoing requests (from TestEngine)|
7879
| proxyPort | 8888 | Port of the proxyHost to contact for outgoing requests (from TestEngine)|
@@ -123,7 +124,7 @@ The "output" argument is mandatory, "format" is optional.
123124
| Option | Sample Value | Description|
124125
|---|---|---|
125126
| output | c:\\temp\\reports | Directory to store reports in.|
126-
| reportFileName | File name for the report. If omitted, the report will get a name based on the test job ID|
127+
| reportFileName | N/A | File name for the report. If omitted, the report will get a name based on the test job ID|
127128
| format | excel | Specify the file type of the report. Currently supported formats are json, junit, excel and pdf. The default format is junit|
128129

129130
### Clean up old jobs from the server database

bin/jobs_functions.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -328,9 +328,9 @@ function dumpArrayAsJson(jsonData) {
328328

329329
function csvLine(data, header = false) {
330330
if (header) {
331-
return '"Status", "Project", "User", "Submitted", "Submitted Millis", "Time in Queue (ms)", "Run time (ms)", "Test Suite", "Test Case", "Tags", "Job Id"';
331+
return '"Status", "Project", "User", "Submitted", "Submitted Millis", "Time in Queue (ms)", "Run time (ms)", "Test Suite", "Test Case", "Security Test", "Tags", "Job Id"';
332332
} else {
333-
return sprintf('"%s", "%s", "%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s"',
333+
return sprintf('"%s", "%s", "%s", "%s", %d, %d, %d, "%s", "%s", "%s", "%s", "%s"',
334334
util.csvQuoteQuotes(data.status),
335335
util.csvQuoteQuotes(data.projectName),
336336
util.csvQuoteQuotes(data.userName),
@@ -342,6 +342,8 @@ function csvLine(data, header = false) {
342342
util.csvQuoteQuotes(data.executionParameters['testSuiteName']) : '',
343343
'testCaseName' in data.executionParameters ?
344344
util.csvQuoteQuotes(data.executionParameters['testCaseName']) : '',
345+
'securityTestName' in data.executionParameters ?
346+
util.csvQuoteQuotes(data.executionParameters['securityTestName']) : '',
345347
'tags' in data.executionParameters ?
346348
util.csvQuoteQuotes(data.executionParameters['tags'].join(', ')) : '',
347349
util.csvQuoteQuotes(data.testjobId),
@@ -351,11 +353,11 @@ function csvLine(data, header = false) {
351353

352354
function textLine(data, header = false) {
353355
if (header) {
354-
return sprintf('%-10s %-20s %-10s %-25s %-13s %-11s %-13s %-30s %-20s %-20s %-20s' +
356+
return sprintf('%-10s %-20s %-10s %-25s %-13s %-11s %-13s %-30s %-20s %-20s %-20s %-20s' +
355357
'\n==========================================================================================================================================================================================================================',
356-
"Status", "Project", "User", "Submitted", "Submitted ms", "Queued (ms)", "Run time (ms)", "Test Suite", "Test Case", "Tags", "Job Id");
358+
"Status", "Project", "User", "Submitted", "Submitted ms", "Queued (ms)", "Run time (ms)", "Test Suite", "Test Case", "Security Test", "Tags", "Job Id");
357359
} else {
358-
return sprintf('%-10s %-20s %-10s %-25s %13d %11d %13d %-30s %-20s %-20s %-20s',
360+
return sprintf('%-10s %-20s %-10s %-25s %13d %11d %13d %-30s %-20s %-20s %-20s %-20s',
359361
util.csvQuoteQuotes(data.status),
360362
util.csvQuoteQuotes(data.projectName),
361363
util.csvQuoteQuotes(data.userName),
@@ -367,6 +369,8 @@ function textLine(data, header = false) {
367369
util.csvQuoteQuotes(data.executionParameters['testSuiteName']) : '',
368370
'testCaseName' in data.executionParameters ?
369371
util.csvQuoteQuotes(data.executionParameters['testCaseName']) : '',
372+
'securityTestName' in data.executionParameters ?
373+
util.csvQuoteQuotes(data.executionParameters['securityTestName']) : '',
370374
'tags' in data.executionParameters ?
371375
util.csvQuoteQuotes(data.executionParameters['tags'].join(', ')) : '',
372376
util.csvQuoteQuotes(data.testjobId),

bin/run_functions.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ module.exports.dispatcher = function (args) {
2424
'=async',
2525
'=skipdeps',
2626
'testsuite',
27+
'securitytest',
2728
'tags',
2829
'environment',
2930
'output',
@@ -47,24 +48,28 @@ module.exports.dispatcher = function (args) {
4748
printModuleHelp();
4849
break;
4950
default:
50-
util.error("Unknown operatation");
51+
util.error("Unknown operation");
5152
break;
5253
}
5354
};
5455

5556
function printModuleHelp() {
5657
util.error("Usage: testengine run <command>");
5758
util.error("Commands: ");
58-
util.error(" project [testsuite=<name>] [async] [skipdeps] [testcase=<name>] [timeout=<seconds>] [tags=(tag1,tag2)] [output=<directory>] [reportFileName=<filename>] [format=junit/excel/json/pdf] [environment=<environment name>]");
59+
util.error(" project [testsuite=<name>] [async] [skipdeps] [testcase=<name>] [securitytest=<name>] [timeout=<seconds>] [tags=(tag1,tag2)] [output=<directory>] [reportFileName=<filename>] [format=junit/excel/json/pdf] [environment=<environment name>]");
5960
util.error(" [projectPassword=<password>] [proxyHost=<hostname>] [proxyPort=<port>] [proxyUser=<username>]");
6061
util.error(" [proxyPassword=<password>] <filename>");
6162
util.error(" help");
6263
}
6364

6465
function conflictingOptionsCheck(options) {
66+
if (('securitytest' in options) && (('testcase' in options) || ('testsuite' in options))) {
67+
util.error('Error: Parameters testsuite and testcase are not allowed when securitytest is used');
68+
return false;
69+
}
6570
if ('tags' in options) {
6671
if (('testsuite' in options) || ('testcase' in options)) {
67-
util.error('Error: tags are cannot be used together with testcase/testsuite ');
72+
util.error('Error: tags cannot be used together with testcase/testsuite ');
6873
return false;
6974
}
7075
}
@@ -164,6 +169,9 @@ function getQueryStringFromOptions(options) {
164169
case 'testcase':
165170
queryStringPart = 'testCaseName=' + encodeURI(options[key]);
166171
break;
172+
case 'securitytest':
173+
queryStringPart = 'securityTestName=' + encodeURI(options[key]);
174+
break;
167175
case 'tags': {
168176
let tags = options[key];
169177
let mr = /[("[]?([^)"\]]+)[)"\]]?/.exec(tags);

0 commit comments

Comments
 (0)