Creating the walking skeleton - Part 1
Our first end-to-end test that exercises a single path through our solution
The walking skeleton is the smallest feature that we can build, cutting through the frontend, messaging out, and responding to auction events. The first scenario we shall navigate is the simplest, our sniper joins an auction and loses without bidding.
Starting with the walking skeleton like this forces us to consider various available design and technology decisions. As previously stated, our choice of technology for the user interface is Blazor Server. Our end-to-end tests shall be driven from the UI, and this shall be achieved using the Playwright.Net library.
Figure 1 above shows the auction sniper UI as currently envisioned, the focus right now is on what would be needed to complete our initial test. It is important to note at this point that this is not source code written, it is just a graphic representation of the minimal frontend that would allow the first feature to be implemented.
On click of the New Sniper button, a dialog box shall be presented as shown. On this dialog box, the user shall enter the code for an item currently on auction, set the maximum bid price, and click the Snipe button to join the auction.
To join the auction, we need a way to communicate with the auction server - which is a third party component. One of the key lessons in the book is that we only mock types that we own, therefore in this case we shall not create a mock auction server. Instead, we shall define an interface to represent the behaviors we expect from the auction server, and make use of a fake implementation of the interface. For a differentiation between a fake, a mock, and a stub see here. Our interface shall contain the behaviors defined in the code as shown below.
In addition to the fake implementation of the auction server, we shall also need to setup a WebApplicationFactory
to be used to run our Blazor application. Information regarding the web application factory can be found here, and here.
In the next article, we shall write our first end-to-end test and make it pass.