TNG / ArchUnit

A Java architecture test library, to specify and assert architecture rules in plain Java
http://archunit.org
Apache License 2.0
3.18k stars 288 forks source link

The tests are running too late #1215

Closed EngRajabi closed 9 months ago

EngRajabi commented 9 months ago

Consider the following test. It takes about 3 minutes to run. Can I reduce this time?

    private static readonly Assembly[] AssembliesService = Assemblies
        .Where(r => r.FullName!.Contains("ind", StringComparison.OrdinalIgnoreCase) &&
                    r.FullName.Contains("service", StringComparison.OrdinalIgnoreCase))
        .ToArray();

    private static readonly Architecture Architecture =
        new ArchLoader().LoadAssemblies(AssembliesService).Build();

    private static readonly IObjectProvider<Class> EventClasses =
        Classes().That().AreAssignableTo(typeof(EventMessageBaseHandler<>)).As("EventHandler Classes");

    [Fact]
    public void EventClassesShouldHaveCorrect()
    {
        try
        {
            Classes().That().AreAssignableTo(EventClasses)
                .Should().HaveNameEndingWith("EventProcessor")
                .AndShould().BePublic()
                .AndShould().BeSealed()
                .OrShould().BeAbstract()
                .Check(Architecture);
        }
        catch (TypeDoesNotExistInArchitecture)
        {
            //ignored
        }
    }
rweisleder commented 9 months ago

It looks like this issue belongs into TNG/ArchUnitNET instead of this repo?

EngRajabi commented 9 months ago

It looks like this issue belongs into TNG/ArchUnitNET instead of this repo?

thanks