https://github.com/charlyautomatiza/starter-postman-newman
Creamos en vivo un starter project para ejecutar Collections de Postman tanto locales como Cloud mediante Newman.
https://github.com/charlyautomatiza/starter-postman-newman
apitesting postman postman-collection postman-example postman-newman postman-test
Last synced: 16 days ago
JSON representation
Creamos en vivo un starter project para ejecutar Collections de Postman tanto locales como Cloud mediante Newman.
- Host: GitHub
- URL: https://github.com/charlyautomatiza/starter-postman-newman
- Owner: charlyautomatiza
- Created: 2022-01-28T15:47:29.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-12-02T23:45:31.000Z (over 2 years ago)
- Last Synced: 2025-04-12T00:04:28.705Z (16 days ago)
- Topics: apitesting, postman, postman-collection, postman-example, postman-newman, postman-test
- Language: TypeScript
- Homepage: https://linktr.ee/charlyautomatiza
- Size: 94.7 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Starter project creado en vivo en [Stream de Twitch](https://www.twitch.tv/charlyautomatiza) basado en [Postman](https://www.postman.com/), [Newman](https://www.npmjs.com/package/newman), [NodeJS](https://nodejs.org/es/) y [TypeScript](https://www.typescriptlang.org/)
## Tabla de contenidos
### Requerimientos generales
- Instalar [Node.js](https://nodejs.org/es/download/)
- Instalar algún cliente git como por ejemplo [git bash](https://git-scm.com/downloads)
- Instalar [Newman](https://www.npmjs.com/package/newman) de manera global.```bash
npm install -g newman
```### Instalación del framework de pruebas
#### **Clonar el repositorio:**
```bash
git clone https://github.com/charlyautomatiza/starter-postman-newman.git
```#### **Instalar las dependencias.**
npm install
#### **Para la ejecución de los test**
```bash
npm run test
```#### **Los reportes de ejecución quedan en la carpeta newman y se borran ante cada nueva ejecución**
```bash
cd newman
ls
```#### **Para ejecutar con tus propias collections basta con modificar el require en el archivo [main.ts](./src/main.ts) de la opción "collection"**
```Typescript
// Runner collection local
newman.run({
collection: require('./collections/yourCollectionName.json'),
reporters: reporters,
}, function (err: Error | null) {
if (err) { throw err; }
console.log('Collection run complete!');
});
``````Typescript
// Runner collection Cloud
newman.run({
collection: 'https://www.getpostman.com/collections/YourCollectionID',
reporters: reporters,
}, function (err: Error | null) {
if (err) { throw err; }
console.log('Cloud collection run complete!');
});
```#### **Para agregar o quitar tipos de reportes basta con modificar la constante reports del archivo [main.ts](./src/main.ts) de la opción "collection"**
```Typescript
// List of reports
const reports = ['junit', 'cli', 'progress', 'json'];
```#### **Aclaración sobre Cloud Collections**
Para poder ejecutar las collections desde la nube debes tener una cuenta de [Postman](https://www.postman.com/).
Deberás exportar tu collection en la nube y obtener el ID de la collection mediante.
- Seleccionar la opción **"Share"**.
- Seleccionar **"Vía JSON link"**.