QuellCode/CentronERP war nur als Gitlink (Submodul-Referenz auf 79c1142) getrackt, ohne .gitmodules und ohne erreichbares Remote. Der Untersuchungsgegenstand der Versuchsreihe war damit nicht reproduzierbar gesichert: Ein Klon haette ein leeres Verzeichnis erhalten, und die Belege der 3.287 Anforderungen waeren nicht ueberpruefbar gewesen. Umstellung: - Historie nach c:\DEV\CentronERP_git_snapshot_79c1142 ausgelagert (vollstaendig lesbar, enthaelt 79c1142 und Vorgaenger 89ccfd6) - Gitlink aus dem Index entfernt - Dateiinhalt aufgenommen: 24.557 Dateien, rund 333 MB Die verschachtelte .gitignore der Codebasis gilt weiter, Build-Artefakte bleiben ausgeschlossen. Details in Versuche/Versuch_01/_Codebasis-Nachweis.md
66 lines
1.9 KiB
C#
66 lines
1.9 KiB
C#
using System;
|
|
using System.Diagnostics;
|
|
using Xunit;
|
|
using Xunit.Abstractions;
|
|
|
|
namespace Centron.Tests.EndToEnd.Infrastructure
|
|
{
|
|
public abstract class PerformanceTest : EndToEndTest
|
|
{
|
|
protected PerformanceTest(ITestOutputHelper testOutputHelper)
|
|
: base(testOutputHelper)
|
|
{
|
|
}
|
|
|
|
public override void Execute()
|
|
{
|
|
this.Prepare();
|
|
|
|
var watch = Stopwatch.StartNew();
|
|
this.Measure();
|
|
watch.Stop();
|
|
|
|
this.AssertResults();
|
|
|
|
bool FinishedInTime(double factor)
|
|
{
|
|
return this.AllowedDuration == null ||
|
|
watch.Elapsed.TotalSeconds <= this.AllowedDuration.Value.TotalSeconds * factor;
|
|
}
|
|
|
|
bool finishedPerfect = FinishedInTime(factor: 1.0);
|
|
bool finishedGood = FinishedInTime(factor: 1.1);
|
|
bool finishedBad = FinishedInTime(factor: 1.5);
|
|
|
|
var status = finishedPerfect
|
|
? "PERFECT"
|
|
: finishedGood
|
|
? "GOOD"
|
|
: finishedBad
|
|
? "BAD"
|
|
: string.Empty;
|
|
|
|
if (string.IsNullOrWhiteSpace(status))
|
|
{
|
|
this.TestOutputHelper.WriteLine($"{this.GetType().Name} did not finish in time. Max duration is {this.AllowedDuration?.ToString() ?? "(infinite)"}, but it took {watch.Elapsed}");
|
|
}
|
|
else
|
|
{
|
|
this.TestOutputHelper.WriteLine($"{this.GetType().Name} did finish {status} in {watch.Elapsed}");
|
|
}
|
|
}
|
|
|
|
|
|
protected virtual TimeSpan? AllowedDuration { get; }
|
|
|
|
protected virtual void Prepare()
|
|
{
|
|
}
|
|
|
|
protected abstract void Measure();
|
|
|
|
protected virtual void AssertResults()
|
|
{
|
|
}
|
|
}
|
|
} |