Jump to content

Deterministic simulation testing

From Wikipedia, the free encyclopedia

Deterministic simulation testing (DST) is a type of software testing for testing distributed systems.

It is used to test the FoundationDB and Turso databases.

A global seed for randomness is used.

In Python the random number generator can be seeded using the seed function in the random module.[1]

random.seed(42)

On the .NET platform a instance of the Random class can be seeded by providing a seed to the constructor.[2]

var random = new Random(42);

On the .NET platform the FakeTimeProvider[3] class can be used which derives from the TimeProvider abstract class.[4]

var datetime = new DateTime(1969, 07, 20);
var time = new FakeTimeProvider(datetime);

internal class Foo(TimeProvider timeProvider)
{
    // ...
}

In other programming languages a mock object can be used.

References

[edit]
  1. ^ "random — Generate pseudo-random numbers". Python documentation. Retrieved 3 December 2024.
  2. ^ "Random Class (System)". learn.microsoft.com. Retrieved 3 December 2024.
  3. ^ "FakeTimeProvider Class (Microsoft.Extensions.Time.Testing)". learn.microsoft.com. Retrieved 3 December 2024.
  4. ^ "TimeProvider Class (System)". learn.microsoft.com.
[edit]