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

 Cannot retrieve latest commit at this time.

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