Skip to content

pt_BR: Este projeto tem por objetivo apresentar uma arquitetura de testes de API utilizando SuperTest. // en_US: This project has with main objective show a simple architecture for api tests using SuperTest framework.

Notifications You must be signed in to change notification settings

maximilianoalves/supertest-arch-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Architecture example using SuperTest for api tests

CI para executar o teste e salvar o report no gh-pages.

Para acessar a versão em Português do Brasil, basta clicar aqui! 🇧🇷

This project has with main objective show a simple architecture for api tests using SuperTest framework.

Technologies and tools used:

File Structure

📦 supertest-arch-example
┣ 📂 .github
┃ ┗ 📂 workflows
┃ ┃ ┗ 📜 deploy.yml
┣ 📂 env
┃ ┗ 📜 production.env.json
┣ 📂 report
┃ ┣ 📂 assets
┃ ┗ 📜 index.html
┣ 📂 test
┃ ┣ 📂 login
┃ ┃ ┣ 📂 payloads
┃ ┃ ┃ ┗ 📜 login.payload.js
┃ ┃ ┣ 📂 requests
┃ ┃ ┃ ┗ 📜 login.request.js
┃ ┃ ┗ 📂 tests
┃ ┃ ┃ ┣ 📜 login.post.test.js
┃ ┣ 📂 produtos
┃ ┗ 📂 usuarios
┃ ┃ ┣ 📂 schemas
┃ ┃ ┃ ┣ 📜 usuario.schema.js
┃ ┃ ┃ ┗ 📜 usuarios.schema.js
┃ ┃ ┣ 📂 payloads
┃ ┃ ┃ ┗ 📜 usuario.payload.js
┃ ┃ ┣ 📂 requests
┃ ┃ ┃ ┗ 📜 usuarios.request.js
┃ ┃ ┗ 📂 tests
┃ ┃ ┃ ┣ 📜 usuarios.delete.test.js
┃ ┃ ┃ ┣ 📜 usuarios.get.test.js
┃ ┃ ┃ ┗ 📜 usuarios.post.test.js
┣ 📂 utils
┃ ┗ 📜 global.js
┣ 📜 .gitignore
┣ 📜 .mocharc.js
┣ 📜 README.md
┣ 📜 package-lock.json
┗ 📜 package.json

Execution Examples

  • By npm:

    • To run all tests suite:
      • npm run test:prod
    • Only json schema tests suite:
      • npm run test:prod:schema
  • By the command line:

    • To run all tests suite:
      • NODE_ENV=production mocha
    • Only json schema tests suite:
      • NODE_ENV=production mocha --grep=schema

Execution report

Using the mochawesome and git workflows:

Doubts or improvements !? contact me:

Twitter Medium Linkedin Instagram Facebook

About

pt_BR: Este projeto tem por objetivo apresentar uma arquitetura de testes de API utilizando SuperTest. // en_US: This project has with main objective show a simple architecture for api tests using SuperTest framework.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published