The Wizards Wiki

Explore your world

User Tools

Site Tools


documentation:autoasserttesting

Auto Assert Testing

Write asserts in code, but write only what to assert, not the value. Then add a mode to the engine in which is displays the values of the asserts, and that you can by hand verify them and mark them correct. The results of this are stored and used for automated testing. Maybe even support mocking for this autoassert!!! See PlayersTest.TestSimplePlayerInputController for an example:

// Autoassert example.
// the autoAssert object is injected as dependency (no static shizzle)
var p = MockRepository.GenerateMock<UserPlayer>();
p.Position = Vector3.Zero;

var c = new SimplePlayerInputController(p);
c.MoveForward();
c.ProcessMovement(1); // moves forward

// autoAssert.Equal(p.Position)

c.MoveForward();
c.MoveLeft();
c.ProcessMovement(1);
// autoAssert.Equal(p.Position)

c.MoveForward();
c.MoveLeft();
c.MoveRight();
c.MoveBackward();
c.Jump();
// autoAssert.Equal(p.Position)
documentation/autoasserttesting.txt · Last modified: 2024/08/26 13:25 by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki