Skip to main content

ASOS Testing Community - Coding Challenges #1

Here @ASOS we're trying to build a community for testing, and dare I say it, but it is slowly happening, over the past couple of months we've been getting real traction with regards to a community feel, attendance at our meetups but not just attendance but people voicing opinions and being passionate and wanting to improve themselves. 

Anyway, at the last meeting it was suggested that we do some coding challenges, some quick challenges that anyone can pick up and do, I understand that not everyone understands or knows how to write code, but by adopting a pairing approach it was hoped that everyone would get something from it.

Anyway, a colleague sent me this website: https://projecteuler.net/archives it has a long list of coding challenges that people have completed and whatnot, so I took about the task of finding a suitable coding challenge for the meeting. It was important to choose something that wasn't going to:

a) take too long to complete
b) be too hard to complete

Luckily, this didn't take too long and I found a suitable problem:
Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.
I thought this was challenging enough, but wouldn't take too long to complete, and if people finished it early, then it would be good/useful to write some unit tests for it...

I sent an email round before the meeting so that people could read up about it and have a think about a solution beforehand, and then hopefully come the meeting there'd be lots of discussions in the pair about how to approach the solution.

We had 4 groups of 2 turn up, and as luck would have it, the pairings worked our reasonably well with stronger coders in each of the groups. We'd even had people who had worked on the solution itself before the meeting, and whilst that wasn't really the point of the meeting, it showed 2 things:


  1. They were eager and willing to learn
  2. They came prepared and with ideas to share with their partner
So it's really difficult to complain about something like that! 



We had varying levels of success, although all but one completed the task at hand (and even they finished it after the meeting), we had many different approaches tried by the pairs, some of them used a list and then used LINQ to extract what was needed, some people just wrote one method that would do what was needed and some people even adopted a TDD approach and went about writing tests first that would then fail.

It also ties in with some other things I want to try and implement, and they're inspired from a recent conference I attended (Unicom - Next Generation Testing Conference) and a talk by Raji Bhamidipati where she discussed the benefits of Paired Testing, we've done things around Pairing before, and how it's not just for developers, so I'll definitely be trialing this out in future as well.



It's definitely something we will do again, perhaps even create a seperate session for completing coding challenges I guess it's about finding the right mix of technical challenges and discussions etc. It's definitely going to be an exciting few months in the Testing Community here! :)






Comments

  1. a friend of mine once asked me to give him instructions on coding now i can post your kind work check here for everyone to benefit from it.

    ReplyDelete

Post a Comment

Popular posts from this blog

Treating Test Code as Production Code

It's important when writing automated tests to remember that the code you write should be up to production standards, meaning any conventions that you have in place should be adhered to and that it should follow good design patterns. Too many people often say why does it have to be as good as production code, it's "Only" a test, so long as it passes then that's fine... To answer this we need to look at why we want our tests to be written in such a structured and efficient manner: - Maintainability - by making the test code structured and efficient, it becomes far easier to maintain and in doing so changes in the future can happen quickly as the test isn't linked to anything that it shouldn't be and it's easy to understand for a new set of eyes. - Durability - Again by making the tests structured they should be resistant to changes, if you change a variable name for instance then it shouldn't effect the unit test unless it absolutely has to....

Testers: Be more like a Super-Villain!

Who doesn't love a Super Hero? Talk to my son, and he'll tell you how much he loves them, talk to many adults and they'll say the same! Deep down, we all love to be the Super Hero, we all want to save the day! However, I want to talk about the flip side of Super Heroes, the Super Villains... I often play Imaginext with my son, and I (unfortunately?) am nearly always the Super Villain! Be it Lex Luthor, Joker, Two Face, Mr Freeze or The Riddler! These are all great characters and great Super Villains, but why would I want to write about Super Villains? A while ago where I worked, we had a few Super Heroes, people who would be able to come in and "fix" things that had broken and help deliver projects on time. We then shifted, we decided to do away with the Super Hero culture and try and prevent from being in that position in the first place, whilst we didn't go as far as wanting to hire Super Villains, it's definitely a story that has stuck with me and t...

Using BDD and gherkinising your Acceptance Tests

In my post Testing of Automated tests , I mention about a BDD framework which involves using BDD to drive your acceptance tests. BDD stands for Behaviour Driven Development.  One effective method of writing BDD tests are by using a format known as Gherkin language. These consist of Given, When, Thens. The main advantage of the gherkin language is that it's readable by the business, and in an ideal world forms part of the Conditions of Acceptance around a PBI. Also, using a Visual Studio plugin of SpecFlow , you can integrate your Gherkinised COAs into your solution with feature files, and then drive the automated tests, however, for this post I will focus solely on how to effectively gherkinise your acceptance tests. A Feature file consists of a feature outline, which details what the feature file is testing followed by Scenarios and examples (parameters).  The BDD scenarios are made up of a Given, When, Then... These are effectively an initial state (Given), an action (W...