MyTooliT / ICOc

ICOc is a tool to control the ICOtronic system, acquire data, and test stationary transceiver units and sensory tool holders.
https://mytoolit.github.io/ICOc/
2 stars 0 forks source link

Create Graphical User Interface for STH & STU Tests #14

Open sanssecours opened 3 years ago

sanssecours commented 3 years ago

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 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.

  1. Change configuration values using environ
  2. Call the STU or STH test script (e.g. using the run function of the subprocess module)
  3. 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.