Test tools allow you to test some operations with your application. This document explains how to run a test based on the pytest framework.
In this document:
The platform you use for testing your integration package must meet the Prerequisites stated in the deployment phase.
The OSS management node is installed on a RHEL or CenOS operating system that allow installing
packages through the yum
package manager. On a test system, you should add the
python-setuptools
package and then use the easy_install
Python package manager
to install the pytest
package.
The following steps make your platform ready for testing.
Install the python-setuptools
package:
# yum install python-setuptools
Install the pytest
framework:
# easy_install pytest
Once you have done it, the management node is ready to run your application test.
On the OSS management node, run the predefined script to test your APS package as follows.
Create a folder and place the following two files into it:
test_app.py
- an auto-test scriptIf you do not have your own APS package, use the sample package
to study the auto-test script.
Enter inside the folder and run the auto-test script:
# pytest -vv -x test_app.py
The test_app.py
script will discover the package with the app.zip
extension and apply its tests to it.
If all tests passed, you will see the following print-out:
=============================== test session starts =======================================
platform linux2 -- Python 2.7.5, pytest-3.0.7, py-1.4.33, pluggy-0.4.0 -- /usr/bin/python2
cachedir: .cache
rootdir: /root/autotest, inifile:
collected 6 items
test_app.py::TestApp::test_01_import PASSED
test_app.py::TestApp::test_02_instance PASSED
test_app.py::TestApp::test_03_st PASSED
test_app.py::TestApp::test_04_subscription PASSED
test_app.py::TestApp::test_05_hold PASSED
test_app.py::TestApp::test_06_terminate PASSED
================================ 6 passed in 17.75 seconds ================================
If one of the tests fails, the script stops at this test and print out the description of the issue in details.
The auto-test script contains the following sequence of tests that you can extend if necessary:
test_01_import
imports the APS package from the current folder.test_02_instance
installs an APS connector and initiates an APS application instance on the end-point host
using the Docker image you have created earlier in the deployment phase.test_03_st
creates a service template with two main resource types (APS application instance and management context) as defined
in the dictionary aiw_template
inside the test_app.py
script.test_04_subscription
creates a subscription from the new service template.test_05_hold
disables and then enables the subscription.test_06_terminate
terminates the subscription.If you edit this auto-test script or create your own, pay attention to the aiw_template
dictionary.
It defines the product components to be created in the platform using a syntax similar to one explained
in the Product Initialization document.
In the provider control panel, you will find the consequences of the tests you have executed.
test_02_instance
test.test_03_st
test completes successfully, a new set of resource types appears even if their names were not changed
in the aiw_template
dictionary.Products > Service Templates
shows a list of service templates.
Each time the test_03_st
test completes successfully, a new service template appears even if its name was not changed
in the aiw_template
dictionary.You can use the test results by creating additional resource types, including them into one of the remained service templates, and then creating subscriptions from the modified service template.
The testing procedure explained here demonstrates you one more important direction in automating the development process and ensuring the reliability of the integration package.