Question 228 of 500
Building and testing applicationsmediumMultiple ChoiceObjective-mapped

Quick Answer

The correct answer is consumer-driven contract testing with tools like Spring Cloud Contract. This approach is most appropriate because it validates microservices interactions by defining and verifying API contracts—such as request/response formats, headers, and status codes—without requiring deployment to a full GKE cluster, making it ideal for a migration from a monolithic Java application with a shared MySQL database. On the Google Professional Cloud Developer exam, this scenario tests your understanding of lightweight integration testing strategies that catch service communication issues early, avoiding the overhead of end-to-end tests. A common trap is assuming end-to-end testing in a cluster is necessary, but CDC tools like Spring Cloud Contract allow you to verify contracts locally or in CI pipelines. Remember the memory tip: “Contracts before clusters”—validate the handshake between services before you ever spin up a pod.

PCD Building and testing applications Practice Question

This PCD practice question tests your understanding of building and testing applications. Compare every option against the stated constraints before choosing — the best answer satisfies all requirements, not just the most obvious one. After answering, compare your reasoning against the explanation and wrong-answer breakdown below. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.

A company is migrating a monolithic Java application to microservices on Google Kubernetes Engine (GKE). The application uses a shared MySQL database. The team wants to adopt a testing strategy that validates service interactions without deploying to a full cluster. Which testing approach is most appropriate?

Question 1mediummultiple choice
Full question →

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Consumer-driven contract testing with tools like Spring Cloud Contract.

Consumer-driven contract testing (CDC) with tools like Spring Cloud Contract validates the interactions between microservices by defining and verifying API contracts (e.g., request/response formats, headers, status codes) without requiring a full GKE cluster. This approach is ideal for a migration from a monolithic Java application because it ensures that each service adheres to its expected behavior when communicating over HTTP or messaging, catching integration issues early in the development cycle. It does not require deploying to a cluster, making it faster and more lightweight than end-to-end testing.

Key principle: Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Load testing to simulate production traffic.

    Why it's wrong here

    Load testing focuses on performance, not functional interaction validation.

  • Unit testing with mocked dependencies.

    Why it's wrong here

    Unit tests test individual components, not service interactions.

  • Consumer-driven contract testing with tools like Spring Cloud Contract.

    Why this is correct

    Contract testing validates that services adhere to agreed-upon contracts without full deployment.

    Related concept

    Read the scenario before looking for a memorised answer.

  • End-to-end testing in a staging environment.

    Why it's wrong here

    End-to-end tests require a deployed environment; the team wants to avoid full cluster deployment.

Common exam traps

Common exam trap: answer the scenario, not the keyword

Cisco often tests the distinction between testing levels in a microservices context; the trap here is that candidates confuse 'validating service interactions without a full cluster' with end-to-end testing, but the key constraint is avoiding full deployment, which CDC satisfies by using contract stubs and provider verification in isolated environments.

Detailed technical explanation

How to think about this question

Consumer-driven contract testing works by having the consumer service define a contract (e.g., using Spring Cloud Contract’s Groovy DSL or Pact’s JSON format) that specifies expected interactions, including HTTP method, path, headers, and body. The provider then verifies these contracts against its actual implementation, often using stubs generated from the contracts to simulate the provider during consumer tests. This approach is particularly valuable during a monolithic-to-microservices migration because it allows teams to incrementally extract services while maintaining backward compatibility, catching breaking changes (e.g., a missing field or changed status code) before deployment.

KKey Concepts to Remember

  • Read the scenario before looking for a memorised answer.
  • Find the constraint that changes the correct option.
  • Eliminate answers that are true in general but not in this case.

TExam Day Tips

  • Watch for words such as best, first, most likely and least administrative effort.
  • Review why wrong options are wrong, not only why the correct option is correct.

Key takeaway

Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option.

Real-world example

How this comes up in practice

A cloud solutions architect for a retail company is evaluating services for a new workload. The correct answer here reflects best practice for the specific scenario described — not a general cloud recommendation. Answer the scenario, not the keyword: identify the specific constraint before choosing the most familiar-sounding option. Cloud exam questions reward reading the constraint carefully: the same technology can be right or wrong depending on the use case.

What to study next

Got this wrong? Here's your next step.

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

Related practice questions

Related PCD practice-question pages

Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.

Practice this exam

Start a free PCD practice session

Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.

FAQ

Questions learners often ask

What does this PCD question test?

Building and testing applications — This question tests Building and testing applications — Read the scenario before looking for a memorised answer..

What is the correct answer to this question?

The correct answer is: Consumer-driven contract testing with tools like Spring Cloud Contract. — Consumer-driven contract testing (CDC) with tools like Spring Cloud Contract validates the interactions between microservices by defining and verifying API contracts (e.g., request/response formats, headers, status codes) without requiring a full GKE cluster. This approach is ideal for a migration from a monolithic Java application because it ensures that each service adheres to its expected behavior when communicating over HTTP or messaging, catching integration issues early in the development cycle. It does not require deploying to a cluster, making it faster and more lightweight than end-to-end testing.

What should I do if I get this PCD question wrong?

Identify which exam domain this question belongs to, review the core concept, then practise similar questions from the same domain.

What is the key concept behind this question?

Read the scenario before looking for a memorised answer.

About these practice questions

Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

Last reviewed: Jun 11, 2026

Question Discussion

Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.

Loading comments…

Sign in to join the discussion.

This PCD practice question is part of Courseiva's free Google Cloud certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the PCD exam.