You can edit almost every page by Creating an account and confirming your email.

Deterministic simulation testing: Difference between revisions

From EverybodyWiki Bios & Wiki
WikiMasterBot2 (talk | contribs)
Moved page from wikipedia:en:Deterministic simulation testing ([[Edithistory:|history]])
 
WikiMasterBot2 (talk | contribs)
m automatic correction by IA
Line 10: Line 10:
</syntaxhighlight>
</syntaxhighlight>


On the [[.NET]] platform a instance of the {{Mono|Random}} class can be seeded by providing a seed to the constructor.<ref>{{cite web |title=Random Class (System) |url=https://learn.microsoft.com/en-us/dotnet/api/system.random?view=net-9.0 |website=learn.microsoft.com |access-date=3 December 2024 |language=en-us}}</ref>
On the [[.NET]] platform an instance of the {{Mono|Random}} class can be seeded by providing a seed to the constructor.<ref>{{cite web |title=Random Class (System) |url=https://learn.microsoft.com/en-us/dotnet/api/system.random?view=net-9.0 |website=learn.microsoft.com |access-date=3 December 2024 |language=en-us}}</ref>
<syntaxhighlight lang="csharp">
<syntaxhighlight lang="csharp">
var random = new Random(42);
var random = new Random(42);
</syntaxhighlight>
</syntaxhighlight>


On the [[.NET]] platform the {{Mono|FakeTimeProvider}}<ref>{{cite web |title=FakeTimeProvider Class (Microsoft.Extensions.Time.Testing) |url=https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.time.testing.faketimeprovider?view=net-9.0-pp&viewFallbackFrom=net-9.0 |website=learn.microsoft.com |access-date=3 December 2024 |language=en-us}}</ref> class can be used which derives from the {{Mono|TimeProvider}} abstract class.<ref>{{cite web |title=TimeProvider Class (System) |url=https://learn.microsoft.com/en-us/dotnet/api/system.timeprovider?view=net-9.0 |website=learn.microsoft.com |language=en-us}}</ref>
On the [[.NET]] platform the {{Mono|FakeTimeProvider}}<ref>{{cite web |title=FakeTimeProvider Class (Microsoft.Extensions.Time.Testing) |url=https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.time.testing.faketimeprovider?view=net-9.0-pp&viewFallbackFrom=net-9.0 |website=learn.microsoft.com |access-date=3 December 2024 |language=en-us}}</ref> class can be used, which derives from the {{Mono|TimeProvider}} abstract class.<ref>{{cite web |title=TimeProvider Class (System) |url=https://learn.microsoft.com/en-us/dotnet/api/system.timeprovider?view=net-9.0 |website=learn.microsoft.com |language=en-us}}</ref>


<syntaxhighlight lang="csharp">
<syntaxhighlight lang="csharp">

Revision as of 03:56, 22 March 2026

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 an 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

  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.

External links

Template:Software testing


This article "Deterministic simulation testing" is from Wikipedia. The list of its authors can be seen in its historical and/or the page Edithistory:Deterministic simulation testing. Articles copied from Draft Namespace on Wikipedia could be seen on the Draft Namespace of Wikipedia and not main one.