> For the complete documentation index, see [llms.txt](https://rahuls-organization-17.gitbook.io/handshake/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rahuls-organization-17.gitbook.io/handshake/help-docs/pytest/how-does/structure.md).

# Structure

## What you might need:

* Ensure the report structure matches the format used in pytest.
* Interpret grouped tests through the generated reports.

## How do we show:

* Class based Tests are considered <mark style="color:orange;">Test Suite</mark>, which are test entities that have tests grouped under them
* Functional Tests are considered <mark style="color:purple;">Test Cases</mark>, which are test entities that have multiple assertions and their results are considered important for deciding the overall status of the test run.
* &#x20;In Excel, we add links (parent) columns to redirect to the parent suite in both the Test Scenarios and Test Cases sheet.

## Group multiple tests in a class

```python
# content of test_class.py
class TestClass:
    def test_one(self):
        x = "this"
        assert "h" in x

    def test_two(self):
        x = "hello"
        assert hasattr(x, "check")
```

Sample Results in DB:

***

Query Used: `select title, standing, suiteType, suiteID, parent, round(duration, 2) from suitebase order by started;`

| title           | standing | suiteType | suiteID                              | parent                               | round(duration, 2) |
| --------------- | -------- | --------- | ------------------------------------ | ------------------------------------ | ------------------ |
| test\_one       | PASSED   | SETUP     | f767163f-7fc1-44cf-8ca7-81fde70a35f1 | ab13b169-860e-4b03-9585-3a586efeeef3 | 1.53               |
| test\_sample.py | FAILED   | SUITE     | c5624e09-5878-4047-8175-16855c664d55 |                                      | 7                  |
| TestClass       | FAILED   | SUITE     | 7ade1117-5b9f-49c3-9db7-654f5cf3056a | c5624e09-5878-4047-8175-16855c664d55 | 7                  |
| test\_one       | PASSED   | TEST      | ab13b169-860e-4b03-9585-3a586efeeef3 | 7ade1117-5b9f-49c3-9db7-654f5cf3056a | 0.65               |
| test\_one       | PASSED   | TEARDOWN  | 5f57d407-9aff-4a7b-911a-24da37976c5e | ab13b169-860e-4b03-9585-3a586efeeef3 | 1.1                |
| test\_two       | PASSED   | SETUP     | aab287cd-80a8-428c-82ab-1f60c06e7a91 | fc89df70-11a6-443d-93bf-9bf10a8a6312 | 1.19               |
| test\_two       | FAILED   | TEST      | fc89df70-11a6-443d-93bf-9bf10a8a6312 | 7ade1117-5b9f-49c3-9db7-654f5cf3056a | 0.51               |
| test\_two       | PASSED   | TEARDOWN  | 72ef3063-748c-430c-b51a-1a1c8e99b2fe | fc89df70-11a6-443d-93bf-9bf10a8a6312 | 1.23               |

Parent of:

* Test Suite - This could be another Test Suite
* Test Case - Could be Setup or Teardown
* Setup/Teardown - No Parent (not ideal case)

## TODO

* [ ] Prepare a way to showcase hierarchy in an HTML report
* [ ] Prepare a way to export the hierarchy structure in Excel


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://rahuls-organization-17.gitbook.io/handshake/help-docs/pytest/how-does/structure.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
