Eai BAT
latest update to be seen in documentation
Quick overview
Basic automation tool is mainly a python class which holds various data.
It aims to ease the test's evidence creation by recording steps definition and content in an ordered way.
One goal is that class may be subclassed so that your automaton fits your needs.
What's in?
- EaiBat class with few properties and methods.
- folder_file_name_cleaning package function which cleans a string from spaces and some special characters.
Properties
- url : yes it's designed to test APIs or Web application. Allow
http,httpsandftpscheme, ASCII letters, digits and+,.and:characters - history : your tests records in an ordered dictionary.
- step : your current test step. It's a length two tuple containing
intorstring. It might be constructed using a Behave's Step. - evidence_location : where you store the evidence as a
string.
Methods
- push_event: takes one event argument
- a request's Response object,
- a
string - a
dictionary - a length 2 tuple for file event. First part is the filename (relative to the evidence_folder) and the second part is the file type. Currently, only three types are managed:
img,txtorsql.
- clear_history: without argument.
- create_evidence: takes two arguments
filename: the evidence filenameevidence_type: eithermarkdownorword. Please notemarkdowngenerator is not as complete aswordgenerator.
How to use it?
As a standalone...
Well, I don't use it as a standalone.
You could create an instance of EaiBat, feed the history and then create the evidence.
It may look like something as below
from eaiBat import EaiBat
my_reporter = EaiBat()
# Set first where evidence should be stored
my_reporter.evidence_location = 'path_to_evidence_location'
# Set the step. Mind that Behave's step do the job
my_reporter.step = ('First step', 'my action')
# Set the history content for the step
my_reporter.push_event("I describe what I do")
# Another step
my_reporter.step = ('Second step', 'another action')
# Another content. Mind the file will be search in the 'evidence_location'
my_reporter.push_event(('screenshot.png', 'img'))
my_reporter.push_event(('sql_file_i_processed.sql', 'sql'))
# Create the evidence
my_reporter.create_evidence("my_evidence.docx", "word")
# Clear the history for a new run
my_reporter.clear_history()
Part of Behave framework
I prefer using this package as part of Behave test automation framework.
Here is my usage:
- In the environment.py file (see Behave's documentation)
from helpers.model import MyModel
from eaiBat import folder_file_name_cleaning
def before_all(context):
context.model = MyModel()
context.model.url = 'http://my.test.environment.com'
def before_step(context, step):
context.model.step = step
def before_scenario(context, scenario):
context.model.evidence_location = f'evidence/{folder_file_name_cleaning(scenario.name)}'
def after_scenario(context, scenario):
evidence_name = f"{scenario.name}-{scenario.status}.docx"
context.model.create_evidence(folder_file_name_cleaning(evidence_name), "word")
context.model.clear_history()
- In the helpers.model package (homemade package for the test automation) assuming I test a GUI application and I have a
take_a_screeshotfunction which return the picture's filename
from eaiBat import EaiBat
class MyModel(EaiBat):
def some_action(self):
# Action I want to reuse in my steps
self.push_event((take_a_screenshot(), 'img'))
- In the steps definitions
from behave import Given
from shutil import copy
@Given('I set "{user}" user')
def set_user_in_db(context, user):
try:
execute_sql_script(f'resources/script/{user}.sql') # Assuming you have a function executing sql scripts
context.model.push_event(f"The {user} is in the database")
copy(f'resources/script/{user}.sql', f'{context.model.evidence_location}/{user}.sql')
context.model.push_event((f'{user}.sql', 'sql'))
except Exception as exception:
context.model.push_event(f"The step has failed due to {exception.args}")
Metadata
Release files for eaibat 0.0.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| eaibat-0.0.11.tar.gz | 12.2 kB | Without provenance | Details for eaibat-0.0.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| eaibat-0.0.11-py3-none-any.whl | Python 3 | none | any | Details for eaibat-0.0.11-py3-none-any.whl |
Total release size: 42.4 kB
Release files / eaibat-0.0.11.tar.gz
| Download URL | eaibat-0.0.11.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e7a6170493694a6a7f5d1dc4ca1636e15544499e1f8d3a221bce113ab7d07b1
|
|
BLAKE2b-256 checksum How to use checksums |
4da01c0541c37913240852d6ba8b01264871e56a31d93364c0f12ee6506a052a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.3
|
Release files / eaibat-0.0.11-py3-none-any.whl
| Download URL | eaibat-0.0.11-py3-none-any.whl |
|---|---|
| Size | 30.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2bdedab018e42ff497f221089f0b1d3a5dfdfd1c085a5590f78a5fddbdb86dde
|
|
BLAKE2b-256 checksum How to use checksums |
87be7eb9d61a47cda5a15d1376b664036ed138a40aa7d92755436569b001d578
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.3
|
Security for eaibat 0.0.11
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.