Driver design - Paxterra/TestON GitHub Wiki
Driver design :
Component drivers are the most important part of the TestON framework. they make the framework actually do some useful work. Essentially, a component driver is a class that has at least the following methods/APIs defined in it.
connect : This is the method that sets up the connection to the component and creates required log files, etc. For CLI components, this is a wrapper around the standard pexpect library. For API components, it is an empty class template. This class will be redefined to load required libraries in the actual API component. For UI components, it will be an empty class template that will be redefined to connect using the appropriate GUI library.
disconnect - Self explanatory
exec : This is the smallest possible action in the TestON framework on a component. It performs a specified action on the component and waits for a response. For CLI drivers, this is a command to be executed on the CLI shell and the response is the output of the command. For API components, it is an API to be called with specific arguments on a library and the response is the return value of the API. For GUI components, it will be a GUI action like click, double click, etc and the response is an expected change in the UI.
log : This is a simple log API that provides the ability to log a message to the component's session log file. It takes two arguments - ther level of the log message and the message.
Besides these basic methods, each driver can add APIs of its own that will be available in the test script. The idea is to use the exec API as a building block and build higher and higer wrapper APIs. E.g., A configure_ip_address API can internally use multiple exec APIs to configure an IP address on an interface, verify if the IP address is configured and ping that IP address to achieve its end goal.