Skip to content

Commit

Permalink
Add tests for new interface methods
Browse files Browse the repository at this point in the history
  • Loading branch information
tustanivsky committed Dec 20, 2024
1 parent 29a6954 commit f976848
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions plugin-dev/Source/Sentry/Private/Tests/SentrySubsystem.spec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "UObject/UObjectGlobals.h"
#include "Misc/AutomationTest.h"
#include "Misc/DateTime.h"
#include "Engine/Engine.h"

#if WITH_AUTOMATION_TESTS
Expand Down Expand Up @@ -80,6 +81,13 @@ void SentrySubsystemSpec::Define()
TestNotNull("Span is non-null", span);
TestFalse("Span is not finished", span->IsFinished());

USentrySpan* childSpan = span->StartChildWithTimestamp(TEXT("Automation child span"), TEXT("Description text"), FDateTime::UtcNow().ToUnixTimestamp());
TestNotNull("Child span is non-null", childSpan);
TestFalse("Child span is not finished", childSpan->IsFinished());

childSpan->FinishWithTimestamp(FDateTime::UtcNow().ToUnixTimestamp());
TestTrue("Child span is finished", childSpan->IsFinished());

span->Finish();
TestTrue("Span is finished", span->IsFinished());

Expand All @@ -99,6 +107,19 @@ void SentrySubsystemSpec::Define()
transaction->Finish();
TestTrue("Transaction is finished", transaction->IsFinished());
});

It("should be started and finished with specific context and timings", [this]()
{
USentryTransactionContext* transactionContext = NewObject<USentryTransactionContext>();
transactionContext->Initialize(TEXT("Automation transaction"), TEXT("Automation operation"));

USentryTransaction* transaction = SentrySubsystem->StartTransactionWithContextAndTimestamp(transactionContext, FDateTime::UtcNow().ToUnixTimestamp());
TestNotNull("Transaction is non-null", transaction);
TestFalse("Transaction is not finished", transaction->IsFinished());

transaction->FinishWithTimestamp(FDateTime::UtcNow().ToUnixTimestamp());
TestTrue("Transaction is finished", transaction->IsFinished());
});
});

Describe("Transaction context", [this]()
Expand Down

0 comments on commit f976848

Please sign in to comment.