The watsonx Assistant Testing Automation Tool is used to batch test question groups against a watsonx Assistant instance. The script ingests an excel file with questions, uses the watsonx Assistant API to query the assistant, and outputs an excel file with the results. The goal of the tool is to reduce execution time for running tests and identifying potential recurring errors.
The following prerequisites are required to run the tester:
- Python3
- IBM Cloud api key (this must be for the same cloud account that hosts the assistant instance)
- watsonx Assistant service instance url
- watsonx Assistant environment id
-
Clone the repo
git clone [email protected]:EE-WW-BuildLab/wxa-test-automation-tool.git
-
Change directory into wxa-test-automation-tool
cd wxa-test-automation-tool
-
Create a python virtual environment
python3 -m venv virtual-env source virtual-env/bin/activate pip3 install -r requirements.txt
-
Copy env file to .env
cp env .env
-
Configure parameters in .env and set the values of your environment
input_data_file
: the name of your input excel file (should be .xslx). For file configuration details, see Configuring Your Input Excel Fileoutput_data_file
: the name of your output excel file (should be .xlsx)api_key
: your ibm cloud api key. It should have access to the account that contains your assistant- Within your assistant UI, click "Assistant settings" on the bottom left -> navigate to Assistant IDs and API details -> click view details
assistant_url
: your Service instance URLassistant_environment_id
: the environment id which contains your configured assistant (ex: Draft Environment ID or Live Environment ID)
-
Run the following to start the script
python3 main.py
-
Run the following command to exit the python virtual environment:
deactivate
The repository contains a sample input file that you can copy, edit, and use to test.
The input excel file must have the following three columns (note: they are spelling and case sensitive):
- "Question Groups"
- This column acts as a label for questions that should be asked to the assistant in one session.
- Example values:
- "Group 1"
- "Group 2"
- "Group 3"
- "Question"
- This column contains the question to be asked to the assistant.
You can observe real time results in the terminal. Each time a questions is asked, you can view the input, response time, and output.
When all tests are completed, an output excel file with your results is created using the name specified in your env file. The output file contains the question groups, questions, assistant results, error flags, and response times.
- Processing error: occurs when the assistant returns a general processing error
- Timeout error: occurs when the assistant response takes greater than 30 seconds