A developer sets up end-to-end testing for a microservices architecture using Docker and Jest. The process includes configuring package files, creating Docker files for containerized tests, defining a Docker Compose environment to orchestrate multiple services, and implementing health check tests for HTTP and TCP endpoints.
Length 13:48
Captions English (Generated), Spanish (Auto-translated), French (Auto-translated), Korean (Auto-translated), Portuguese (Auto-translated), Vietnamese (Auto-translated) #docker #microservices #testing #jest #typescript #docker-compose #development #automation #coding #terminal
0:00 Okay, so next I want to show you how we can 0:02 easily write some end-to-end 0:04 tests for our microservices so that we can launch some tests 0:08 against the real application and make sure everything is working as 0:11 expected. Now, these tests are going to be different from unit tests 0:15 or 0:15 integration tests. These tests are actually going to test the 0:18 production code running inside of a Docker container 0:22 with all of the other dependencies also running. 0:26 This kind of test is going to give us the most bang for our buck and make sure the 0:29 app is still functioning correctly. So let's go ahead 0:32 and see how we can do this. 0:33 I'm going to go ahead and create a new end-to-end folder in the 0:36 root of the 0:37 project, and I'm actually going to create a new 0:40 package.json inside of this end-to-end folder. 0:44 It's going to be a separate project all by itself, so we can open 0:47 up a new terminal and CD into the end-to-end 0:51 folder and run PNPM init. For the 0:55 package name, I'll just call it sleeper 0:58 end-to-end, 1:00 and we can continue through the rest of the setup instructions to generate a 1:04 package.json. So let's CD back into the 1:07 end-to-end folder and we can PNPM install -D for 1:11 development dependency. Make sure we install Jest, which 1:15 is what we're 1:15 going to use to run the tests, TypeScript Jest, 1:19 TypeScript itself, and then the types for Jest. 1:24 So now that we have a package.json, go ahead 1:28 and create a tsconfig.json so we can 1:32 include a very basic set of instructions for how to compile 1:36 our TypeScript code. So we'll include all the TypeScript inside 1:40 of 1:40 a new specs folder. So we'll create this specs folder, 1:44 and this 1:44 is where we'll actually include all of our tests themselves. 1:48 And then the rest of these options for TS config are just some basic
The rest of the transcript is for members.
Sign in