January 2019
Intermediate to advanced
520 pages
14h 32m
English
Before we start implementing tests, we need to add some types that we need to interact with microservices. Create a types.rs source file with types:
use serde_derive::Deserialize;use uuid::Uuid;
Now, add a UserId struct that will be used to parse raw responses from the users microservices (yes, we will also test it directly):
#[derive(Deserialize)]pub struct UserId { id: Uuid,}
Also, add a Comment struct that we will use to post new comments to our content microservice:
#[derive(Deserialize)]pub struct Comment { pub id: i32, pub uid: String, pub text: String,}
Now, we can write tests for every microservice separately, and after that, create a test for complex interaction.
Read now
Unlock full access