Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dotnet test CI and standardize test categories #5286

Merged
merged 10 commits into from
Feb 3, 2025
8 changes: 5 additions & 3 deletions .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ jobs:
run: |
echo "Build AutoGen"
dotnet build --no-restore --configuration Release -bl /p:SignAssembly=true
- name: Unit Test
run: dotnet test --no-build -bl --configuration Release --filter type=!integration
- name: Unit Test V1
run: dotnet test --no-build -bl --configuration Release --filter "Category=UnitV1"
- name: Unit Test V2
run: dotnet test --no-build -bl --configuration Release --filter "Category=UnitV2"

integration-test:
strategy:
Expand Down Expand Up @@ -155,7 +157,7 @@ jobs:
echo "Build AutoGen"
dotnet build --no-restore --configuration Release -bl /p:SignAssembly=true
- name: Integration Test
run: dotnet --version && dotnet test --no-build -bl --configuration Release --filter type=integration
run: dotnet --version && dotnet test --no-build -bl --configuration Release --filter "Category=Integration"
- name: Restore the global.json
run: rm global.json && git checkout -- global.json

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
using AutoGen.Core;
using AutoGen.Tests;
using FluentAssertions;
using Xunit;

namespace AutoGen.Anthropic.Tests;

[Trait("Category", "UnitV1")]
public class AnthropicClientAgentTest
{
[ApiKeyFact("ANTHROPIC_API_KEY")]
Expand Down
1 change: 1 addition & 0 deletions dotnet/test/AutoGen.Anthropic.Tests/AnthropicClientTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace AutoGen.Anthropic.Tests;

[Trait("Category", "UnitV1")]
public class AnthropicClientTests
{
[ApiKeyFact("ANTHROPIC_API_KEY")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

namespace AutoGen.AzureAIInference.Tests;

[Trait("Category", "UnitV1")]
public partial class ChatCompletionClientAgentTests
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

namespace AutoGen.AzureAIInference.Tests;

[Trait("Category", "UnitV1")]
public class ChatRequestMessageTests
{
[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace AutoGen.DotnetInteractive.Tests;

[Collection("Sequential")]
[Trait("Category", "UnitV1")]
public class DotnetInteractiveServiceTest : IDisposable
{
private ITestOutputHelper _output;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
namespace AutoGen.DotnetInteractive.Tests;

[Collection("Sequential")]
[Trait("Category", "UnitV1Kernel")]
public class DotnetInteractiveStdioKernelConnectorTests : IDisposable
{
private string _workingDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace AutoGen.DotnetInteractive.Tests;

[Collection("Sequential")]
[Trait("Category", "UnitV1Kernel")]
public class InProcessDotnetInteractiveKernelBuilderTest
{
[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

namespace AutoGen.DotnetInteractive.Tests;

[Trait("Category", "UnitV1")]
public class MessageExtensionTests
{
[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

namespace AutoGen.Gemini.Tests;

[Trait("Category", "UnitV1")]
public class FunctionContractExtensionTests
{
private readonly Functions functions = new Functions();
Expand Down
2 changes: 2 additions & 0 deletions dotnet/test/AutoGen.Gemini.Tests/GeminiAgentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
using AutoGen.Tests;
using FluentAssertions;
using Google.Cloud.AIPlatform.V1;
using Xunit;
using Xunit.Abstractions;
using static Google.Cloud.AIPlatform.V1.Part;
namespace AutoGen.Gemini.Tests;

[Trait("Category", "UnitV1")]
public class GeminiAgentTests
{
private readonly Functions functions = new Functions();
Expand Down
1 change: 1 addition & 0 deletions dotnet/test/AutoGen.Gemini.Tests/GeminiMessageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace AutoGen.Gemini.Tests;

[Trait("Category", "UnitV1")]
public class GeminiMessageTests
{
[Fact]
Expand Down
2 changes: 2 additions & 0 deletions dotnet/test/AutoGen.Gemini.Tests/GoogleGeminiClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
using FluentAssertions;
using Google.Cloud.AIPlatform.V1;
using Google.Protobuf;
using Xunit;
using static Google.Cloud.AIPlatform.V1.Candidate.Types;

namespace AutoGen.Gemini.Tests;

[Trait("Category", "UnitV1")]
public class GoogleGeminiClientTests
{
[ApiKeyFact("GOOGLE_GEMINI_API_KEY")]
Expand Down
2 changes: 2 additions & 0 deletions dotnet/test/AutoGen.Gemini.Tests/SampleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

using AutoGen.Gemini.Sample;
using AutoGen.Tests;
using Xunit;

namespace AutoGen.Gemini.Tests;

[Trait("Category", "UnitV1")]
public class SampleTests
{
[ApiKeyFact("GCP_VERTEX_PROJECT_ID")]
Expand Down
2 changes: 2 additions & 0 deletions dotnet/test/AutoGen.Gemini.Tests/VertexGeminiClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
using FluentAssertions;
using Google.Cloud.AIPlatform.V1;
using Google.Protobuf;
using Xunit;
using static Google.Cloud.AIPlatform.V1.Candidate.Types;
namespace AutoGen.Gemini.Tests;

[Trait("Category", "UnitV1")]
public class VertexGeminiClientTests
{
[ApiKeyFact("GCP_VERTEX_PROJECT_ID")]
Expand Down
2 changes: 2 additions & 0 deletions dotnet/test/AutoGen.Mistral.Tests/MistralClientAgentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
using AutoGen.Mistral.Extension;
using AutoGen.Tests;
using FluentAssertions;
using Xunit;
using Xunit.Abstractions;

namespace AutoGen.Mistral.Tests;

[Trait("Category", "UnitV1")]
public partial class MistralClientAgentTests
{
private ITestOutputHelper _output;
Expand Down
2 changes: 2 additions & 0 deletions dotnet/test/AutoGen.Mistral.Tests/MistralClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@
using AutoGen.Mistral.Extension;
using AutoGen.Tests;
using FluentAssertions;
using Xunit;

namespace AutoGen.Mistral.Tests;

[Trait("Category", "UnitV1")]
public partial class MistralClientTests
{
[Function]
Expand Down
2 changes: 2 additions & 0 deletions dotnet/test/AutoGen.Ollama.Tests/OllamaAgentTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
using AutoGen.Ollama.Extension;
using AutoGen.Tests;
using FluentAssertions;
using Xunit;

namespace AutoGen.Ollama.Tests;

[Trait("Category", "UnitV1")]
public class OllamaAgentTests
{
[ApiKeyFact("OLLAMA_HOST", "OLLAMA_MODEL_NAME")]
Expand Down
1 change: 1 addition & 0 deletions dotnet/test/AutoGen.Ollama.Tests/OllamaMessageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
using Xunit;
namespace AutoGen.Ollama.Tests;

[Trait("Category", "UnitV1")]
public class OllamaMessageTests
{
[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@

using AutoGen.Tests;
using FluentAssertions;
using Xunit;

namespace AutoGen.Ollama.Tests;

[Trait("Category", "UnitV1")]
public class OllamaTextEmbeddingServiceTests
{
[ApiKeyFact("OLLAMA_HOST", "OLLAMA_EMBEDDING_MODEL_NAME")]
Expand Down
2 changes: 2 additions & 0 deletions dotnet/test/AutoGen.OpenAI.Tests/MathClassTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
using Azure.AI.OpenAI;
using FluentAssertions;
using OpenAI;
using Xunit;
using Xunit.Abstractions;

namespace AutoGen.OpenAI.Tests;

[Trait("Category", "UnitV1")]
public partial class MathClassTest
{
private readonly ITestOutputHelper _output;
Expand Down
2 changes: 2 additions & 0 deletions dotnet/test/AutoGen.OpenAI.Tests/OpenAIChatAgentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@
using FluentAssertions;
using OpenAI;
using OpenAI.Chat;
using Xunit;

namespace AutoGen.OpenAI.Tests;

[Trait("Category", "UnitV1")]
public partial class OpenAIChatAgentTest
{
/// <summary>
Expand Down
1 change: 1 addition & 0 deletions dotnet/test/AutoGen.OpenAI.Tests/OpenAIMessageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace AutoGen.OpenAI.Tests;

[Trait("Category", "UnitV1")]
public class OpenAIMessageTests
{
private readonly JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions
Expand Down
2 changes: 2 additions & 0 deletions dotnet/test/AutoGen.OpenAI.Tests/OpenAISampleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
using System.Threading.Tasks;
using AutoGen.OpenAI.Sample;
using AutoGen.Tests;
using Xunit;
using Xunit.Abstractions;

namespace AutoGen.OpenAI.Tests;

[Trait("Category", "UnitV1")]
public class OpenAISampleTest
{
private readonly ITestOutputHelper _output;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

namespace AutoGen.OpenAI.Tests;

[Trait("Category", "UnitV1")]
public class RolePlayToolCallOrchestratorTests
{
[Fact]
Expand Down
2 changes: 2 additions & 0 deletions dotnet/test/AutoGen.OpenAI.V1.Tests/GPTAgentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
using AutoGen.Tests;
using Azure.AI.OpenAI;
using FluentAssertions;
using Xunit;
using Xunit.Abstractions;

namespace AutoGen.OpenAI.V1.Tests;

[Trait("Category", "UnitV1")]
public partial class GPTAgentTest
{
private ITestOutputHelper _output;
Expand Down
2 changes: 2 additions & 0 deletions dotnet/test/AutoGen.OpenAI.V1.Tests/MathClassTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
using AutoGen.Tests;
using Azure.AI.OpenAI;
using FluentAssertions;
using Xunit;
using Xunit.Abstractions;

namespace AutoGen.OpenAI.V1.Tests;

[Trait("Category", "UnitV1")]
public partial class MathClassTest
{
private readonly ITestOutputHelper _output;
Expand Down
2 changes: 2 additions & 0 deletions dotnet/test/AutoGen.OpenAI.V1.Tests/OpenAIChatAgentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
using AutoGen.Tests;
using Azure.AI.OpenAI;
using FluentAssertions;
using Xunit;

namespace AutoGen.OpenAI.V1.Tests;

[Trait("Category", "UnitV1")]
public partial class OpenAIChatAgentTest
{
/// <summary>
Expand Down
1 change: 1 addition & 0 deletions dotnet/test/AutoGen.OpenAI.V1.Tests/OpenAIMessageTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

namespace AutoGen.OpenAI.V1.Tests;

[Trait("Category", "UnitV1")]
public class OpenAIMessageTests
{
private readonly JsonSerializerOptions jsonSerializerOptions = new JsonSerializerOptions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

namespace AutoGen.SemanticKernel.Tests;

[Trait("Category", "UnitV1")]
public class TestPlugin
{
public bool IsOn { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
using Azure.AI.OpenAI;
using FluentAssertions;
using Microsoft.SemanticKernel;
using Xunit;

namespace AutoGen.SemanticKernel.Tests;

[Trait("Category", "UnitV1")]
public class KernelFunctionMiddlewareTests
{
[ApiKeyFact("AZURE_OPENAI_API_KEY", "AZURE_OPENAI_ENDPOINT", "AZURE_OPENAI_DEPLOY_NAME")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@
using Microsoft.SemanticKernel.Agents;
using Microsoft.SemanticKernel.ChatCompletion;
using Microsoft.SemanticKernel.Connectors.OpenAI;
using Xunit;

namespace AutoGen.SemanticKernel.Tests;

[Trait("Category", "UnitV1")]
public partial class SemanticKernelAgentTest
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

namespace AutoGen.SourceGenerator.Tests;

[Trait("Category", "UnitV1")]
public class FunctionCallTemplateEncodingTests
{
[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

namespace AutoGen.SourceGenerator.Tests;

[Trait("Category", "UnitV1")]
public class FunctionCallTemplateTests
{
[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

namespace AutoGen.SourceGenerator.Tests;

[Trait("Category", "UnitV1")]
public class FunctionExample
{
private readonly FunctionExamples functionExamples = new FunctionExamples();
Expand Down
2 changes: 2 additions & 0 deletions dotnet/test/AutoGen.Tests/BasicSampleTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
using System.IO;
using System.Threading.Tasks;
using AutoGen.Basic.Sample;
using Xunit;
using Xunit.Abstractions;

namespace AutoGen.Tests;

[Trait("Category", "UnitV1")]
public class BasicSampleTest
{
private readonly ITestOutputHelper _output;
Expand Down
2 changes: 2 additions & 0 deletions dotnet/test/AutoGen.Tests/Function/FunctionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
using Xunit;

namespace AutoGen.Tests.Function;

[Trait("Category", "UnitV1")]
public class FunctionTests
{
private readonly JsonSerializerOptions _jsonSerializerOptions = new() { WriteIndented = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull };
Expand Down
1 change: 1 addition & 0 deletions dotnet/test/AutoGen.Tests/GroupChat/GraphTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

namespace AutoGen.Tests;

[Trait("Category", "UnitV1")]
public class GraphTests
{
[Fact]
Expand Down
Loading
Loading