Architecture
Support for additional technologies, e.g. ElasticSearch, can be added by sub-classing these classes and adding specific steps, setup/teardown, and configuration. This allows reusing the basic configuration, reporting, logging, and retrying mechanisms. Further, application tests, steps, and configurations reuse by subclassing from technologies.
flowchart TD
A[Tests: Define BDD scenarios as series of steps, also define specific setup and teardown] --> |contains| B[Steps: encapsulate UI or API operations and verifications, and may be composed of other steps]
B --> |contains| C[Configurations: can be per environment, such as dev, qa, staging, and contain URLs, users, authentication schemes, encryption, etc.]
B --> |uses| D[Matchers: Hamcrest matchers for single objects or for iterables]
A --> |contains| C
B --> |uses| E[Models: domain objects]
subgraph Inheritance
A1[GenericTests] -.-> |inherits| A2[Tests]
B1[GenericSteps] -.-> |inherits| B2[Steps]
C1[AbstractConfiguration] -.-> |inherits| C2[Configuration]
end
Extending the Framework
To add support for a new technology (e.g., messaging, database), create: -
MyTechConfiguration(BaseConfiguration)
-MyTechSteps(GenericSteps[MyTechConfiguration])
-MyTechTests(AbstractTestsBase[MyTechSteps, MyTechConfiguration])
This pattern ensures you reuse the core BDD, configuration, and reporting mechanisms.
classDiagram
%% Core Abstractions
class AbstractTestsBase {
<>
+steps
+_configuration
+setup_method()
+teardown_method()
}
class GenericSteps {
<>
+given
+when
+then
+and_
+with_
+retrying()
+eventually_assert_that()
}
class BaseConfiguration {
<>
+parser
}
%% Technology-Specific Extensions
class RestTests
class RestSteps
class RestConfiguration
class SeleniumTests
class SeleniumSteps
class SeleniumConfiguration
%% Example: Custom Extension
class TerminalXTests
class TerminalXSteps
class TerminalXConfiguration
%% Relationships
AbstractTestsBase <|-- RestTests
AbstractTestsBase <|-- SeleniumTests
SeleniumTests <|-- TerminalXTests
GenericSteps <|-- RestSteps
GenericSteps <|-- SeleniumSteps
SeleniumSteps <|-- TerminalXSteps
BaseConfiguration <|-- RestConfiguration
BaseConfiguration <|-- SeleniumConfiguration
SeleniumConfiguration <|-- TerminalXConfiguration
RestTests o-- RestSteps : uses
RestTests o-- RestConfiguration : configures
SeleniumTests o-- SeleniumSteps : uses
SeleniumTests o-- SeleniumConfiguration : configures
TerminalXTests o-- TerminalXSteps : uses
TerminalXTests o-- TerminalXConfiguration : configures
%% Example extension note
%% You can add new technologies by subclassing the three core abstractions:
%% AbstractTestsBase, GenericSteps, and BaseConfiguration.
Key Classes
Class | Description | Source |
---|---|---|
AbstractTestsBase |
Base for all test scenarios; holds steps and config | abstract_tests_base.py |
GenericSteps |
Base for all step implementations; provides BDD keywords | generic_steps.py |
BaseConfiguration |
Base for all configuration objects | base_configuration.py |
RestTests |
REST-specific test base | rest_tests.py |
RestSteps |
REST-specific steps | rest_steps.py |
RestConfiguration |
REST-specific configuration | rest_configuration.py |
SeleniumTests |
Selenium-specific test base | selenium_tests.py |
SeleniumSteps |
Selenium-specific steps | selenium_steps.py |
SeleniumConfiguration |
Selenium-specific configuration | selenium_configuration.py |
TerminalXTests |
Example: custom UI test base | terminalx_tests.py |
TerminalXSteps |
Example: custom UI steps | terminalx_steps.py |
TerminalXConfiguration |
Example: custom UI configuration | terminalx_configuration.py |