Contains helpers for testing the Google Cloud C++ Client Libraries.
The symbols defined in this namespace are part of google-cloud-cpp's public API. Application developers may use them when mocking the client libraries in their own tests.
Functions
CurrentOptions()
Retrieve options used in a client call.
This would be used to verify configuration options from within a MockConnection. It provides a way for applications to test the difference between client.Foo(request, options) and client.Foo(request).
TEST(Foo, CallOptions) {
auto mock = std::make_shared<MockConnection>();
EXPECT_CALL(*mock, Foo).WillOnce([] {
auto const& options = google::cloud::mocks::CurrentOptions();
EXPECT_THAT(options, ...);
});
auto client = Client(mock);
MyFunctionThatCallsFoo(client);
}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-14 UTC."],[[["\u003cp\u003eThis documentation outlines various versions of the Google Cloud C++ Client Libraries, ranging from the latest release candidate \u003ccode\u003e2.37.0-rc\u003c/code\u003e down to version \u003ccode\u003e2.10.1\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe content focuses on the \u003ccode\u003egoogle::cloud::mocks\u003c/code\u003e namespace, which provides helpers for testing the Google Cloud C++ Client Libraries.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eCurrentOptions()\u003c/code\u003e function is used to retrieve and verify configuration options within a \u003ccode\u003eMockConnection\u003c/code\u003e during client call testing.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eMakeStreamRange()\u003c/code\u003e function is provided to construct a \u003ccode\u003eStreamRange<T>\u003c/code\u003e for testing purposes, allowing for the simulation of successful values and final status outcomes.\u003c/p\u003e\n"],["\u003cp\u003eThe library's symbols within the described namespace are designed to be part of the \u003ccode\u003egoogle-cloud-cpp\u003c/code\u003e public API, allowing developers to mock client libraries in their tests.\u003c/p\u003e\n"]]],[],null,[]]