gemtest-webapp


Namegemtest-webapp JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/tum-i4/gemtest-webapp
SummaryVisualize metamorphic test cases from gemtest
upload_time2025-01-27 17:01:44
maintainerSimon Speth
docs_urlNone
authorSimon Speth
requires_python<3.14,>=3.8
licenseMIT
keywords metamorphic testing test framework
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # gemtest-webapp

The ``gemtest-webapp`` extends the gemtest framework by a web application that allows you to inspect and analyze your 
gemtest test metamorphic test runs. It features a tabular test report and a metamorphic test case detail view where one 
can examine all artifacts of a single executed metamorphic test case.

First, run a ``gemtest`` test suite with the ``--html-report`` flag:

```console
$ pytest --html-report
```

Then, run ``gemtest-webapp`` with the path to the gemtest_results folder created by a gemtest pytest run.
Usually, this folder is created in the directory from which pytest was executed.

```console
$ gemtest-webapp --results-dir gemtest_results/
```
## Custom Visualizers

If the input or output of the system under test you are testing is not nicely presentable by a string, one can 
create a visualizer function visualaizing input and output on a static html page. For this, the ``system_under_test`` 
decorator can take functions as optional arguments, such as:

```python
@gmt.system_under_test(
    visualize_input=visualizer.visualize_input,
    visualize_output=visualizer.visualize_output
)
```

The ``visualize_input`` function returns a string that is then embedded in the HTML:

```python
def visualize_input(self, sut_input: Any, **kwargs) -> str:
        mtc = kwargs["mtc"]
        index = kwargs["index"]
        run_id = kwargs["run_id"]
        position = kwargs["position"]

        name = f"{mtc.report.sut_name}." \
               f"{mtc.report.mr_name}." \
               f"{mtc.report.mtc_name}." \
               f"{position}_{index}.png"

        image = (self.transform(sut_input).clone() * 255).view(96, 96)
        plt.clf()
        plt.imshow(image, cmap="gray")
        plt.axis("off")
        return self.savefig(self.image_folder, name, run_id)
```

## Webapp

In the html-report, displayed by the ``gemtest-webapp``, one can see the information of all passed, failed, and skipped 
test cases as well as filter by metamorphic relation, system under test, and test verdict.

![Function Domains](resources/MTC-html-report.png)

## MTC Detail View

When clicking on the link/name of a specific metamorphic test case, the metamorphic test case detail view opens.
It visualizes the inputs and outputs of the system under test if a custom visualizer is passed.
This makes investigating why one's test case passed or failed faster and more intuitive. 

![Function Domains](resources/MTC-detail-view.png)

## Citation
If you find the ``gemtest`` or ``gemtest-webapp`` framework useful in your research or projects, please consider citing it:

```
@inproceedings{speth2025,
    author = {Speth, Simon and Pretschner, Alexander},
    title = {{GeMTest: A General Metamorphic Testing Framework}},
    booktitle = "Proceedings of the 47th International Conference on Software Engineering, (ICSE-Companion)",
    pages = {1--4},
    address = {Ottawa, ON, Canada},
    year = {2025},
}
```

