This content originally appeared on DEV Community and was authored by Jayant
Integration Testing
What
In Integration Testing
we test how all the components work together, means unlike unit tests we don't have to mock out the services. We actually start all the services in the integration test and see how they work together.
Downside to this is that it is slower, as we have to start all the auxiliary services.
Here is a gist of what we have to do in the Integration Testing
How
To do the integration test we will use scripts and docker compose file.
-
docker-compose.yml file
- It will start all the services -
script file
- It will run docker compose file, wait for our DB , migrate the DB , Do the Intial Seeding and run all the tests.
run-integration.sh
docker-compose up -d
echo '🟡 - Waiting for database to be ready...'
# The below command will wait for the DB after that all the command run.
./wait-for-it.sh "postgresql://postgres:mysecretpassword@localhost:5432/postgres" -- echo '🟢 - Database is ready!'
npx prisma migrate dev --name init
npm run test
docker-compose down
# To run this file simply do `run-integration.sh` + you need to install wait-for-it.sh from github.
# curl https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh -o scripts/wait-for-it.sh
For All the Steps Visit - 100xdevs Integration Testing
Thanks
This content originally appeared on DEV Community and was authored by Jayant
Jayant | Sciencx (2024-07-26T13:58:44+00:00) Integration Testing : Concept. Retrieved from https://www.scien.cx/2024/07/26/integration-testing-concept/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.