Wanted to add a bit more info about how Pythagora works and the current limitations.
When an API request is being captured, Pythagora saves all database documents used during the request (before and after each db query). When you run the test, first, Pythagora connects to a temporary pythagoraDb database and restores all saved documents. This way, the database state is the same during the test as it was during the capture so the test can run on any environment while NOT changing your local database. Then, Pythagora makes an API request tracking all db queries and checks if the API response and db documents are the same as they were during the capture.
For example, if the request updates the database after the API returns the response, Pythagora checks the database to see if it was updated correctly.
Finally, Pythagora tracks (using istanbul/nyc) lines of code that were triggered during tests, so you know how much of your code is covered by captured tests. So far, I tested Pythagora on open source clones of sites (Reddit, IG, etc.), and some personal projects and I was able to get to 50% of code coverage within 10 minutes and to 90% within 1 hour of playing around.
Tbh, I never had enough time to properly write and maintain tests and I’m hoping to solve that problem with Pythagora so that creating a meaningful code coverage can be done in a few hours instead of a few weeks.
Currently, Pythagora is quite limited and it supports only Node.js apps with Express and Mongoose but if people like it, I'll work on expanding the capabilities.
Anyways, I’m excited to hear what you think.
How do you write integration tests for your API server? Would you consider using Pythagora instead/along with your system?
If not, I'd love to hear what are your concerns and why this wouldn’t work for you?
Wanted to add a bit more info about how Pythagora works and the current limitations.
When an API request is being captured, Pythagora saves all database documents used during the request (before and after each db query). When you run the test, first, Pythagora connects to a temporary pythagoraDb database and restores all saved documents. This way, the database state is the same during the test as it was during the capture so the test can run on any environment while NOT changing your local database. Then, Pythagora makes an API request tracking all db queries and checks if the API response and db documents are the same as they were during the capture.
For example, if the request updates the database after the API returns the response, Pythagora checks the database to see if it was updated correctly.
Finally, Pythagora tracks (using istanbul/nyc) lines of code that were triggered during tests, so you know how much of your code is covered by captured tests. So far, I tested Pythagora on open source clones of sites (Reddit, IG, etc.), and some personal projects and I was able to get to 50% of code coverage within 10 minutes and to 90% within 1 hour of playing around.
Here’s a demo video of how Pythagora works - <https://youtu.be/Be9ed-JHuQg>
Tbh, I never had enough time to properly write and maintain tests and I’m hoping to solve that problem with Pythagora so that creating a meaningful code coverage can be done in a few hours instead of a few weeks.
Currently, Pythagora is quite limited and it supports only Node.js apps with Express and Mongoose but if people like it, I'll work on expanding the capabilities.
Anyways, I’m excited to hear what you think.
How do you write integration tests for your API server? Would you consider using Pythagora instead/along with your system?
If not, I'd love to hear what are your concerns and why this wouldn’t work for you?
Any feedback or ideas are welcome.