Test suite
The Dragonfly library contains tests to verify its functioning and assure its quality. These tests come in two distinct types:
See the links below for tests of both types.
Tests in doctests format:
Tests based on the unittest framework reside in the dragonfly.test
package.
Running the test suite
This section contains instructions on how to run Dragonfly’s test suite with the speech recognition (SR) engine backends.
Most tests were written with an English model and vocabulary in mind, so they will not pass if the SR engine cannot recognize English words. The only exception to this is the text-input (“text”) backend, which should handle whatever words it is given.
Using Dragon NaturallySpeaking
Follow the following steps to run the test suite for the Dragon NaturallySpeaking (DNS) backend:
Start DNS. (And ensure that NatLink is also automatically started.)
Extract the Dragonfly source code in a directory
<dir>
.Run the follow commands to install test requirements:
cd <dir> pip install '.[test]'Run the tests with the following command:
python setup.py test --test-suite=natlink
Different tests need to be run for different DNS versions. The Natlink test suite will attempt to run the correct tests for the version of DNS you are using.
These tests may fail with certain DNS versions, models and/or
vocabularies. Please note that it is possible for the test suite to
fail even though everything still works in command modules loaded by
natlinkmain
. The doctest for Dragonfly Lists, for instance, fails
on DNS version 15.
It is not feasible to test Dragonfly with all DNS configurations.
Please get in touch if the tests fail for you and specific
Dragonfly functionality doesn’t work in natlink command modules
(i.e. .py
files in the MacroSystem
folder).
Dragonfly’s test code will try to use natlink.pyd or _natlink_core.pyd files for testing, if they exist in the Dragonfly source code directory alongside setup.py. If neither file exists, or if neither is usable, the test code will fallback on the installed natlink module.
Using Windows Speech Recognition
Follow the following steps to run the test suite for the Windows Speech Recognition (WSR) backend:
Start WSR.
Wake WSR up, so that it is not in sleeping state, and then turn the microphone off. (It is important to wake the microphone up first, because otherwise it’ll be off and sleeping at the same time. This causes all recognitions to fail. Weird, huh?)
Extract the Dragonfly source code in a directory
<dir>
.Run the follow commands to install test requirements:
cd <dir> pip install '.[test]'Run the tests with the following command:
python setup.py test --test-suite=sapi5
This test suite may be run using the in-process engine class, too. No GUI appears for this engine. The tests are run with the following command:
python setup.py test --test-suite=sapi5inproc
Some SAPI 5 engine tests will fail intermittently, particularly with
the shared process engine class ("sapi5"
/ "sapi5shared"
).
There is not much we can do about this.
Using the Kaldi engine
Follow the following steps to run the test suite for the Kaldi backend:
Extract the Dragonfly source code in a directory
<dir>
.Follow the set up and install instructions for the Kaldi engine on this page.
Run the following commands to install the Kaldi engine and test dependencies:
cd <dir> pip install '.[test]' pip install '.[kaldi]'Run the tests with the following command:
python setup.py test --test-suite=kaldi
Using the CMU Pocket Sphinx engine
Follow the following steps to run the test suite for the Sphinx backend:
Extract the Dragonfly source code in a directory
<dir>
.Run the following commands to install the Sphinx engine and test dependencies:
cd <dir> pip install '.[test]' pip install '.[sphinx]'Run the tests with the following command:
python setup.py test --test-suite=sphinx
Using the text-input engine
Follow the following steps to run the test suite for the “text” backend:
Extract the Dragonfly source code in a directory
<dir>
.Run the follow commands to install test requirements:
cd <dir> pip install '.[test]'Run the tests with the following commands:
cd <dir> python setup.py test
This is the default test suite for Dragonfly and has no additional
dependencies. The --test-suite
argument does not need to be
specified in this case.