Build, Load and Test
TL;DR - rebuild, local install, run tests
The Build Load and Test Run Configuration:
- Rebuilds the project locally
-
Installs it from the local build
- At:
ApiLogicServer/ApiLogicServer-dev/build_and_test/ApiLogicServer
- At:
-
Runs a series of tests
- Tests are configurable, which can reduce setup.
The resultant install provides a venv
which is used in unit testing as the default venv. A Run Configuration is provided for build-only, to enable such unit testing.
As of version 6.02.20, test automation provides automated regression testing. These have been verified on Mac, Linux (Ubuntu) and Windows.
Best Practice: Smoke Test First
The tests take several minutes, and errors can be slightly difficult to diagnose.
The bulk of the tests are in the Sample Projects's Behave tests. These reveal most of the errors, and are simplest to debug using a created project.
We therefore recommend that, before you run the full regression, first:
- Create the BLT
venv
(useful for running the smoke test app - see here)
Optional Docker Setup
Full testing requires Docker:
- To build docker projects
- To build the API Logic Server Docker container
- For docker test databases
You can reduce or completely eliminate docker requirements by configuring the tests as described in the next section.
Install SetupTools
As of release, the system uses setuptools.
You may need verify build is installed. You can install it manually:
Configuring the Tests
The automated test (use the launch configuration Build Load & Test
) performs a number of steps. You can configure the test to run some or all of these by editing the env_xxx.py
files shown here:
Key aspects are described in the sub-sections below.
do_install_api_logic_server
This:
- Runs the standard Python build:
python3 setup.py sdist bdist_wheel
-
Installs it into a Python environment
ApiLogicServer/ApiLogicServer-dev/build_and_test/ApiLogicServer
-
Installs
pyodbc
. Note this requires you have installedodbc
, but install failures are intentionally ignored (instead, skip the Sql/Server database withdo_docker_sqlserver = False
)
venv can be used for created projects
You will find it helpful to use this as a shared venv.
do_create_api_logic_project
...
This creates the sample project, runs the server, and tests the logic using the behave tests. It produces quite a lot of output which you can ignore. The test is designed to terminate if the tests fail.
These are extensive tests which verify project creation, server startup, logic and some minimal API testing (the Behave tests issue APIs to read/write data).
do_allocation_test
This is a complex rule example.
do_docker_<database>
These create projects from docker databases (see here) which are expected to be running. They perform minimal validation to ensure the server starts by executing the hello world API.
This in fact verifies that the `models.py` file is created and runs.
If you don't wish to install or run the docker databases, edit your tests/build_and_test/env.py
to disable do_docker_creation_tests
.