OrciD API privide and support data exchage using curl command line calls. This project simulate an automated call iteration.
- pytest
- junit-xml
Already included on requirements.txt file
Before executing the test suite prepare a virtual enviroment using the next commands
rm -rf .py_env results
mkdir results
virtualenv .py_env
. .py_env/bin/activate
pip2 install -r ./requirements.txt
Each test_*.py file at orcid folder is expecting a properties.py file containing at least next key values
test_server=localhost.orcid.org
user_login=ma_test_13feb2017
password=abcxyz
orcidId=0000-0003-4248-6064
searchValue=13feb2017
In order to execute the test suite against the target server
source .py_env/bin/activate
py.test --junitxml results/test_public_api_read_search.xml orcid/test_public_api_read_search.py
At CI server lets create a job to load this repo and execute the test
-
Create new job of type
pipeline
-
Inside node definition include at least next stages
stage('Prepare Environment'){
sh "rm -rf .py_env results"
sh "virtualenv .py_env"
sh "mkdir results"
}
stage('Run Test'){
try {
sh ". .py_env/bin/activate && pip2 install -r ./requirements.txt && py.test --junitxml results/TestLoadRecord.xml TestLoadRecord.py"
} catch(Exception err) {
def err_msg = err.getMessage()
echo "Tests problem: $err_msg"
} finally {
junit 'results/*.xml'
}
}
- Thanks to the
junit
build-in method the results will be available as a report on jenkins build results