Implementation:Microsoft Semantic kernel Bing Search TestData
| Knowledge Sources | |
|---|---|
| Domains | Testing, Web_Search, Bing_API |
| Last Updated | 2026-02-11 00:00 GMT |
Overview
Mock Bing Web Search API response JSON for the query "What is the 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 Bing Web Search API v7 response for the general query "What is the Semantic Kernel?" without any site filtering. It serves as the primary mock response fixture for unit testing the Bing search plugin's standard search functionality. The response follows the Bing Search API v7 SearchResponse schema.
Key elements of the response:
- queryContext - Contains the original query "What is the Semantic Kernel?"
- webPages - Collection of web search results with totalEstimatedMatches of 2,950,000
- Results span multiple domains including learn.microsoft.com, devblogs.microsoft.com, and others
- First result points to "Introduction to Semantic Kernel | Microsoft Learn" at
https://learn.microsoft.com/en-us/semantic-kernel/overview/ - Each result includes: id, name, url, datePublished, isFamilyFriendly, displayUrl, snippet, cachedPageUrl, language, isNavigational, noCache, and siteName
- The
isNavigationalflag on the first result indicates Bing considers it a navigational query
This is the largest of the search test data files at 650 lines, providing comprehensive coverage of the Bing response format.
Usage
This file is loaded during Plugins unit test execution to mock Bing Web Search API responses for general search queries. It allows tests to validate response deserialization, result ranking, snippet extraction, and metadata parsing without making live API calls. Developers working on the Bing search plugin use this data as the standard test fixture for non-filtered search operations.
Code Reference
Source Location
- Repository: Microsoft_Semantic_kernel
- File: dotnet/src/Plugins/Plugins.UnitTests/TestData/bing_what_is_the_semantic_kernel.json
- Lines: 1-650
Signature
{
"_type": "SearchResponse",
"queryContext": {
"originalQuery": "What is the Semantic Kernel?"
},
"webPages": {
"webSearchUrl": "https://www.bing.com/search?q=What+is+the+Semantic+Kernel%3f",
"totalEstimatedMatches": 2950000,
"value": [
{
"id": "https://api.bing.microsoft.com/api/v7/#WebPages.0",
"name": "Introduction to Semantic Kernel | Microsoft Learn",
"url": "https://learn.microsoft.com/en-us/semantic-kernel/overview/",
"datePublished": "2024-06-24T00:00:00.0000000",
"snippet": "Semantic Kernel is a lightweight, open-source development kit...",
"isNavigational": true,
"siteName": "Microsoft Learn"
}
]
}
}
Import
// Load the mock Bing search response in unit tests
var json = File.ReadAllText("TestData/bing_what_is_the_semantic_kernel.json");
var response = JsonSerializer.Deserialize<BingSearchResponse>(json);
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| originalQuery | string | yes | The search query string (e.g., "What is the Semantic Kernel?") |
Outputs
| Name | Type | Description |
|---|---|---|
| _type | string | Response type identifier ("SearchResponse") |
| queryContext | object | Query metadata including the original query string |
| webPages.webSearchUrl | string | URL to view the search results on bing.com |
| webPages.totalEstimatedMatches | integer | Estimated total number of matching results (2,950,000) |
| webPages.value | array | Array of web page result objects |
| webPages.value[].name | string | Title of the web page result |
| webPages.value[].url | string | URL of the web page result |
| webPages.value[].snippet | string | Text excerpt from the web page |
| webPages.value[].isNavigational | boolean | Whether the result is a navigational match |
| webPages.value[].siteName | string | Name of the website hosting the result |
Usage Examples
Mocking a Standard Bing Search Response
// Example: Using the mock data to test the Bing search plugin
var mockJson = File.ReadAllText("TestData/bing_what_is_the_semantic_kernel.json");
var handler = new MockHttpMessageHandler(mockJson, HttpStatusCode.OK);
var httpClient = new HttpClient(handler);
var bingPlugin = new BingSearchPlugin(httpClient, "test-api-key");
var results = await bingPlugin.SearchAsync("What is the Semantic Kernel?");
Assert.NotEmpty(results);
Assert.Equal("Introduction to Semantic Kernel | Microsoft Learn", results.First().Name);
Assert.Equal("https://learn.microsoft.com/en-us/semantic-kernel/overview/", results.First().Url);