원클릭으로
nuclia-functional-test
This skill file provides guidelines for creating functional tests for the Progress Nuclia .NET SDK.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
This skill file provides guidelines for creating functional tests for the Progress Nuclia .NET SDK.
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
| name | nuclia-functional-test |
| description | This skill file provides guidelines for creating functional tests for the Progress Nuclia .NET SDK. |
Functional tests verify that the SDK can successfully interact with the real Nuclia API using actual credentials. These tests ensure end-to-end functionality of SDK methods.
{MethodName}FunctionalTest.csListResourcesFunctionalTest.cs, CreateResourceFunctionalTest.csInclude a comprehensive XML summary that explains:
Example:
/// <summary>
/// Functional test to verify that the Nuclia SDK can [ACTION] in the configured test Knowledge Box.
/// This test ensures that the SDK is able to connect to the real API using provided credentials and [SPECIFIC OPERATION].
/// Expected result: [EXPECTED OUTCOME].
/// </summary>
using System;
using System.Threading.Tasks;
using Xunit;
using Progress.Nuclia;
// For tests that create resources requiring cleanup:
using System.Collections.Generic;
NucliaDbClient in the constructorNUCLIA_ZONE_IDNUCLIA_KB_IDNUCLIA_API_KEYInvalidOperationException if credentials are missingprivate readonly NucliaDbClient _client;
public {TestClassName}()
{
var zoneId = Environment.GetEnvironmentVariable("NUCLIA_ZONE_ID");
var kbId = Environment.GetEnvironmentVariable("NUCLIA_KB_ID");
var apiKey = Environment.GetEnvironmentVariable("NUCLIA_API_KEY");
if (string.IsNullOrEmpty(zoneId) || string.IsNullOrEmpty(kbId) || string.IsNullOrEmpty(apiKey))
{
throw new InvalidOperationException("Missing Nuclia API credentials. Set NUCLIA_ZONE_ID, NUCLIA_KB_ID, NUCLIA_API_KEY.");
}
var config = new NucliaDbConfig(zoneId, kbId, apiKey);
_client = new NucliaDbClient(config);
}
For tests that create resources (POST/PUT operations), implement IAsyncLifetime to ensure proper cleanup:
public class {TestClassName} : IAsyncLifetime
{
private readonly NucliaDbClient _client;
private readonly List<string> _createdResourceIds = new();
// Constructor remains the same
/// <summary>
/// Initialize async - no setup required.
/// </summary>
public Task InitializeAsync() => Task.CompletedTask;
/// <summary>
/// Clean up all created resources after tests complete.
/// </summary>
public async Task DisposeAsync()
{
foreach (var resourceId in _createdResourceIds)
{
try
{
await _client.Resources.DeleteResourceByIdAsync(resourceId);
}
catch
{
// Ignore cleanup errors to prevent test failures
}
}
}
}
After creating a resource, add its ID to the tracking list:
var createResponse = await _client.Resources.CreateResourceAsync(payload);
var resourceId = createResponse.Data.Uuid;
_createdResourceIds.Add(resourceId); // Track for cleanup
[Fact(DisplayName = "Descriptive test name")][Trait("Category", "Functional")]public async Task {MethodDescription}()CanListResources, CanCreateResource)/// <summary>
/// Verifies that the SDK can [ACTION].
/// The test passes if [SUCCESS CRITERIA].
/// </summary>
For read operations (GET/LIST):
var response = await _client.{Service}.{Method}Async();
Assert.NotNull(response);
Assert.True(response.Success, $"API call failed: {response.Error}");
Assert.NotNull(response.Data);
// Add specific data validation as needed
For write operations (POST/PUT/DELETE):
var response = await _client.{Service}.{Method}Async({parameters});
Assert.NotNull(response);
Assert.True(response.Success, $"API call failed: {response.Error}");
Assert.NotNull(response.Data);
// Verify the operation succeeded with expected data
IAsyncLifetime for tests that create resourcesusing System;
using System.Threading.Tasks;
using Xunit;
using Progress.Nuclia;
/// <summary>
/// Functional test to verify that the Nuclia SDK can [describe operation].
/// This test ensures that the SDK is able to connect to the real API using provided credentials and [specific action].
/// Expected result: [expected outcome].
/// </summary>
public class {MethodName}FunctionalTest
{
private readonly NucliaDbClient _client;
public {MethodName}FunctionalTest()
{
var zoneId = Environment.GetEnvironmentVariable("NUCLIA_ZONE_ID");
var kbId = Environment.GetEnvironmentVariable("NUCLIA_KB_ID");
var apiKey = Environment.GetEnvironmentVariable("NUCLIA_API_KEY");
if (string.IsNullOrEmpty(zoneId) || string.IsNullOrEmpty(kbId) || string.IsNullOrEmpty(apiKey))
{
throw new InvalidOperationException("Missing Nuclia API credentials. Set NUCLIA_ZONE_ID, NUCLIA_KB_ID, NUCLIA_API_KEY.");
}
var config = new NucliaDbConfig(zoneId, kbId, apiKey);
_client = new NucliaDbClient(config);
}
/// <summary>
/// Verifies that the SDK can [describe what is being verified].
/// The test passes if [success criteria].
/// </summary>
[Fact(DisplayName = "{Descriptive test name}")]
[Trait("Category", "Functional")]
public async Task Can{ActionDescription}()
{
// Perform operation
var response = await _client.{Service}.{Method}Async();
// Verify response
Assert.NotNull(response);
Assert.True(response.Success, $"API call failed: {response.Error}");
Assert.NotNull(response.Data);
// Add specific validations
}
}
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Xunit;
using Progress.Nuclia;
using Progress.Nuclia.Model;
/// <summary>
/// Functional test to verify that the Nuclia SDK can [create/update/delete operation].
/// This test ensures that the SDK is able to connect to the real API and perform [operation].
/// Expected result: [expected outcome].
/// </summary>
public class {MethodName}FunctionalTest : IAsyncLifetime
{
private readonly NucliaDbClient _client;
private readonly List<string> _createdResourceIds = new();
public {MethodName}FunctionalTest()
{
var zoneId = Environment.GetEnvironmentVariable("NUCLIA_ZONE_ID");
var kbId = Environment.GetEnvironmentVariable("NUCLIA_KB_ID");
var apiKey = Environment.GetEnvironmentVariable("NUCLIA_API_KEY");
if (string.IsNullOrEmpty(zoneId) || string.IsNullOrEmpty(kbId) || string.IsNullOrEmpty(apiKey))
{
throw new InvalidOperationException("Missing Nuclia API credentials. Set NUCLIA_ZONE_ID, NUCLIA_KB_ID, NUCLIA_API_KEY.");
}
var config = new NucliaDbConfig(zoneId, kbId, apiKey);
_client = new NucliaDbClient(config);
}
public Task InitializeAsync() => Task.CompletedTask;
public async Task DisposeAsync()
{
foreach (var resourceId in _createdResourceIds)
{
try
{
await _client.Resources.DeleteResourceByIdAsync(resourceId);
}
catch
{
// Ignore cleanup errors
}
}
}
/// <summary>
/// Verifies that the SDK can [describe operation].
/// The test passes if [success criteria].
/// </summary>
[Fact(DisplayName = "{Descriptive test name}")]
[Trait("Category", "Functional")]
public async Task Can{ActionDescription}()
{
// Prepare test data
var payload = new CreateResourcePayload
{
Title = "test-resource",
Summary = "Test resource description"
};
// Perform operation
var response = await _client.Resources.CreateResourceAsync(payload);
// Verify response
Assert.NotNull(response);
Assert.True(response.Success, $"API call failed: {response.Error}");
Assert.NotNull(response.Data);
// Track for cleanup
var resourceId = response.Data.Uuid;
_createdResourceIds.Add(resourceId);
// Add specific validations
Assert.False(string.IsNullOrEmpty(resourceId));
}
}
Functional tests require valid Nuclia API credentials set as environment variables:
$env:NUCLIA_ZONE_ID = "your-zone-id"
$env:NUCLIA_KB_ID = "your-kb-id"
$env:NUCLIA_API_KEY = "your-api-key"
Run tests:
dotnet test --filter "Category=Functional"