Google Professional Cloud Developer Question 278
Select 3Google Cloud PlatformYou are developing a serverless application on Google Cloud that interacts with Firestore, Pub/Sub, and Cloud Storage. To perform integration testing in your CI/CD pipeline, you want to use Google Cloud's emulators to simulate the dependent services without incurring costs or impacting production data. Which steps should you take to ensure reliable integration tests?
- A
Set up and start the Firestore Emulator, Pub/Sub Emulator, and Cloud Storage Emulator locally during the CI/CD pipeline.
- B
Configure your application to use the production endpoints for Firestore, Pub/Sub, and Cloud Storage during integration testing.
- C
Write test cases that verify the application interacts with the emulated services as expected, such as verifying data writes and event triggers.
- D
Ensure the emulators are started with proper configurations, such as ports and authentication, to match your application's integration requirements.
- E
Deploy the application to a staging environment and run the integration tests against live Google Cloud services instead of emulators.
Show answer and explanation
Correct answers: A, C, D
Explanation
Using Google Cloud's emulators is an effective way to perform integration testing without affecting production data or incurring costs. This requires setting up and starting the emulators properly, ensuring they are correctly configured, and writing test cases that validate the application's interaction with these emulated services. Using production endpoints or live services during integration testing defeats the purpose of emulators and introduces unnecessary risks.
- A. Correct.
Correct: Setting up and starting the emulators locally is a crucial step for integration testing to mimic the behavior of real services without using production resources.
- B. Incorrect.
Incorrect: Using production endpoints during integration testing can lead to unintended effects on live data and incur costs, defeating the purpose of using emulators.
- C. Correct.
Correct: Writing test cases that validate interactions with the emulated services ensures that your application behaves as expected in a controlled test environment.
- D. Correct.
Correct: Proper emulator configuration is essential for aligning the emulated services with your application's requirements, such as matching expected ports and authentication settings.
- E. Incorrect.
Incorrect: Running tests directly against live services in a staging environment is not considered integration testing with emulators and can lead to higher costs and risks.