summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jjb/releng/testapi-automate.yml21
-rw-r--r--jjb/releng/testapi-run-tests.sh17
-rwxr-xr-xutils/test/testapi/run_test.sh44
-rw-r--r--utils/test/testapi/test-requirements.txt7
4 files changed, 57 insertions, 32 deletions
diff --git a/jjb/releng/testapi-automate.yml b/jjb/releng/testapi-automate.yml
index c03835279..25ee687e2 100644
--- a/jjb/releng/testapi-automate.yml
+++ b/jjb/releng/testapi-automate.yml
@@ -49,6 +49,25 @@
builders:
- run-unit-tests
+ publishers:
+ - junit:
+ results: nosetests.xml
+ - cobertura:
+ report-file: "coverage.xml"
+ only-stable: "true"
+ health-auto-update: "true"
+ stability-auto-update: "true"
+ zoom-coverage-chart: "true"
+ targets:
+ - files:
+ healthy: 10
+ unhealthy: 20
+ failing: 30
+ - method:
+ healthy: 50
+ unhealthy: 40
+ failing: 30
+
- job-template:
name: 'testapi-automate-{stream}'
@@ -98,7 +117,7 @@
name: run-unit-tests
builders:
- shell: |
- bash ./jjb/releng/testapi-run-tests.sh
+ bash ./utils/test/testapi/run_test.sh
- builder:
name: docker-update
diff --git a/jjb/releng/testapi-run-tests.sh b/jjb/releng/testapi-run-tests.sh
deleted file mode 100644
index 47691ed04..000000000
--- a/jjb/releng/testapi-run-tests.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/bash
-set -o errexit
-
-echo "Running unit tests..."
-
-# Creating virtual environment
-virtualenv $WORKSPACE/testapi_test_venv
-source $WORKSPACE/testapi_test_venv/bin/activate
-
-cd $WORKSPACE/utils/test/testapi/
-
-# Install requirements
-pip install -r requirements.txt
-pip install -r test-requirements.txt
-
-# Run unit tests
-bash run_test.sh
diff --git a/utils/test/testapi/run_test.sh b/utils/test/testapi/run_test.sh
index 9b25f8ffc..d1f05f201 100755
--- a/utils/test/testapi/run_test.sh
+++ b/utils/test/testapi/run_test.sh
@@ -1,10 +1,40 @@
-#! /bin/bash
+#!/bin/bash
-# Before run this script, make sure that testtools and discover
-# had been installed in your env
-# or else using pip to install them as follows:
-# pip install testtools, discover
+set -o errexit
+
+# Get script directory
+SCRIPTDIR=`dirname $0`
+
+# Either Workspace is set (CI)
+if [ -z $WORKSPACE ]
+then
+ WORKSPACE="."
+fi
+
+echo "Running unit tests..."
+
+# Creating virtual environment
+virtualenv $WORKSPACE/testapi_venv
+source $WORKSPACE/testapi_venv/bin/activate
+
+# Install requirements
+pip install -r $SCRIPTDIR/requirements.txt
find . -type f -name "*.pyc" -delete
-testrargs="discover ./opnfv_testapi/tests/unit"
-python -m testtools.run $testrargs
+
+nosetests --with-xunit \
+ --with-coverage \
+ --cover-erase \
+ --cover-package=$SCRIPTDIR/opnfv_testapi/cmd \
+ --cover-package=$SCRIPTDIR/opnfv_testapi/commonn \
+ --cover-package=$SCRIPTDIR/opnfv_testapi/resources \
+ --cover-package=$SCRIPTDIR/opnfv_testapi/router \
+ --cover-xml \
+ --cover-html \
+ $SCRIPTDIR/opnfv_testapi/tests
+
+exit_code=$?
+
+deactivate
+
+exit $exit_code
diff --git a/utils/test/testapi/test-requirements.txt b/utils/test/testapi/test-requirements.txt
deleted file mode 100644
index ddbdefcfd..000000000
--- a/utils/test/testapi/test-requirements.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-# The order of packages is significant, because pip processes them in the order
-# of appearance. Changing the order has an impact on the overall integration
-# process, which may cause wedges in the gate later.
-
-testtools>=1.4.0
-discover
-futures \ No newline at end of file