Implementation:Microsoft Semantic kernel Bing SiteFilter 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 with a site filter for devblogs.microsoft.com, 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 query "What is the Semantic Kernel? site:devblogs.microsoft.com". It serves as a mock response fixture for unit testing the Bing search plugin's site-filtered search functionality. The response follows the standard Bing Search API response schema with type SearchResponse.
Key elements of the response:
- queryContext - Contains the original query with the
site:devblogs.microsoft.comfilter - webPages - Collection of web search results (totalEstimatedMatches: 695) restricted to the devblogs.microsoft.com domain
- Each result includes: id, name, url, thumbnailUrl, datePublished, snippet, displayUrl, cachedPageUrl, language, and primaryImageOfPage
- Results include entries like "Hello, Semantic Kernel!" from the Semantic Kernel devblog
This fixture validates that the Bing search plugin correctly parses site-filtered responses and extracts relevant search result metadata.
Usage
This file is loaded during Plugins unit test execution to mock Bing Web Search API responses when testing the site filter functionality. It allows tests to run without making actual HTTP calls to the Bing API, ensuring deterministic and repeatable test results. Developers working on the Bing search plugin use this data to validate response parsing, result extraction, and site-specific filtering logic.
Code Reference
Source Location
- Repository: Microsoft_Semantic_kernel
- File: dotnet/src/Plugins/Plugins.UnitTests/TestData/bing_site_filter_devblogs_microsoft.com.json
- Lines: 1-471
Signature
{
"_type": "SearchResponse",
"queryContext": {
"originalQuery": "What is the Semantic Kernel? site:devblogs.microsoft.com"
},
"webPages": {
"webSearchUrl": "https://www.bing.com/search?q=...",
"totalEstimatedMatches": 695,
"value": [
{
"id": "https://api.bing.microsoft.com/api/v7/#WebPages.0",
"name": "Hello, Semantic Kernel! | Semantic Kernel",
"url": "https://devblogs.microsoft.com/semantic-kernel/hello-world/",
"thumbnailUrl": "https://www.bing.com/th?id=...",
"datePublished": "2023-03-17T00:00:00.0000000",
"snippet": "Semantic Kernel (SK) is a lightweight SDK...",
"language": "en"
}
]
}
}
Import
// Load the mock Bing site-filtered response in unit tests
var json = File.ReadAllText("TestData/bing_site_filter_devblogs_microsoft.com.json");
var response = JsonSerializer.Deserialize<BingSearchResponse>(json);
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| originalQuery | string | yes | The search query including site filter (e.g., "What is the Semantic Kernel? site:devblogs.microsoft.com") |
Outputs
| Name | Type | Description |
|---|---|---|
| _type | string | Response type identifier ("SearchResponse") |
| queryContext | object | Query metadata including the original query string |
| webPages.totalEstimatedMatches | integer | Estimated total number of matching results |
| webPages.value | array | Array of web page result objects with name, url, snippet, datePublished, and thumbnailUrl |
Usage Examples
Mocking a Bing Site-Filtered Search Response
// Example: Using the mock data to test the Bing search plugin
var mockJson = File.ReadAllText("TestData/bing_site_filter_devblogs_microsoft.com.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?",
siteFilter: "devblogs.microsoft.com");
Assert.NotEmpty(results);
Assert.All(results, r => Assert.Contains("devblogs.microsoft.com", r.Url));