0.2.5 • Published 3 years ago

swagger-smktest v0.2.5

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Kubernetes NodeJS GitHub GitHub

swagger-smktest:

This is a library to facilitate the extraction of apis from the URL of the SWAGGER documentation and to be able to apply smoke testing techniques. It will help you in automation and fault detection issues. Smoke tests: It is a type of stability test that must be applied before starting the rest of the deep tests. It is generally maintenance-free and can help detect stability issues in your architecture early. Keyworld: Smoke Test, Sporadic failures, automatic, test

Content:

Smoke Test Commands :

Command libraryLevelScann API TypeParameters
smokeTestBasicGETNO

General Commands

Command libraryDescription
swaggerSmktest.getPreview(urlSwagger)Get swagger object of the apis from swagger documentation
swaggerSmktest.getBasicApi(urlSwagger)Get list of the apis from swagger documentation
swaggerSmktest.getBasicResponse(urlSwagger)Create basic request using "axios.get "

Use Example (getBasicApi)

const swaggerSmktest = require("swagger-smktest");

async function example_getBasicApi(urlSwagger) {

  const urlSwagger = "https://petstore.swagger.io/v2/swagger.json";

  let simpleApis = await swaggerSmktest.getBasicApi(urlSwagger);


}

Output console:

  pathsForTest: [
    '/pet/findByStatus',
    '/pet/findByTags',
    '/store/inventory',
    '/user/login',
    '/user/logout'
  ]

 responseList: [
   { '200': [Object], '400': [Object] },
   { '200': [Object], '400': [Object] },
   { '200': [Object] },
   { '200': [Object], '400': [Object] },
   { default: [Object] }
],
 apiList: [ 'GET', 'GET', 'GET', 'GET', 'GET' ]

Example of use with Jest:

  1. Install Jest
  2. Create jest file: basicSmktest_JestExample.test

  3. Example of basic smokeTest:

Test example with Jest:

  const swaggerSmktest = require("swagger-smktest");

  let urlSwagger = "https://petstore.swagger.io/v2/swagger.json";

  let {
    responseOfRequest,
    coverage,
    successSmokeTest,
    report,
    abstractReport,
  } = await swaggerSmktest.smokeTest(urlSwagger);

  // Render the APIs SmokeTest report
  console.log(report.render());

  // Render the General report:
  console.log(abstractReport.render());

  // Jest
  expect(successSmokeTest).toBe(false);

  });

Console output:

toolss_200px

Referents

https://app.swaggerhub.com/

0.2.3

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.2.2

3 years ago

0.1.9

3 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.5

3 years ago

0.0.44

3 years ago

0.0.45

3 years ago

0.0.46

3 years ago

0.0.47

3 years ago

0.1.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.3

3 years ago

0.0.43

3 years ago

0.0.41

3 years ago

0.0.42

3 years ago

0.0.4

3 years ago

0.0.31

3 years ago

0.0.32

3 years ago

0.0.23

3 years ago

0.0.35

3 years ago

0.0.24

3 years ago

0.0.25

3 years ago

0.0.3

3 years ago

0.0.27

3 years ago

0.0.22

3 years ago

0.0.21

3 years ago

0.0.2

3 years ago

0.0.0

3 years ago