sysbot 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sysbot/README.md +611 -0
- sysbot/Sysbot.py +318 -0
- sysbot/__init__.py +51 -0
- sysbot/connectors/__init__.py +16 -0
- sysbot/connectors/http.py +1093 -0
- sysbot/connectors/local.py +249 -0
- sysbot/connectors/socket.py +329 -0
- sysbot/connectors/ssh.py +587 -0
- sysbot/connectors/winrm.py +134 -0
- sysbot/modules/__init__.py +8 -0
- sysbot/modules/bmc/__init__.py +7 -0
- sysbot/modules/bmc/idrac.py +351 -0
- sysbot/modules/bmc/ilo.py +308 -0
- sysbot/modules/linux/__init__.py +8 -0
- sysbot/modules/linux/dnf.py +47 -0
- sysbot/modules/linux/file.py +256 -0
- sysbot/modules/linux/firewalld.py +190 -0
- sysbot/modules/linux/ip.py +112 -0
- sysbot/modules/linux/iptables.py +274 -0
- sysbot/modules/linux/kubernetes.py +283 -0
- sysbot/modules/linux/libvirt.py +181 -0
- sysbot/modules/linux/podman.py +167 -0
- sysbot/modules/linux/process.py +108 -0
- sysbot/modules/linux/rpm.py +60 -0
- sysbot/modules/linux/selinux.py +112 -0
- sysbot/modules/linux/sysinfo.py +317 -0
- sysbot/modules/linux/systemd.py +53 -0
- sysbot/modules/linux/users.py +128 -0
- sysbot/modules/monitoring/__init__.py +7 -0
- sysbot/modules/monitoring/grafana.py +219 -0
- sysbot/modules/network/__init__.py +7 -0
- sysbot/modules/network/cisco/__init__.py +7 -0
- sysbot/modules/network/cisco/catalyst.py +340 -0
- sysbot/modules/vmware/__init__.py +7 -0
- sysbot/modules/vmware/nsx.py +516 -0
- sysbot/modules/vmware/sddcmanager.py +432 -0
- sysbot/modules/vmware/vsphere.py +381 -0
- sysbot/modules/windows/__init__.py +8 -0
- sysbot/modules/windows/adcs.py +187 -0
- sysbot/modules/windows/adds.py +266 -0
- sysbot/modules/windows/dnsserver.py +147 -0
- sysbot/modules/windows/file.py +197 -0
- sysbot/modules/windows/firewall.py +184 -0
- sysbot/modules/windows/ip.py +105 -0
- sysbot/modules/windows/sysinfo.py +267 -0
- sysbot/modules/windows/users.py +43 -0
- sysbot/modules/windows/veeam.py +212 -0
- sysbot/modules/windows/wsus.py +155 -0
- sysbot/plugins/__init__.py +7 -0
- sysbot/plugins/ansible.py +610 -0
- sysbot/plugins/data.py +123 -0
- sysbot/plugins/vault.py +169 -0
- sysbot/utils/__init__.py +7 -0
- sysbot/utils/engine.py +437 -0
- sysbot/utils/helper.py +119 -0
- sysbot/utils/robot/__init__.py +7 -0
- sysbot/utils/robot/listener/__init__.py +8 -0
- sysbot/utils/robot/listener/mongodb.py +283 -0
- sysbot/utils/robot/listener/mysql.py +395 -0
- sysbot/utils/robot/listener/postgresql.py +395 -0
- sysbot/utils/robot/listener/sqlite.py +374 -0
- sysbot/utils/robot/polarion.py +361 -0
- sysbot-0.2.0.dist-info/METADATA +59 -0
- sysbot-0.2.0.dist-info/RECORD +67 -0
- sysbot-0.2.0.dist-info/WHEEL +5 -0
- sysbot-0.2.0.dist-info/licenses/LICENSE +21 -0
- sysbot-0.2.0.dist-info/top_level.txt +1 -0
sysbot/README.md
ADDED
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
# SysBot
|
|
2
|
+
|
|
3
|
+
## Table of Contents
|
|
4
|
+
|
|
5
|
+
- [Overview](#overview)
|
|
6
|
+
- [Installation](#installation)
|
|
7
|
+
- [Quickstart](#quickstart)
|
|
8
|
+
- [RobotFramework Usage](#robotframework-usage)
|
|
9
|
+
- [UnitTest Usage](#unittest-usage)
|
|
10
|
+
- [Listener Usage](#listener-usage)
|
|
11
|
+
- [Polarion Integration](#polarion-integration)
|
|
12
|
+
- [Additional Resources](#additional-resources)
|
|
13
|
+
- [License](#license)
|
|
14
|
+
- [Author](#author)
|
|
15
|
+
|
|
16
|
+
## Overview
|
|
17
|
+
|
|
18
|
+
SysBot is a system test tool that provides a unified interface for connecting to and testing various systems through different protocols. Built with Robot Framework integration in mind, it offers a modular architecture that simplifies system automation and testing.
|
|
19
|
+
|
|
20
|
+
### Key Features
|
|
21
|
+
|
|
22
|
+
- **Multi-protocol Support**: SSH, HTTP, WinRM, Socket, and more
|
|
23
|
+
- **SSH Tunneling**: Support for nested SSH tunnels with automatic management
|
|
24
|
+
- **Cross-platform**: Support for Linux and Windows systems
|
|
25
|
+
- **Robot Framework Integration**: Built-in support for Robot Framework automation with GLOBAL scope
|
|
26
|
+
- **Modular Architecture**: Dynamic components loading and discovery (modules and plugins)
|
|
27
|
+
- **Connection Management**: Robust session caching and lifecycle management
|
|
28
|
+
- **Secret Management**: Secure storage and retrieval of sensitive data
|
|
29
|
+
- **Database Listeners**: Store test results in SQLite, MySQL, PostgreSQL, or MongoDB
|
|
30
|
+
- **Polarion Integration**: Generate Polarion-compatible xUnit reports for ALM/QA integration
|
|
31
|
+
|
|
32
|
+
### Architecture
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
sysbot/
|
|
36
|
+
├── Sysbot.py # Main SysBot class
|
|
37
|
+
├── connectors/ # Protocol-specific connectors
|
|
38
|
+
├── plugins/ # Plugins utilities (data, vault)
|
|
39
|
+
├── utils/
|
|
40
|
+
│ └── engine.py # Engine class
|
|
41
|
+
└── modules/ # Modules
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
### Prerequisites
|
|
47
|
+
|
|
48
|
+
- Python 3.8 or higher
|
|
49
|
+
- pip
|
|
50
|
+
|
|
51
|
+
### Install from PyPI
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
pip install sysbot
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Optional Dependencies
|
|
58
|
+
|
|
59
|
+
For specific features, you can install additional dependencies:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Install with all database support
|
|
63
|
+
pip install sysbot[all_databases]
|
|
64
|
+
|
|
65
|
+
# Install with specific database support
|
|
66
|
+
pip install sysbot[mysql] # MySQL support only
|
|
67
|
+
pip install sysbot[postgresql] # PostgreSQL support only
|
|
68
|
+
pip install sysbot[mongodb] # MongoDB support only
|
|
69
|
+
|
|
70
|
+
# Install with development dependency
|
|
71
|
+
pip install sysbot[dev]
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Quickstart
|
|
75
|
+
|
|
76
|
+
### Basic SSH Connection
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
import sysbot
|
|
80
|
+
|
|
81
|
+
bot = sysbot.Sysbot()
|
|
82
|
+
|
|
83
|
+
# Open an SSH session to a Linux system
|
|
84
|
+
bot.open_session(
|
|
85
|
+
alias="my_linux_server",
|
|
86
|
+
protocol="ssh",
|
|
87
|
+
product="bash",
|
|
88
|
+
host="192.168.1.100",
|
|
89
|
+
port=22,
|
|
90
|
+
login="username",
|
|
91
|
+
password="password"
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
# Execute a command
|
|
95
|
+
result = bot.execute_command("my_linux_server", "ls -la")
|
|
96
|
+
print(result)
|
|
97
|
+
|
|
98
|
+
# Close all sessions
|
|
99
|
+
bot.close_all_sessions()
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### SSH Tunneling
|
|
103
|
+
|
|
104
|
+
```python
|
|
105
|
+
# Configure nested SSH tunnels
|
|
106
|
+
tunnel_config = [
|
|
107
|
+
{
|
|
108
|
+
"ip": "192.168.1.1",
|
|
109
|
+
"port": 22,
|
|
110
|
+
"username": "user1",
|
|
111
|
+
"password": "pass1"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"ip": "192.168.2.1",
|
|
115
|
+
"port": 22,
|
|
116
|
+
"username": "user2",
|
|
117
|
+
"password": "pass2"
|
|
118
|
+
}
|
|
119
|
+
]
|
|
120
|
+
|
|
121
|
+
# Open session through tunnels
|
|
122
|
+
bot.open_session(
|
|
123
|
+
alias="tunneled_server",
|
|
124
|
+
protocol="ssh", # or http / winrm / ect...
|
|
125
|
+
product="bash",
|
|
126
|
+
host="192.168.3.100",
|
|
127
|
+
port=22,
|
|
128
|
+
login="final_user",
|
|
129
|
+
password="final_pass",
|
|
130
|
+
tunnel_config=tunnel_config
|
|
131
|
+
)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Secret Management
|
|
135
|
+
|
|
136
|
+
SysBot provides a built-in secret management system for secure storage and retrieval of sensitive data like passwords, tokens, and configuration values. Secrets can be stored directly or loaded from external sources like files or HashiCorp Vault.
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
import sysbot
|
|
140
|
+
|
|
141
|
+
bot = sysbot.Sysbot()
|
|
142
|
+
|
|
143
|
+
# Using plugins with secret management
|
|
144
|
+
bot.plugins.data.csv("/path/to/file", key="my_secret")
|
|
145
|
+
secret_data = bot.get_secret("my_secret.0.name")
|
|
146
|
+
|
|
147
|
+
# Secret management without plugin
|
|
148
|
+
bot.add_secret("new_secret", "very_secret_value")
|
|
149
|
+
bot.get_secret("new_secret")
|
|
150
|
+
bot.remove_secret("new_secret")
|
|
151
|
+
|
|
152
|
+
# Using Vault plugin to dump HashiCorp Vault secrets
|
|
153
|
+
bot.plugins.vault.dump_engine(
|
|
154
|
+
token="hvs.CAESIJ...",
|
|
155
|
+
url="https://vault.example.com:8200",
|
|
156
|
+
engine_name="secret",
|
|
157
|
+
key="vault_secrets",
|
|
158
|
+
verify_ssl=False # Set to True for production with valid certificates
|
|
159
|
+
)
|
|
160
|
+
# Access Vault secrets using dot notation
|
|
161
|
+
db_url = bot.get_secret("vault_secrets.myapp/config.database_url")
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Module System
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
# Import sysbot to access loaded components (all modules/plugins loaded by default)
|
|
168
|
+
import sysbot
|
|
169
|
+
|
|
170
|
+
bot = sysbot.Sysbot()
|
|
171
|
+
|
|
172
|
+
# Open an SSH session to a Linux system
|
|
173
|
+
bot.open_session(
|
|
174
|
+
alias="my_linux_server",
|
|
175
|
+
protocol="ssh",
|
|
176
|
+
product="bash",
|
|
177
|
+
host="192.168.1.100",
|
|
178
|
+
port=22,
|
|
179
|
+
login="username",
|
|
180
|
+
password="password"
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
result = bot.linux.dnf.repolist("my_linux_server")
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Session Management
|
|
187
|
+
|
|
188
|
+
```python
|
|
189
|
+
# Close a specific session
|
|
190
|
+
bot.close_session("my_linux_server")
|
|
191
|
+
|
|
192
|
+
# Close all sessions (automatically handles tunnels)
|
|
193
|
+
bot.close_all_sessions()
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### Supported Protocols
|
|
197
|
+
|
|
198
|
+
#### SSH
|
|
199
|
+
- **Bash**: Full support for bash via SSH
|
|
200
|
+
- **Powershell**: Support for powershell via SSH (requires SSH server)
|
|
201
|
+
|
|
202
|
+
#### Local Execution
|
|
203
|
+
- **Bash**: Execute bash/shell commands locally without SSH
|
|
204
|
+
- **Powershell**: Execute PowerShell commands locally without SSH or WinRM
|
|
205
|
+
|
|
206
|
+
SysBot provides local execution connectors that allow running commands directly on the local machine without the overhead of SSH or WinRM connections. This is useful for:
|
|
207
|
+
- Running commands on the local system during automation
|
|
208
|
+
- Testing without remote systems
|
|
209
|
+
- Avoiding connection overhead for local operations
|
|
210
|
+
|
|
211
|
+
**Local Bash Execution:**
|
|
212
|
+
```python
|
|
213
|
+
import sysbot
|
|
214
|
+
|
|
215
|
+
bot = sysbot.Sysbot()
|
|
216
|
+
|
|
217
|
+
# Open a local bash session (no actual connection is made)
|
|
218
|
+
bot.open_session(
|
|
219
|
+
alias="local_bash",
|
|
220
|
+
protocol="local",
|
|
221
|
+
product="bash",
|
|
222
|
+
host="localhost", # Required but not used
|
|
223
|
+
port=0 # Required but not used
|
|
224
|
+
)
|
|
225
|
+
|
|
226
|
+
# Execute commands locally
|
|
227
|
+
result = bot.execute_command("local_bash", "ls -la")
|
|
228
|
+
print(result)
|
|
229
|
+
|
|
230
|
+
bot.close_session("local_bash")
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
**Local PowerShell Execution:**
|
|
234
|
+
```python
|
|
235
|
+
import sysbot
|
|
236
|
+
|
|
237
|
+
bot = sysbot.Sysbot()
|
|
238
|
+
|
|
239
|
+
# Open a local PowerShell session (no actual connection is made)
|
|
240
|
+
bot.open_session(
|
|
241
|
+
alias="local_ps",
|
|
242
|
+
protocol="local",
|
|
243
|
+
product="powershell",
|
|
244
|
+
host="localhost", # Required but not used
|
|
245
|
+
port=0 # Required but not used
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
# Execute PowerShell commands locally
|
|
249
|
+
result = bot.execute_command("local_ps", "Get-Process | Select-Object -First 5")
|
|
250
|
+
print(result)
|
|
251
|
+
|
|
252
|
+
bot.close_session("local_ps")
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
#### HTTP/HTTPS
|
|
256
|
+
|
|
257
|
+
SysBot provides a generic HTTP/HTTPS connector with support for 9 authentication methods.
|
|
258
|
+
|
|
259
|
+
**Supported Authentication Methods:**
|
|
260
|
+
1. **API Key (`apikey`)** - API Key authentication via headers or query parameters
|
|
261
|
+
2. **Basic Auth (`basicauth`)** - Standard HTTP Basic Authentication
|
|
262
|
+
3. **OAuth 1.0 (`oauth1`)** - OAuth 1.0 authentication (RFC 5849)
|
|
263
|
+
4. **OAuth 2.0 (`oauth2`)** - OAuth 2.0 Bearer token authentication
|
|
264
|
+
5. **JWT (`jwt`)** - JSON Web Token authentication with automatic token generation
|
|
265
|
+
6. **SAML (`saml`)** - SAML assertion/token authentication
|
|
266
|
+
7. **HMAC (`hmac`)** - HMAC signature-based authentication
|
|
267
|
+
8. **Certificate (`certificate`)** - Client certificate authentication (mutual TLS)
|
|
268
|
+
9. **OpenID Connect (`openidconnect`)** - OpenID Connect authentication
|
|
269
|
+
|
|
270
|
+
**Usage Examples:**
|
|
271
|
+
|
|
272
|
+
Basic Authentication:
|
|
273
|
+
```python
|
|
274
|
+
bot.open_session(
|
|
275
|
+
alias="my_api",
|
|
276
|
+
protocol="http",
|
|
277
|
+
product="basicauth",
|
|
278
|
+
host="api.example.com",
|
|
279
|
+
port=443,
|
|
280
|
+
login="username",
|
|
281
|
+
password="password"
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
result = bot.execute_command("my_api", "/users", options={"method": "GET"})
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
API Key Authentication:
|
|
288
|
+
```python
|
|
289
|
+
bot.open_session(
|
|
290
|
+
alias="my_api",
|
|
291
|
+
protocol="http",
|
|
292
|
+
product="apikey",
|
|
293
|
+
host="api.example.com",
|
|
294
|
+
port=443,
|
|
295
|
+
api_key="your-api-key-here",
|
|
296
|
+
api_key_header="X-API-Key" # Custom header name (optional)
|
|
297
|
+
)
|
|
298
|
+
|
|
299
|
+
result = bot.execute_command("my_api", "/data", options={"method": "GET"})
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
#### WinRM
|
|
303
|
+
- **Powershell**: Native Windows Remote Management support
|
|
304
|
+
|
|
305
|
+
#### Socket
|
|
306
|
+
- **TCP**: Native TCP socket with SSL if needed
|
|
307
|
+
- **UDP**: Native UDP socket
|
|
308
|
+
|
|
309
|
+
## RobotFramework Usage
|
|
310
|
+
|
|
311
|
+
SysBot is designed to work seamlessly with Robot Framework, providing powerful automation capabilities with a simple syntax.
|
|
312
|
+
|
|
313
|
+
### Basic Robot Framework Test
|
|
314
|
+
|
|
315
|
+
```robot
|
|
316
|
+
*** Settings ***
|
|
317
|
+
Library sysbot.Sysbot
|
|
318
|
+
Suite Setup Call Components plugins.data.yaml tests/.dataset/connexion.yml key=connexion
|
|
319
|
+
Suite Teardown Close All Sessions
|
|
320
|
+
|
|
321
|
+
*** Variables ***
|
|
322
|
+
${HOST}= 192.168.1.112
|
|
323
|
+
${PORT}= 22
|
|
324
|
+
${USER}= sysbot
|
|
325
|
+
${PASSWORD}= P@ssw0rd
|
|
326
|
+
|
|
327
|
+
*** Test Cases ***
|
|
328
|
+
|
|
329
|
+
Open Session without secret
|
|
330
|
+
Open Session target ssh bash ${HOST} ${PORT} ${USER} ${PASSWORD}
|
|
331
|
+
Close All Sessions
|
|
332
|
+
|
|
333
|
+
Open Session with secret
|
|
334
|
+
Open Session target ssh bash connexion.host ${PORT} connexion.username connexion.password is_secret=True
|
|
335
|
+
Close All Sessions
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Using Modules in Robot Framework
|
|
339
|
+
|
|
340
|
+
Modules can be loaded and used to perform specific operations on target systems:
|
|
341
|
+
|
|
342
|
+
```robot
|
|
343
|
+
*** Settings ***
|
|
344
|
+
Library sysbot.Sysbot linux.systemd linux.dnf
|
|
345
|
+
|
|
346
|
+
*** Test Cases ***
|
|
347
|
+
|
|
348
|
+
Check System Service
|
|
349
|
+
Open Session server1 ssh bash ${HOST} ${PORT} ${USER} ${PASSWORD}
|
|
350
|
+
${status}= Linux Dnf Repolist server1
|
|
351
|
+
Log ${status}
|
|
352
|
+
Close All Sessions
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
### Secret Management in Robot Framework
|
|
356
|
+
|
|
357
|
+
```robot
|
|
358
|
+
*** Settings ***
|
|
359
|
+
Library sysbot.Sysbot
|
|
360
|
+
|
|
361
|
+
*** Test Cases ***
|
|
362
|
+
|
|
363
|
+
Using Secrets
|
|
364
|
+
Add Secret db_password MySecretPassword
|
|
365
|
+
${password}= Get Secret db_password
|
|
366
|
+
Log Using password: ${password}
|
|
367
|
+
Remove Secret db_password
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
## UnitTest Usage
|
|
371
|
+
|
|
372
|
+
SysBot can be used in Python unittest for system testing scenarios.
|
|
373
|
+
|
|
374
|
+
### Module Testing with UnitTest
|
|
375
|
+
|
|
376
|
+
```python
|
|
377
|
+
import unittest
|
|
378
|
+
import Sysbot
|
|
379
|
+
|
|
380
|
+
class TestLinuxModules(unittest.TestCase):
|
|
381
|
+
|
|
382
|
+
@classmethod
|
|
383
|
+
def setUpClass(cls):
|
|
384
|
+
"""Set up class fixtures."""
|
|
385
|
+
cls.bot = sysbot.Sysbot("linux.systemd", "linux.dnf")
|
|
386
|
+
cls.bot.open_session(
|
|
387
|
+
alias="linux_server",
|
|
388
|
+
protocol="ssh",
|
|
389
|
+
product="bash",
|
|
390
|
+
host="192.168.1.100",
|
|
391
|
+
port=22,
|
|
392
|
+
login="user",
|
|
393
|
+
password="pass"
|
|
394
|
+
)
|
|
395
|
+
|
|
396
|
+
@classmethod
|
|
397
|
+
def tearDownClass(cls):
|
|
398
|
+
"""Clean up class fixtures."""
|
|
399
|
+
cls.bot.close_all_sessions()
|
|
400
|
+
|
|
401
|
+
def test_systemd_service_status(self):
|
|
402
|
+
"""Test checking systemd service status."""
|
|
403
|
+
result = self.bot.linux.systemd.status("linux_server", "sshd")
|
|
404
|
+
self.assertIsNotNone(result)
|
|
405
|
+
|
|
406
|
+
def test_dnf_repolist(self):
|
|
407
|
+
"""Test listing DNF repositories."""
|
|
408
|
+
result = self.bot.linux.dnf.repolist("linux_server")
|
|
409
|
+
self.assertIsNotNone(result)
|
|
410
|
+
|
|
411
|
+
if __name__ == '__main__':
|
|
412
|
+
unittest.main()
|
|
413
|
+
```
|
|
414
|
+
|
|
415
|
+
## Listener Usage
|
|
416
|
+
|
|
417
|
+
SysBot includes Robot Framework listener plugins that can store test results in various databases. Each database type has its own independent, self-contained listener. The listeners create a hierarchical structure: Campaign → Suite → Test Case → Keyword.
|
|
418
|
+
|
|
419
|
+
### Available Listeners
|
|
420
|
+
|
|
421
|
+
- **SQLite**: Lightweight file-based database, perfect for local testing
|
|
422
|
+
- **MySQL**: Popular relational database for team environments
|
|
423
|
+
- **PostgreSQL**: Enterprise-grade relational database
|
|
424
|
+
- **MongoDB**: NoSQL document database for flexible schemas
|
|
425
|
+
|
|
426
|
+
### Usage with Robot Framework
|
|
427
|
+
|
|
428
|
+
Each listener is used directly with its specific class:
|
|
429
|
+
|
|
430
|
+
```bash
|
|
431
|
+
# Store results in SQLite
|
|
432
|
+
robot --listener sysbot.utils.robot.listener.sqlite.Sqlite:results.db:MyCampaign tests/
|
|
433
|
+
|
|
434
|
+
# Store results in MySQL
|
|
435
|
+
robot --listener sysbot.utils.robot.listener.mysql.Mysql:mysql://user:pass@localhost/testdb:MyCampaign tests/
|
|
436
|
+
|
|
437
|
+
# Store results in PostgreSQL
|
|
438
|
+
robot --listener sysbot.utils.robot.listener.postgresql.Postgresql:postgresql://user:pass@localhost/testdb:MyCampaign tests/
|
|
439
|
+
|
|
440
|
+
# Store results in MongoDB
|
|
441
|
+
robot --listener sysbot.utils.robot.listener.mongodb.Mongodb:mongodb://localhost:27017/testdb:MyCampaign tests/
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
### Listener Parameters
|
|
445
|
+
|
|
446
|
+
The listener accepts two parameters:
|
|
447
|
+
1. **Database Connection**: Connection string or path to database
|
|
448
|
+
2. **Campaign Name**: Name of the test campaign for organizing results
|
|
449
|
+
|
|
450
|
+
### Data Structure
|
|
451
|
+
|
|
452
|
+
The listeners store test execution data in a hierarchical format:
|
|
453
|
+
|
|
454
|
+
- **Campaign**: Top-level container for test executions
|
|
455
|
+
- **Suite**: Test suite information
|
|
456
|
+
- **Test Case**: Individual test cases
|
|
457
|
+
- **Keyword**: Keywords executed within tests
|
|
458
|
+
|
|
459
|
+
Each level stores relevant metadata including:
|
|
460
|
+
- Execution timestamps
|
|
461
|
+
- Status (PASS/FAIL)
|
|
462
|
+
- Error messages
|
|
463
|
+
- Statistics
|
|
464
|
+
|
|
465
|
+
### Installation Requirements
|
|
466
|
+
|
|
467
|
+
```bash
|
|
468
|
+
# Install with all database support
|
|
469
|
+
pip install sysbot[all_databases]
|
|
470
|
+
|
|
471
|
+
# Or install specific database support
|
|
472
|
+
pip install sysbot[mysql] # MySQL support only
|
|
473
|
+
pip install sysbot[postgresql] # PostgreSQL support only
|
|
474
|
+
pip install sysbot[mongodb] # MongoDB support only
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
## Polarion Integration
|
|
478
|
+
|
|
479
|
+
SysBot includes a Polarion plugin that enables integration with Siemens Polarion ALM/QA for test result management. The plugin provides:
|
|
480
|
+
|
|
481
|
+
- **xUnit Post-processor**: Converts Robot Framework output to Polarion-compatible xUnit XML using rebot
|
|
482
|
+
- **Test Case Mapping**: Links Robot Framework tests to Polarion test cases via tags
|
|
483
|
+
- **Custom Properties**: Supports Polarion custom fields and metadata
|
|
484
|
+
|
|
485
|
+
### Linking Tests to Polarion
|
|
486
|
+
|
|
487
|
+
Use tags in your Robot Framework tests to establish links with Polarion test cases:
|
|
488
|
+
|
|
489
|
+
```robot
|
|
490
|
+
*** Test Cases ***
|
|
491
|
+
Login Functionality Test
|
|
492
|
+
[Documentation] Validates user login with valid credentials
|
|
493
|
+
[Tags] polarion-id:TEST-001 polarion-title:Login Test polarion-priority:High
|
|
494
|
+
# Test steps...
|
|
495
|
+
|
|
496
|
+
User Management Test
|
|
497
|
+
[Documentation] Test user creation and deletion
|
|
498
|
+
[Tags] polarion-id:TEST-002 polarion-testEnvironment:Production
|
|
499
|
+
# Test steps...
|
|
500
|
+
```
|
|
501
|
+
|
|
502
|
+
### Tag Format
|
|
503
|
+
|
|
504
|
+
- `polarion-id:TEST-XXX` - Links to Polarion test case ID (required for mapping)
|
|
505
|
+
- `polarion-title:Test Name` - Sets Polarion test case title
|
|
506
|
+
- `polarion-{property}:{value}` - Custom Polarion properties (e.g., `polarion-priority:High`, `polarion-assignee:jdoe`)
|
|
507
|
+
|
|
508
|
+
### Generating Polarion-Compatible xUnit
|
|
509
|
+
|
|
510
|
+
**Using Python API:**
|
|
511
|
+
```python
|
|
512
|
+
from sysbot.utils.robot.polarion import Polarion
|
|
513
|
+
|
|
514
|
+
polarion = Polarion()
|
|
515
|
+
polarion.generate_xunit(
|
|
516
|
+
output_xml='output.xml',
|
|
517
|
+
xunit_file='polarion_results.xml',
|
|
518
|
+
project_id='MYPROJECT',
|
|
519
|
+
test_run_id='RUN-001',
|
|
520
|
+
custom_properties={'environment': 'test', 'version': '1.0'}
|
|
521
|
+
)
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
**Using Command Line:**
|
|
525
|
+
```bash
|
|
526
|
+
# Run Robot Framework tests
|
|
527
|
+
robot --outputdir results tests/
|
|
528
|
+
|
|
529
|
+
# Generate Polarion xUnit using Python
|
|
530
|
+
python -c "from sysbot.utils.robot.polarion import Polarion; \
|
|
531
|
+
polarion = Polarion(); \
|
|
532
|
+
polarion.generate_xunit('results/output.xml', 'results/polarion.xml', \
|
|
533
|
+
project_id='PROJ', test_run_id='RUN-001')"
|
|
534
|
+
```
|
|
535
|
+
|
|
536
|
+
### Importing into Polarion
|
|
537
|
+
|
|
538
|
+
Once you have the Polarion-compatible xUnit file:
|
|
539
|
+
|
|
540
|
+
1. **Manual Import**: Use Polarion's UI to import the xUnit file
|
|
541
|
+
2. **Scheduled Import**: Configure Polarion's scheduled xUnit importer
|
|
542
|
+
3. **API Import**: Use tools like `dump2polarion` or Polarion's REST API
|
|
543
|
+
|
|
544
|
+
### Generated xUnit Content
|
|
545
|
+
|
|
546
|
+
The generated xUnit file includes:
|
|
547
|
+
- Test case IDs for proper mapping to existing Polarion test cases
|
|
548
|
+
- Test execution results (pass/fail/error)
|
|
549
|
+
- Execution time and timestamps
|
|
550
|
+
- Custom properties for filtering and reporting
|
|
551
|
+
- Project and test run associations
|
|
552
|
+
|
|
553
|
+
## Additional Resources
|
|
554
|
+
|
|
555
|
+
### Documentation
|
|
556
|
+
|
|
557
|
+
SysBot includes comprehensive Google-style docstrings for all modules, classes, and methods.
|
|
558
|
+
|
|
559
|
+
#### Online Documentation
|
|
560
|
+
|
|
561
|
+
The complete documentation is available online at **[https://joreci2.github.io/sysbot/](https://joreci2.github.io/sysbot/)**
|
|
562
|
+
|
|
563
|
+
#### Viewing Documentation Locally with pdoc3
|
|
564
|
+
|
|
565
|
+
Install pdoc3 as a development dependency:
|
|
566
|
+
|
|
567
|
+
```bash
|
|
568
|
+
pip install pdoc3
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
Generate and serve interactive HTML documentation:
|
|
572
|
+
|
|
573
|
+
```bash
|
|
574
|
+
# Start a local documentation server (recommended)
|
|
575
|
+
pdoc3 --http localhost:8080 sysbot
|
|
576
|
+
|
|
577
|
+
# Or generate static HTML files
|
|
578
|
+
pdoc3 --html --output-dir docs sysbot
|
|
579
|
+
```
|
|
580
|
+
|
|
581
|
+
Then open your browser and navigate to `http://localhost:8080/sysbot` to browse the complete API documentation.
|
|
582
|
+
|
|
583
|
+
The documentation includes:
|
|
584
|
+
- **Module-level docstrings**: Purpose and overview of each module
|
|
585
|
+
- **Class documentation**: Detailed class descriptions and initialization parameters
|
|
586
|
+
- **Method documentation**: Comprehensive Args, Returns, and Raises sections
|
|
587
|
+
- **Package structure**: Hierarchical organization of all components
|
|
588
|
+
|
|
589
|
+
### Error Handling
|
|
590
|
+
|
|
591
|
+
SysBot provides comprehensive error handling:
|
|
592
|
+
|
|
593
|
+
- **Connection Errors**: Detailed error messages for connection failures
|
|
594
|
+
- **Tunnel Management**: Automatic cleanup on tunnel failures
|
|
595
|
+
- **Session Validation**: Verification of session validity before operations
|
|
596
|
+
- **Module Errors**: Clear error messages for module and function calls
|
|
597
|
+
|
|
598
|
+
## License
|
|
599
|
+
|
|
600
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
601
|
+
|
|
602
|
+
## Author
|
|
603
|
+
|
|
604
|
+
Thibault SCIRE - [GitHub](https://github.com/thibaultscire)
|
|
605
|
+
|
|
606
|
+
## Links
|
|
607
|
+
|
|
608
|
+
- **Documentation**: [https://joreci2.github.io/sysbot/](https://joreci2.github.io/sysbot/)
|
|
609
|
+
- **PyPI**: [https://pypi.org/project/sysbot/](https://pypi.org/project/sysbot/)
|
|
610
|
+
- **Repository**: [https://github.com/JoReci2/sysbot](https://github.com/JoReci2/sysbot)
|
|
611
|
+
- **Issues**: [https://github.com/JoReci2/sysbot/issues](https://github.com/JoReci2/sysbot/issues)
|