Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jmfiola/jest-api-test-typescript-example
An example repository which provides the necessary boilerplate for a reusable and maintainable jest test framework
https://github.com/jmfiola/jest-api-test-typescript-example
api-testing api-testing-framework jest rest-api restful-api test-automation test-framework testing-tools typescript typescript-tests
Last synced: about 7 hours ago
JSON representation
An example repository which provides the necessary boilerplate for a reusable and maintainable jest test framework
- Host: GitHub
- URL: https://github.com/jmfiola/jest-api-test-typescript-example
- Owner: jmfiola
- License: mit
- Created: 2022-02-21T23:15:17.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-02-23T01:49:22.000Z (over 2 years ago)
- Last Synced: 2023-07-19T20:44:51.266Z (over 1 year ago)
- Topics: api-testing, api-testing-framework, jest, rest-api, restful-api, test-automation, test-framework, testing-tools, typescript, typescript-tests
- Language: TypeScript
- Homepage:
- Size: 432 KB
- Stars: 5
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
[![Build Status][build-shield]][build-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]
[![LinkedIn][linkedin-shield]][linkedin-url]
Jest Api Test Framework: A TypeScript Example
This is an example repository which provides the necessary boilerplate code for a reusable and maintainable jest api test framework using TypeScript.
Report Bug
ยท
Request Feature
Table of Contents
## About The Project
This is a basic test framework that hits the [Chuck Norris Jokes API](https://api.chucknorris.io/) following 3 core values:
1. Endpoint functionality should be wrapped by a class method which is abstracted as much as possible ๐2. Those class methods should be unit tested ๐งช
3. Actual API tests will then import those class methods to interact with the live API ๐
### Built With
* [TypeScript](https://www.typescriptlang.org/)
* [Node.js](https://nodejs.org/en/about/)
* [Jest](https://jestjs.io/docs/getting-started)## Getting Started
### PrerequisitesYou will want the latest version of npm installed. For reference, this project was developed with npm version `8.5.1`.
```sh
npm install npm@latest -g
```### Installation
1. Clone the repo
```sh
git clone https://github.com/jmfiola/jest-api-test-typescript-example.git
```
3. Install NPM packages
```npm
npm install
```## Usage
1. Run the unit tests for the framework with code coverage
```npm
npm run unit:test
```
2. Run the functional tests which actually hit the live Chuck Norris API
```npm
npm run functional:test
```You can use this framework as a starting point for whatever API tests you would like to run. This framework allows for the flexibility of running tests which have free range with what headers they use, what routes they call, etc. whilst also providing easy-to-use, reusable, unit tested class methods. This makes the tests a lot more accessible to test writers and framework maintainers!
## Roadmap
- [ ] Dockerization
- [ ] Reporting Integration
- [ ] Tag-based test collectionSee the [open issues](https://github.com/jmfiola/jest-api-test-typescript-example/issues) for a full list of proposed features (and known issues).
## Contributing
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**. My venmo is [@Jacob-Fiola](https://account.venmo.com/u/Jacob-Fiola)! ๐
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request## License
Distributed under the MIT License. See `LICENSE.txt` for more information.
## Contact
Project Link: [https://github.com/jmfiola/jest-api-test-typescript-example](https://github.com/jmfiola/jest-api-test-typescript-example)
Email: [email protected]
[contributors-shield]: https://img.shields.io/github/contributors/jmfiola/jest-api-test-typescript-example.svg?style=for-the-badge
[contributors-url]: https://github.com/jmfiola/jest-api-test-typescript-example/graphs/contributors
[build-shield]: https://img.shields.io/github/workflow/status/jmfiola/jest-api-test-typescript-example/CI.svg?style=for-the-badge
[build-url]: https://github.com/jmfiola/jest-api-test-typescript-example/actions
[forks-shield]: https://img.shields.io/github/forks/jmfiola/jest-api-test-typescript-example.svg?style=for-the-badge
[forks-url]: https://github.com/jmfiola/jest-api-test-typescript-example/network/members
[stars-shield]: https://img.shields.io/github/stars/jmfiola/jest-api-test-typescript-example.svg?style=for-the-badge
[stars-url]: https://github.com/jmfiola/jest-api-test-typescript-example/stargazers
[issues-shield]: https://img.shields.io/github/issues/jmfiola/jest-api-test-typescript-example.svg?style=for-the-badge
[issues-url]: https://github.com/jmfiola/jest-api-test-typescript-example/issues
[license-shield]: https://img.shields.io/github/license/jmfiola/jest-api-test-typescript-example.svg?style=for-the-badge
[license-url]: https://github.com/jmfiola/jest-api-test-typescript-example/blob/master/LICENSE.txt
[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
[linkedin-url]: https://linkedin.com/in/jacob-fiola
[product-screenshot]: images/screenshot.png