# Introduction

Handshake simplifies the process of exporting test results and sharing them in various formats. It processes the test results collected from test frameworks and ensures they are simplified for better clarity.

requires python `3.11` or `3.12`&#x20;

PyPI Package: <https://pypi.org/project/handshakes/>

## Quick Example:

***

```python
# content of test_sample.py
def inc(x):
    return x + 1


def test_answer():
    assert inc(3) == 5
    
def test_simple():
    assert inc(3) == 4
```

Execute these tests and ensure that Handshake is installed. For example, we will use the pytest test framework. We have a custom reporter implemented for pytest, so once the package is installed, you can execute the tests by running: `pytest`.

### Test Results Available

***

<figure><img src="https://2615085035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFeuVk3k1tLWLvIKaWLn3%2Fuploads%2Fc9pXCWpi0Uz07IN16TqK%2Fimage.png?alt=media&#x26;token=d2d91bfa-c805-43e9-9f98-2754f2811995" alt=""><figcaption><p>TesResults is generated along with the sqlite file</p></figcaption></figure>

{% tabs %}
{% tab title="Sqlite File" %}
After running the tests, as shown above, the results are stored in the `TeStReSuLtS.db` file within the `TestResults` directory (configurable).

Sample File:

***

{% file src="<https://2615085035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFeuVk3k1tLWLvIKaWLn3%2Fuploads%2FQ3Kjz7oxHCqvuC3YBLit%2FTeStReSuLtS.db?alt=media&token=113f0a44-7dfe-4780-a76a-505bbeb242e6>" %}
Sqlite File
{% endfile %}

Please note the structure could vary over time, but you can get the base idea from the sample file
{% endtab %}

{% tab title="JSON File" %}
after the results are stored in the DB, we can execute a few commands, to export the required results.

Execute: `handshake patch TestResults -e json -o JsonReport`

<figure><img src="https://2615085035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFeuVk3k1tLWLvIKaWLn3%2Fuploads%2FelvpAyCqN19IeWDFpjRU%2Fimage.png?alt=media&#x26;token=fc49d278-9fcd-4e49-8d2f-0567c952b8c2" alt=""><figcaption><p>Json Report Generated</p></figcaption></figure>

{% file src="<https://2615085035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFeuVk3k1tLWLvIKaWLn3%2Fuploads%2FqovBqgZqbH6O3h2ZUOQS%2FJsonReport.zip?alt=media&token=6607281c-89b3-4b8d-8cf3-34c30402eba7>" %}
Zip File
{% endfile %}
{% endtab %}

{% tab title="Excel File" %}
Execute the command: `handshake patch TestResults -xl`

{% hint style="info" %}
Please note in order to use Excel export you would need to install optional extras: `excel-export`

`pip install handshakes[excel-export]`

or&#x20;

`poetry add "handshakes[excel-export]"`
{% endhint %}

<figure><img src="https://2615085035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFeuVk3k1tLWLvIKaWLn3%2Fuploads%2F3Z4eU8W95WKryXbYmIw2%2Fimage.png?alt=media&#x26;token=16691820-9d72-466c-bb82-4a82495bb1a4" alt=""><figcaption><p>excel is saved inside the TestResults</p></figcaption></figure>

Sample File:

***

{% file src="<https://2615085035-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFeuVk3k1tLWLvIKaWLn3%2Fuploads%2FfKl7AK5MfUIIKFjzYapf%2Fexcel-export.xlsx?alt=media&token=93c999dc-3856-4b40-9314-3e293b5b83d9>" %}
Excel File
{% endfile %}
{% endtab %}
{% endtabs %}

## Features 🗽

***

* Aggregates reports from various test frameworks
* Stores reports in a .sqlite database
* Supports export to Excel
* Supports export to JSON files
* Archives reports of multiple test runs
* Enables grouping of test runs by project name
* Rotates stored test reports

### Upcoming features 🐳

***

* [ ] Allow Export by HTML (Revamp Designs)
* [ ] Write as many custom reporters as possible
* [ ] Deliver real-time reports.
* [ ] Make sure the Custom Reporter for pytest covers all the features and scenarios
* [ ] Improve Docs and Provide Options for Configuring Handshake Reporter

## Demo ✨

***

{% embed url="<https://rahularanger.github.io/handshake/iframe.html?id=demo-runspagecontent--demo-page&viewMode=story>" %}
Demo Page for List of Runs
{% endembed %}

## Documentation 📦

***

* [Installation Process](https://rahuls-organization-17.gitbook.io/handshake/installation)
* [Supported Test Frameworks](https://rahuls-organization-17.gitbook.io/handshake/supported-frameworks) - While it is not necessary to restrict ourselves to this list, please note that one needs to start and supply results in a specific manner for Handshake to process them. The following custom reporters are available as of now, and additional ones can be provided upon request.
* [Storybook](https://rahularanger.github.io/handshake/?path=/docs/stories-introduction--docs)
* Interested why? Then, please check out [why](https://rahuls-organization-17.gitbook.io/handshake/why "mention") and [idea](https://rahuls-organization-17.gitbook.io/handshake/idea "mention")

## Bugs/Feature Requests

Please use the [GitHub issue tracker](https://github.com/RahulARanger/handshake/issues) to submit bugs or request features.
