# Testing web routes

**URL:** https://discuss.tryton.org/t/testing-web-routes/5128
**Category:** Developer
**Created:** [March 24, 2022, 3:49pm UTC](https://discuss.tryton.org/t/testing-web-routes/5128 "2022-03-24T15:49:49Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![tiyujopite](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/tiyujopite/32/3004_2.png) [@tiyujopite](https://discuss.tryton.org/u/tiyujopite)
#### Post date: [March 24, 2022, 3:49pm UTC](https://discuss.tryton.org/t/testing-web-routes/5128/1 "2022-03-24T15:49:49Z")

</div>

It ‘s possible testing the endpoints of a module by running your test using `run-rest.py`?

---

<div class="post-metadata">

### Author: ![ced](https://discuss-cdn.tryton.org/user_avatar/discuss.tryton.org/ced/32/1237_2.png) [@ced](https://discuss.tryton.org/u/ced)
#### Post date: [March 24, 2022, 9:31pm UTC](https://discuss.tryton.org/t/testing-web-routes/5128/2 "2022-03-24T21:31:00Z")

</div>

Indeed you can use the [`werkzeug.test.Client`](https://werkzeug.palletsprojects.com/en/2.0.x/test/). You can see an example in `trytond/tests/test_routes.py`.  
But such tests are not transactional, each request has its own transaction which is committed.  
Also I would advise to limit the code in the route and instead put the business code in a method on the Model that the route is calling.

---

<div class="post-metadata">

### Author: ![system](https://discuss-cdn.tryton.org/uploads/default/original/1X/c6f8ec0a40525cdcd50058c734283450a4b3d38b.png) [@system](https://discuss.tryton.org/u/system)
#### Post date: [April 23, 2022, 9:31pm UTC](https://discuss.tryton.org/t/testing-web-routes/5128/3 "2022-04-23T21:31:21Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