## License
[MIT License](https://gitlab.lrz.de/pypracticum/team-mt-metamorphic-testing-framework/-/blob/main/LICENSE)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/tum-i4/gemtest-webapp",
    "name": "gemtest-webapp",
    "maintainer": "Simon Speth",
    "docs_url": null,
    "requires_python": "<3.14,>=3.8",
    "maintainer_email": "simon.speth@tum.de",
    "keywords": "metamorphic testing, test, framework",
    "author": "Simon Speth",
    "author_email": "simon.speth@tum.de",
    "download_url": "https://files.pythonhosted.org/packages/e1/b5/a9d2a574ef09e9cfaa42412acfb5adf86bc2ac16bc0cb154acf13bd25e62/gemtest_webapp-1.0.0.tar.gz",
    "platform": null,
    "description": "# gemtest-webapp\n\nThe ``gemtest-webapp`` extends the gemtest framework by a web application that allows you to inspect and analyze your \ngemtest test metamorphic test runs. It features a tabular test report and a metamorphic test case detail view where one \ncan examine all artifacts of a single executed metamorphic test case.\n\nFirst, run a ``gemtest`` test suite with the ``--html-report`` flag:\n\n```console\n$ pytest --html-report\n```\n\nThen, run ``gemtest-webapp`` with the path to the gemtest_results folder created by a gemtest pytest run.\nUsually, this folder is created in the directory from which pytest was executed.\n\n```console\n$ gemtest-webapp --results-dir gemtest_results/\n```\n## Custom Visualizers\n\nIf the input or output of the system under test you are testing is not nicely presentable by a string, one can \ncreate a visualizer function visualaizing input and output on a static html page. For this, the ``system_under_test`` \ndecorator can take functions as optional arguments, such as:\n\n```python\n@gmt.system_under_test(\n    visualize_input=visualizer.visualize_input,\n    visualize_output=visualizer.visualize_output\n)\n```\n\nThe ``visualize_input`` function returns a string that is then embedded in the HTML:\n\n```python\ndef visualize_input(self, sut_input: Any, **kwargs) -> str:\n        mtc = kwargs[\"mtc\"]\n        index = kwargs[\"index\"]\n        run_id = kwargs[\"run_id\"]\n        position = kwargs[\"position\"]\n\n        name = f\"{mtc.report.sut_name}.\" \\\n               f\"{mtc.report.mr_name}.\" \\\n               f\"{mtc.report.mtc_name}.\" \\\n               f\"{position}_{index}.png\"\n\n        image = (self.transform(sut_input).clone() * 255).view(96, 96)\n        plt.clf()\n        plt.imshow(image, cmap=\"gray\")\n        plt.axis(\"off\")\n        return self.savefig(self.image_folder, name, run_id)\n```\n\n## Webapp\n\nIn the html-report, displayed by the ``gemtest-webapp``, one can see the information of all passed, failed, and skipped \ntest cases as well as filter by metamorphic relation, system under test, and test verdict.\n\n![Function Domains](resources/MTC-html-report.png)\n\n## MTC Detail View\n\nWhen clicking on the link/name of a specific metamorphic test case, the metamorphic test case detail view opens.\nIt visualizes the inputs and outputs of the system under test if a custom visualizer is passed.\nThis makes investigating why one's test case passed or failed faster and more intuitive. \n\n![Function Domains](resources/MTC-detail-view.png)\n\n## Citation\nIf you find the ``gemtest`` or ``gemtest-webapp`` framework useful in your research or projects, please consider citing it:\n\n```\n@inproceedings{speth2025,\n    author = {Speth, Simon and Pretschner, Alexander},\n    title = {{GeMTest: A General Metamorphic Testing Framework}},\n    booktitle = \"Proceedings of the 47th International Conference on Software Engineering, (ICSE-Companion)\",\n    pages = {1--4},\n    address = {Ottawa, ON, Canada},\n    year = {2025},\n}\n```\n\n## License\n[MIT License](https://gitlab.lrz.de/pypracticum/team-mt-metamorphic-testing-framework/-/blob/main/LICENSE)\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Visualize metamorphic test cases from gemtest",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/tum-i4/gemtest-webapp",
        "Repository": "https://github.com/tum-i4/gemtest-webapp"
    },
    "split_keywords": [
        "metamorphic testing",
        " test",
        " framework"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ee94de5a6129094e48732e7e1449fc091fce602b897230720fb11c044569475a",
                "md5": "95e8ed7dd1b19b8ed7ed09679f1a8957",
                "sha256": "a228597a8e75efdf6863b705155b488128d288b0a96208c4d5cfca94c3e1f343"
            },
            "downloads": -1,
            "filename": "gemtest_webapp-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "95e8ed7dd1b19b8ed7ed09679f1a8957",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.14,>=3.8",
            "size": 12263,
            "upload_time": "2025-01-27T17:01:43",
            "upload_time_iso_8601": "2025-01-27T17:01:43.485385Z",
            "url": "https://files.pythonhosted.org/packages/ee/94/de5a6129094e48732e7e1449fc091fce602b897230720fb11c044569475a/gemtest_webapp-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e1b5a9d2a574ef09e9cfaa42412acfb5adf86bc2ac16bc0cb154acf13bd25e62",
                "md5": "914df6a2ccd2a5cbb781de6858ed6be8",
                "sha256": "471bfc9e61345c88d2704ebbd6c612275d1f6df840fe6ce873a3bada570e5d31"
            },
            "downloads": -1,
            "filename": "gemtest_webapp-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "914df6a2ccd2a5cbb781de6858ed6be8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.14,>=3.8",
            "size": 20467,
            "upload_time": "2025-01-27T17:01:44",
            "upload_time_iso_8601": "2025-01-27T17:01:44.809293Z",
            "url": "https://files.pythonhosted.org/packages/e1/b5/a9d2a574ef09e9cfaa42412acfb5adf86bc2ac16bc0cb154acf13bd25e62/gemtest_webapp-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-27 17:01:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "tum-i4",
    "github_project": "gemtest-webapp",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": false,
    "lcname": "gemtest-webapp"
}
        
Elapsed time: 0.44182s