Changing the values in the configuration file and calling the test scripts (test-sth, test-stu) is not very user friendly. We should offer a graphical user interface (GUI) for this task.
Implementation Hints
Using Environment Variables
Since we use DyanConf for the configuration of the tests we can change config values using environment variables. For example, to use another value for the STH name we can set the environment variable DYNACONF_STH__NAME. The following PowerShell code sets the STH name to Blubb before it executes the STH connection test:
$env:DYNACONF_STH__NAME = 'Blubb'
# The connection test will now try to connect to ”Blubb”
test-sth -k connect
Updating the environment variables inside Python is possible using the environ mapping object. This means we should be able to use the steps below to implement the backend of the GUI.
Call the STU or STH test script (e.g. using the run function of the subprocess module)
Check the return value and output of the test command
Calling the Python Code Directly
Another solution might be to call the code of the TestCase class directly. Before that we would update the settings for the configuration values directly (e.g. settings.sth.name = "Blubb"). We could use the TestClass to run the code and analyze the result using the result attribute.
Description
Changing the values in the configuration file and calling the test scripts (
test-sth
,test-stu
) is not very user friendly. We should offer a graphical user interface (GUI) for this task.Implementation Hints
Using Environment Variables
Since we use DyanConf for the configuration of the tests we can change config values using environment variables. For example, to use another value for the STH name we can set the environment variable
DYNACONF_STH__NAME
. The following PowerShell code sets the STH name toBlubb
before it executes the STH connection test:Updating the environment variables inside Python is possible using the
environ
mapping object. This means we should be able to use the steps below to implement the backend of the GUI.environ
run
function of thesubprocess
module)Calling the Python Code Directly
Another solution might be to call the code of the
TestCase
class directly. Before that we would update the settings for the configuration values directly (e.g.settings.sth.name = "Blubb"
). We could use theTestClass
to run the code and analyze the result using theresult
attribute.