Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/khaosdoctor/software-testing-exercises
Exercises for my software testing workshop
https://github.com/khaosdoctor/software-testing-exercises
assertions javascript jest node node-test software tdd tdd-javascript test-runner testing tests
Last synced: 2 months ago
JSON representation
Exercises for my software testing workshop
- Host: GitHub
- URL: https://github.com/khaosdoctor/software-testing-exercises
- Owner: khaosdoctor
- License: mit
- Created: 2022-12-04T14:12:33.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-01-09T19:31:29.000Z (about 2 years ago)
- Last Synced: 2024-10-30T00:44:39.341Z (3 months ago)
- Topics: assertions, javascript, jest, node, node-test, software, tdd, tdd-javascript, test-runner, testing, tests
- Language: JavaScript
- Homepage: https://lsantos.dev
- Size: 433 KB
- Stars: 10
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Exercises in software testing
> A simple collection of small JavaScript exercises to practice software testing.
## What is this?
This is the side material for my workshop on software testing for the Microsoft Reactor Stockholm sessions for beginners. It's a collection of small JavaScript exercises to practice software testing. The activities are designed to be simple and easy to understand so you can focus on the testing part.
You can check my small slide presentation [here](https://lsantos.dev/js-software-tests) (in English). There are not many slides because the session was a hands-on workshop, so I recommend you try the exercises yourself because the slides will only provide some context on concepts and initial understanding.
## Environment
You'll have to install [Node.js](https://nodejs.org) version 18 or later since we'll be using the experimental test runner. I won't show how this is installed here because there's plenty of content about it on the Internet.
Some exercises will not need any external dependencies, and some will be run with test runners aside from Node's native one (like Jest), so you'll need to run `npm install` inside those folders so the test runner can be executed.
## How to use the repository
Your journey starts in this branch.
The repository is divided into exercise folders; each folder has a number in front to show which order they should be done. They go from the most basic to more advanced examples as you progress.
> Be aware that, in some folders, there's also a `package.json`, if this is the case, run `npm install` inside the directory to install the packages
0. **Assertions**: Exercises in this folder will show how to assert different types of expressions; it's meant to be executed with the default node `assert` library
1. **Test suites**: Exercises here will show how to use test grouping to make tests easier to read, for now, you'll use only Node.js native test runner; the tests can be executed with `node --test `
2. **Test runners**: Here you'll need to run `npm install jest` inside de folder to install the Jest test runner. All subsequent testing can be done with the `npm test` command
3. **Test doubles**: From now on, we'll be using Jest as the test runner. This directory has some more advanced testing cases to teach the use of test doubles
4. **TDD**: This directory contains a simple code, but the idea is to get the descriptions of functions and features you should create using the TDD approach in the challenge docs.The solved exercises can be seen in the `resolved` branch.
### Challenges
Challenges are sets of questions that will defy your knowledge, they don't have an answer in the `resolved` branch which means you'll have to do it by yourself! Good luck.
## Got more exercises?
If you want to contribute with more exercises and add more tests, feel free to do so opening a PR with your new test files, just make sure that they're following the same code conventions as the other files.