Automatically Validate a Library of Messages
a Library of Messages
Most LIXI2 integrations can benefit from fully automating the validation of a library of LIXI2 messages for testing purposes.
You may have a series of processes that generates LIXI2 messages for submitting to an API or you may host an API that consumes LIXI2 messages. In both situations, the capability to automatically validate a set of messages is likely needed.
In an earlier post, I showed how you can automatically access our standards in LIXILab for the purpose of triggering your own process (Automatically Trigger a Build Process with our Standards Releases).
This blog post builds on this to fetch the latest standards, fetch a library of test messages (we use the LIXI Sample Repository, but you would likely replace this with your own test message library), and validate all the test messages against the latest standards.
Step 1. Create Folder and Clone Projects
Start this process by creating a folder called 'lixi-validation-demo' - I've created this under the 'C:\temp\' directory.
Then in a command or bash window and use the git clone command to clone both the LIXI2 schemas and the LIXI2 samples projects locally from LIXILab. If this is your first time running this command, you will be asked for your credentials for LIXILab.
Step 2. Copy the Python Code into a New File
In the new folder create an empty file called validate_all_standalone_script.py and copy the code from the block at the bottom of this page into the file and save it.
After completing this, you will have two sub-directories and a single python script.
└── lixi-validation-demo ├── samples ├── schemas └── validate_all_standalone_script.py
Step 3. Run the Python Script
Depending on your Python installation, you can now run the script - you could use an IDE such as vsCode or execute the script from a command or bash session. For example, you can run it at the Windows CMD prompt as follows.
Step 4. What Next? Over to you ...
This is just a demonstration of how you might start to plug together various components of LIXI2 on your journey to automate your software delivery lifecycle.
For example, you might use a variation of this process to roll forward all of your samples from your current version to the latest release and retest all your samples to find out anything that might have broken as a result of the upgrade.
Python Code to Save in 'validate_all_standalone_script.py'
Shane Rigby, LIXI Limited CEO
First Published: January 8, 2021