exam questions

Exam Professional Cloud Developer All Questions

View all questions & answers for the Professional Cloud Developer exam

Exam Professional Cloud Developer topic 1 question 197 discussion

Actual exam question from Google's Professional Cloud Developer
Question #: 197
Topic #: 1
[All Professional Cloud Developer Questions]

You are planning to add unit tests to your application. You need to be able to assert that published Pub/Sub messages are processed by your subscriber in order. You want the unit tests to be cost-effective and reliable. What should you do?

  • A. Implement a mocking framework.
  • B. Create a topic and subscription for each tester.
  • C. Add a filter by tester to the subscription.
  • D. Use the Pub/Sub emulator.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
__rajan__
7 months, 1 week ago
Selected Answer: D
D is correct.
upvoted 1 times
...
omermahgoub
1 year, 3 months ago
Selected Answer: D
Option B, creating a topic and subscription for each tester, would be costly and time-consuming as it would require creating and managing a large number of topics and subscriptions. Additionally, it would not ensure that messages are processed in order, as messages may be delivered out of order to different subscriptions. Option D, using the Pub/Sub emulator, would be cost-effective and reliable as it allows you to test your application's Pub/Sub functionality locally without incurring any costs. Additionally, the emulator allows you to easily assert that messages are processed in order by using the same topic and subscription for all unit tests.
upvoted 2 times
...
telp
1 year, 3 months ago
Selected Answer: D
Agree with D. They want unit test cost-effective and reliable so need an emulator which will never have an issue to do that. B is not correct for me because the unit test using a real topic and subscription can have issue sometimes and it's not cost-effective to pay for each tester a subscription. The b is more a solution for integration test.
upvoted 1 times
...
TNT87
1 year, 4 months ago
Selected Answer: B
https://brightsec.com/blog/unit-testing-best-practices/ One scenario per test
upvoted 1 times
...
micoams
1 year, 4 months ago
Selected Answer: D
Agree with D, use the emulator for testing.
upvoted 2 times
...
x_cath
1 year, 4 months ago
Selected Answer: D
The answer is D. See https://cloud.google.com/pubsub/docs/emulator, "Testing apps locally with the emulator".
upvoted 3 times
...
sharath25
1 year, 4 months ago
Selected Answer: B
option B
upvoted 1 times
...
zellck
1 year, 4 months ago
Selected Answer: B
B is the answer.
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago