Using symbols to check dynamic values

We can reduce the test code even further. Instead of just checking whether a player can log in, we can use the fact that the login procedure returns a player ID and compare this ID with the stored value. If the cell containing <<symbol is in an input column, as in the first test, the current symbol value is written into the text fixture property. If the cell is in an output column, actual test results are compared to the current symbol value. We can use this to trim part of the code in the CheckLogIn class. Let's change that method to return the actual result of LogIn directly, and then compare it with the player symbol in the table:

Tristan/test/PlayerRegistration.cs


92    public class CheckLogIn : ColumnFixture 
93    {
94      public string Username;
95      public string Password;
96      public int LoggedInAsPlayerId() 
97      {
98        return SetUpTestEnvironment.playerManager.
99          LogIn(Username, Password);
100     }
101   }

The new test page can now check for all player properties more easily (see Figure 5.2, “Registration tests - second attempt”). The technique of using symbols for comparison can make test results harder to read for customers, so use it cautiously.