Wednesday, 8 March 2017

Here we
are, Day 6 and pretty much a continuation of yesterday. I suppose I should say
refinement or refactoring. Compared to the approach taken in yesterday’s
session I scaled this right back to something simpler. Why? Here comes today’s
(and yesterday’s) real learning.

I was
breaking the golden rule of taking it one step at a time. Instead I was trying
to work out what the overall solution looked like then code it up. That was doomed
to failure so I went back to baby steps and simplified things.

First off, recall the (cut down) testing problem from yesterday:

You have a website with 2 navigation links. The expectation is more
links will be added in the future. The test must check the known set of text
links are present and if any new ones have been added.

That’s the
first part so let’s work out some code for that.

Here’s the
list of expected links:

publicenumlinks

{

News,

Sport

}

We need to
a) locate the links section and b) count how many links there are on the page: