[21337] | 1 | Index: ../trunk-jpl/jenkins/javascript/karma/scripts/specs/generate-spec.sh
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/jenkins/javascript/karma/scripts/specs/generate-spec.sh (revision 0)
|
---|
| 4 | +++ ../trunk-jpl/jenkins/javascript/karma/scripts/specs/generate-spec.sh (revision 20781)
|
---|
| 5 | @@ -0,0 +1,52 @@
|
---|
| 6 | +#!/bin/sh
|
---|
| 7 | +
|
---|
| 8 | +# Create array to store numbers of the tests
|
---|
| 9 | +TESTNUMBERS=()
|
---|
| 10 | +
|
---|
| 11 | +# Location of test scripts
|
---|
| 12 | +SCRIPTDIR=$ISSM_DIR/jenkins/javascript/karma/scripts
|
---|
| 13 | +
|
---|
| 14 | +OLDIFS=$IFS
|
---|
| 15 | +IFS=, # Overwrite the in-field-separator to detect ranges of numbers as numbers separated by commas
|
---|
| 16 | +
|
---|
| 17 | +# Add the test numbers to the array
|
---|
| 18 | +for range in $1; do
|
---|
| 19 | + if [[ ! "$range" =~ "-" ]]; then # check if it is a range of numbers or just a single number
|
---|
| 20 | + TESTNUMBERS+=($range)
|
---|
| 21 | + else
|
---|
| 22 | + SEQUENCE=($(seq -w -s ' ' $(sed "s/-/$IFS/" <<< ${range})))
|
---|
| 23 | + TESTNUMBERS=("${TESTNUMBERS[@]}" "${SEQUENCE[@]}")
|
---|
| 24 | + fi
|
---|
| 25 | +done
|
---|
| 26 | +
|
---|
| 27 | +IFS=$OLDIFS # Reset the in-field-separator
|
---|
| 28 | +
|
---|
| 29 | +# Include necessary functions and constants
|
---|
| 30 | +cat << EOF
|
---|
| 31 | +window.jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000; // Change timeout for Jasmine tests
|
---|
| 32 | +var AJAX_TIMEOUT = 5000;
|
---|
| 33 | +function onAjaxSuccess(data, status, jqxhr) {
|
---|
| 34 | + console.log("Success");
|
---|
| 35 | +}
|
---|
| 36 | +function onAjaxError(jqxhr, status, err) {
|
---|
| 37 | + console.log("Unexpected error: " + err);
|
---|
| 38 | +}
|
---|
| 39 | +EOF
|
---|
| 40 | +
|
---|
| 41 | +# Create stubs for individual tests
|
---|
| 42 | +for num in ${TESTNUMBERS[@]}; do
|
---|
| 43 | +cat << EOF
|
---|
| 44 | +describe("test$num", function() {
|
---|
| 45 | + it("contains test$num", function(done) {
|
---|
| 46 | + $.ajax({
|
---|
| 47 | + url: 'http://localhost:8080/test$num.js',
|
---|
| 48 | + dataType: 'script',
|
---|
| 49 | + success: onAjaxSuccess,
|
---|
| 50 | + error: onAjaxError,
|
---|
| 51 | + complete: function(jqxhr, status) { done(); },
|
---|
| 52 | + timeout: AJAX_TIMEOUT
|
---|
| 53 | + });
|
---|
| 54 | + });
|
---|
| 55 | +});
|
---|
| 56 | +EOF
|
---|
| 57 | +done
|
---|
| 58 |
|
---|
| 59 | Property changes on: ../trunk-jpl/jenkins/javascript/karma/scripts/specs/generate-spec.sh
|
---|
| 60 | ___________________________________________________________________
|
---|
| 61 | Added: svn:executable
|
---|
| 62 | + *
|
---|
| 63 |
|
---|