Implementation:Microsoft Semantic kernel Brave Search TestData
| Knowledge Sources | |
|---|---|
| Domains | Testing, Web_Search, Brave_API |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
Mock Brave Search API response JSON for the query "What is Semantic Kernel", used as test fixture data in the Plugins unit tests of the Semantic Kernel .NET SDK.
Description
This JSON file contains a captured Brave Search API response for the query "What is Semantic Kernel". It serves as a mock response fixture for unit testing the Brave search plugin integration. The Brave Search API response structure differs significantly from Bing and Google, using a distinct schema with query, mixed, and web sections.
Key elements of the response:
- query - Contains metadata about the search query including
originaltext,is_navigational,is_news_breaking,spellcheck_off,country, and location fields - mixed - Defines the ordering and layout of mixed search results with type/index pairs indicating how web results should be interleaved
- web - Contains the actual web search results (referenced by the mixed section via index)
- Each web result includes: title, url, description, and additional metadata
- The query section includes flags for
bad_results,should_fallback, andmore_results_available
This fixture validates that the Brave search plugin correctly handles the Brave-specific API response format, which is structurally distinct from both Bing and Google responses.
Usage
This file is loaded during Plugins unit test execution to mock Brave Search API responses. It enables tests to validate Brave-specific response parsing, mixed result ordering, and web result extraction without requiring a live Brave Search API key. Developers adding or maintaining the Brave search plugin use this fixture for deterministic testing.
Code Reference
Source Location
- Repository: Microsoft_Semantic_kernel
- File: dotnet/src/Plugins/Plugins.UnitTests/TestData/brave_what_is_the_semantic_kernel.json
- Lines: 1-445
Signature
{
"query": {
"original": "What is Semantic Kernel",
"show_strict_warning": false,
"is_navigational": false,
"is_news_breaking": false,
"spellcheck_off": true,
"country": "us",
"bad_results": false,
"should_fallback": false,
"more_results_available": true
},
"mixed": {
"type": "mixed",
"main": [
{ "type": "web", "index": 0, "all": false },
{ "type": "web", "index": 1, "all": false }
]
}
}
Import
// Load the mock Brave search response in unit tests
var json = File.ReadAllText("TestData/brave_what_is_the_semantic_kernel.json");
var response = JsonSerializer.Deserialize<BraveSearchResponse>(json);
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| original | string | yes | The original search query text (e.g., "What is Semantic Kernel") |
Outputs
| Name | Type | Description |
|---|---|---|
| query | object | Query metadata including original text, navigational flags, country, and quality indicators |
| query.is_navigational | boolean | Whether the query is navigational in nature |
| query.more_results_available | boolean | Whether additional result pages are available |
| mixed | object | Layout definition specifying how different result types should be ordered |
| mixed.main | array | Array of type/index pairs defining result ordering |
| web | object | Web search results section containing the actual result entries |
Usage Examples
Mocking a Brave Search Response
// Example: Using the mock data to test the Brave search plugin
var mockJson = File.ReadAllText("TestData/brave_what_is_the_semantic_kernel.json");
var handler = new MockHttpMessageHandler(mockJson, HttpStatusCode.OK);
var httpClient = new HttpClient(handler);
var bravePlugin = new BraveSearchPlugin(httpClient, "test-api-key");
var results = await bravePlugin.SearchAsync("What is Semantic Kernel");
Assert.NotEmpty(results);
// Verify the Brave-specific mixed result ordering is handled
Assert.True(results.Count() > 0);