Learning xUnit .NET Unit Testing the Easy Way

If you’re getting started with .NET or you’ve done some testing but want to know how to put it all together and also learn some additional tools then the new xUnit.net testing path from Pluralsight may be of interest (you can also get started viewing for free with a trial).

The path currently has the following individual courses (including some of my courses) taking you right from the basics of xUnit.net to more advanced techniques:

  • Testing .NET Code with xUnit.net: Getting Started
  • Mocking in .NET Core Unit Tests with Moq: Getting Started
  • Creating Maintainable Contexts for Automated Testing
  • Writing Testable Code
  • Building a Pragmatic Unit Test Suite
  • Improving Unit Tests with Fluent Assertions
  • Better .NET Unit Tests with AutoFixture: Get Started
  • Approval Tests for .NET

If you’re already skilled with xUnit.net you may find some of the other courses in the path useful.

You can start watching with a Pluralsight free trial.

SHARE:

Watch My Pluralsight Courses For Free This Weekend

If you don’t have a Pluralsight subscription and you want to watch my courses you can this weekend for FREE!

Click the ad below to get started and then once you've signed up for your free weekend, head over to MY LIST OF COURSES to get started!

SHARE:

Learning .NET Unit Testing the Easy Way

Knowing what you need to know is hard. Sometimes harder than the learning itself.

Many years ago I was getting started with .NET v1 and .NET unit testing, Agile had recently been “invented” and I had a printout of the agile manifesto on the office wall. I was also learning Test Driven Development (TDD), mocking, unit testing frameworks, assertions, data driven testing.

I remember it being a little overwhelming at times, so much to learn with fragments of information scattered around but no clearly defined path to follow to get where I knew I wanted to be: proficient and efficient in writing high quality, tested and testable code.

Today things are a little easier but there can still be the: “I don’t know what I need to know”.

This is where skills paths from Pluralsight can be super helpful. I wish I had had them all those years ago.

A path is a curated collection of courses in a specific order to get you to where you need to be for a specific learning goal.

I’m super proud to have contributed to the C# Unit Testing with NUnit Pluralsight path which at the time of writing you can start to watch for free with a Pluralsight free trial.

While it’s certainly possible that you could find the information and learn the topics yourself, you would also waste so much time in getting the information from disparate sources and trying to “meta learn” what it is you don’t know. Ultimately it depends on how much free time you have and how efficient you want to be at learning. You should always keep the end goal in mind and weigh up the costs/benefits/risks of the different ways of getting to that goal. If you want to learn to “how to write clean, testable code, all the way from writing your first test to mocking out dependencies to developing a pragmatic suite of unit tests for your application” then the C# Unit Testing with NUnit path may be your most efficient approach to get to your goal.

SHARE:

Three Wins Technique Review - a Simple Productivity Hack to Deliver What Matters

I started using the Three Wins Technique about five years ago. It has proven to be a simple technique to help me focus on, and deliver, what is important.

The Three Wins Technique is very simple to implement, you can do it on paper, sticky notes, OneNote, Evernote or any other tool for that matter. You can read more about it in this 2014 article. I first learned about the concept from Getting Results the Agile Way, and while I don’t use that whole system, I’ve found that using the idea of three wins is beneficial as a standalone technique.

A Quick Overview of the Three Wins Technique

Essentially you define (and actually write down) what three things you want to get done. Sounds simple but it can be incredibly powerful when done properly. The wins should not just be simply tasks to be ticked off, they should be “wins” – things that make you feel a sense of accomplishment and progress when you complete them.

How I Use the Three Wins Technique

Wins can be defined for whatever timeframe you want (weekly, monthly, etc.). I define wins at four levels:

  1. What are the 3 wins for this year (I define these in January each year).
  2. What are the 3 wins for this month (defined at the start of each month).
  3. What are the 3 wins for this week (defined on Monday morning).
  4. What are the 3 wins for today.

When defining the daily wins I glance at this week’s wins. When I’m, writing down this week’s 3 wins I glance at this month’s wins. When I’m writing down this month’s wins I glance at this year’s 3 wins.

This method means that the overarching wins for the year are always kept in mind when defining more granular wins. The more granular wins (daily, weekly) should usually contribute to progress on the year’s wins. This isn’t always the case though as other things still need to be done that don’t directly contribute to a yearly win.

If you find that your more granular wins are almost never contributing to the yearly wins then you either have a problem with your focus or incorrect or unrealistic yearly wins. - Tweet This

I use OneNote for most of my note taking/planning/etc. Below is a screenshot mock-up of what my 3 wins page looks like, I create a new page at the start of each year so I can look back at all the wins from the previous years.

Using OneNote to plan and track your 3 win

Notice in the preceding screenshot, one of the Jan wins is marked with a “!” – I use this when I fail to achieve a win, this helps me to notice failure patterns.

You could have separate 3 wins pages for work life, personal life, fitness/health, etc. or combine categories – whatever works best for you. I tend to use the technique for work-related things, but given the success I’ve had with it I should probably start using it in other areas of my life. I may also start to create 3 wins for the decade to provide some long term perspective.

If you give this technique a try and find it useful, please share this page with your fellow developers, friends, and colleagues.

SHARE:

Making 2019 Your Best Year Yet

Whilst I’m not personally a fan of New Year’s Resolutions, preferring instead to adopt a mindset of continuous improvement, the end of a calendar year is as good a time as any to do a 12 month retrospective and think about the future.

Below are a number of resources you may find helpful to make 2019 your best year yet, along with some of the things I’m currently learning/implementing in my quest for personal development.

2018 Book List

These are some of the books I read in 2018 that I found helpful and that have influenced my thinking and personal growth:

  • Discipline Equals Freedom: Field Manual (Jocko Willink). Learn to understand that discipline in the present gives you more freedom in the future.
  • The Inner Game of Tennis (W. Timothy Gallwey). More about physical development/performance but the ideas transcend into anything you want to learn.
  • Man's Search for Meaning (Viktor E. Frankl). Harrowing account of Nazi concentration camps infused with what it means to have real meaning in your life.
  • Principles: Life and Work (Ray Dalio). Ray Dalio is the founder of one of the biggest and highest performing hedge funds in the world, this book shows the life and work principles the author has developed and also introduces the fascinating idea that you can run your life based on a set of your own written down principles.
  • Extreme Ownership: How U.S. Navy SEALs Lead and Win (Jocko Willink  & Leif Babin). This should be required reading for anyone managing/leading other people, and for anyone wanting to feel like they are more in control of their life by not making excuses.

Personal Growth Podcasts

My 4 go-to podcasts (in no particular order) for physical, mental, and career growth:

Don’t Code Tired Articles

The following are articles on this blog:

What I’m Working On Implementing At the Moment

These are things I’m trialling, working on implementing, working on improving, or plan to implement in the near future:

  • Regular daily meditation (I’m currently trying the Mindvalley 6 Phase Meditation Quest)
  • Early to bed, early to rise (somewhere between 4:30 AM and 6AM – not sure yet) Effectively swapping some mindless TV/YouTube/XBox gaming at night for productive time in the morning.
  • Learning to deadlift and working on flexibility to allow my to do this
  • Generally: reducing waste, simplification, balanced minimalism in regards to ownership of things, saving/investing more money, reading more, learning more.

Living Your Best Life

I hope the preceding things prove to be useful, inspirational, or interesting to you.

I wish you all the best for the coming year and hope that your 2019 brings you closer to being able to live your best life.

Best wishes, Jason.

SHARE:

Starting Where You're At

Someone says to you: "you must be doing agile, continuous integration, continuous deployment, automated testing, test driven development, etc. etc. etc. or you're doing it wrong".

For any sufficiently complex application you’re building it's likely that the above things, and more, will be beneficial.

The problem is if you’re not doing any of these things and you feel overwhelmed where do you start?

You start where you're at.

build on each success with subsequent success

I remember watching Ray Mears on TV once and he used the acronym STOP to remember what to do if you get lost or stranded:

  • (S)top
  • (T)hink
  • (O)rient
  • (P)lan

If you feel overwhelmed this may be a useful acronym to help you start where you're at.

Accepting where you are now and starting where you're at can help remove negative feelings and the feeling of being overwhelmed and not being "good enough" at your job.

This of course doesn't mean that you should accept unprofessional practices and not try to improve things, it simply means acknowledging without judgement where you are now and then moving forward to improve things for the future.

You can start with the "big rocks", the more important or foundational things such as making sure you're using adequate source control. Maybe then move to implementing a basic continuous integration build. Maybe then start to add some automated tests, etc. etc.

Do things incrementally and build on each success with subsequent success.

To create the change you desire, you may have to invest in you along the way, develop an understanding that discipline equal freedom, and also ask yourself the question “what would easy be like?”.

SHARE:

Discipline Equals Freedom

One of the books I read this year was Discipline Equals Freedom: Field Manual by Jocko Willink.

The overarching concept in the book is that if you have discipline now, in the present, this will result in greater freedom in the future.

This could be having the discipline to work out/lift weights; in the future this will most likely result in the freedom to move more with less pain/lift heavy things/go trekking/kayaking on holiday, etc.

This could be having the financial discipline to regularly save/invest money rather that spend everything you earn; in the future this will most likely result in having the freedom to (semi)retire early, not have to work in a job you don't like, etc.

I think the reason this book resonated with me personally is that it helped focus the outlook I already had on investing in the future/thinking longer term.

This concept can also be applied to software development. Disciplined software development now, will most probably lead to greater freedom in the future to make changes or add new features.

As an example, having the discipline to create automated tests can help give you the freedom in the future to make changes without having to perform a load of manual testing or worry about what may have broken unknowingly.

Another example: having the discipline to refactor code as you are working on the current feature/bug to keep the code as clean as possible will most probably give you the freedom to change it more easily in the future.

If you are a manager: having the discipline to allocate time for you team to train/learn/get better even when faced with pressure to deliver will most probably result in the freedom to deliver more in the future.

The concept can also be applied to non-coding practices such as having the discipline to hold a stand up meeting every day, engage business/users/stakeholders regularly, etc.

You can also flip this concept on its head and instead ask: in the future, what aspects would I like more freedom in: in one month, in one year, in 10 years? Let the answers to this question guide you when deciding on what it is you need to be more disciplined on today or this week to make manifest those desired freedoms in the future.

SHARE:

Software Development Wheel

An example of a rendered software development wheel showing what areas are in need of attention.

In business/personal coaching there is an idea of a “wheel of life”. The idea is that you evaluate different dimensions of your life and plot them on a wheel. Ideally the wheel should be balanced (and as large) as possible. If the wheel is crooked, you know what areas need to be improved to create a better wheel that turns more easily. When the wheel turns more easily, you get better results.

In a similar vein, the Software Development Wheel allows you to evaluate your overall software development  experience.

The tool below can be used by individual developers, the software development team as a whole, or team leaders/managers.

To generate your own wheel fill out the form below.

Each dimension is rated from 1 (“very little or none”) to 5 (“awesome, doing everything possible”) and descriptions for the dimensions are included below.

Be sure to share this page with your fellow developers, team leaders, and management as it’s a great way to start a conversation about how to improve things.

More than one person looking at code before it is released. For example: pair programming, code reviews mob programming, etc.

Tests than can be (and are) run periodically to check that code is working as expected. For example: unit tests, integrations tests, UI tests, performance tests, security tests, etc.

Code from developers is regularly combined together to check that it all works together. Usually automated with a build system/server such as TeamCity, Jenkins, VSTS, etc.

Codebase and development teams evolve over time. For example: incremental development, shorter feedback loops, self-organizing/cross-functional teams, etc.

Code that is easier to change. For example: readable code, good object oriented practices (SOLID), YAGNI, use of appropriate design patterns, well-named variables/functions/etc.

Management exists primarily to remove things that stop/slow down the team delivering the software. For example: shielding the team from management politics, empowering individuals and teams to make decisions, caring about people, providing training, etc.

The team has the best tools that are available to do their work. For example, powerful hardware, latest versions of IDEs, multiple monitors, etc.

Comfortable work environment. Includes: comfortable ergonomic chairs/desks, standing desks, peace and quiet, air conditioning, plants, cleanliness, etc.

SHARE:

Investing In You

I grew up in humble surroundings, my family was for the most part “working class”, I moved around a bit as a kid, moved schools a few times, and lived in state/council housing. At one point as a child (due to some unfortunate circumstances) we lived for a short time in a “homeless” hostel – a transitional place whilst waiting for state housing to be allocated. In one area that I lived as a child I had a knife pulled on me outside a local shop, I learned then how quickly I could run! Today I live in a nice safe suburb, drive a decent car, and generally don’t have to worry too much about personal safety or not having a roof over my head. This is due to some kindnesses I’ve been shown along the way and also by investing. Investing in myself…

I recently completed reading Tony Robbins  Money Master the Game, it is a good book for those new to investing - with a few chapters being somewhat US-centric. (Other books you may find interesting if you’re just starting out your investing journey include The Little Book of Common Sense Investing and A Random Walk Down Wall Street.) While Money Master the Game contains a lot of information about how to attempt to maximize your financial returns and  ways to diversify your portfolio, in it Tony also talks about  how you can add more value.

One way to improve your financial investments is by by investing in yourself.

One nice idea is that by investing in yourself you can add more value and if you can add more value you can earn more and if you can earn more you can invest more.

I had some help and kindnesses shown to me in my journey and like everyone I’ve also some challenges to deal with along the way. Even though I come from a somewhat humble  background, and as a white heterosexual male I’ve never had to deal with prejudice, I am lucky that I have always loved to learn. I became fascinated by computers and programming from an early age and was lucky enough to borrow one for a time when I was younger. Eventually my interest and enthusiasm meant I was lucky enough to get my own machine.

Over the many years I continued to learn and was eventually privileged enough to be able to attend university to study computing. Even after starting my first job I continued to learn in my own time, in the evenings and at weekends, always interested in learning more.

As I look back now, at the time I was just following my natural curiosity, but looking back what I was really doing was investing in myself.

About 2 and a half years ago I stepped into a gym for the first time in my life. I look back now and smile, my first experience was not pleasant, I didn’t know what exercises to do, I tried bench pressing with an empty bar and wobbled all over the place, while the muscular guy next to be hoisted 50kg dumbbells to the sky. I went home feeling awful and a little stupid. Two days later I went back, and I kept going back. I devoured Arnold Schwarzenegger's Encyclopedia of Modern Bodybuilding and eventually paid for some personal training sessions to learn how to clean and press and bench press properly. Whilst I am not a shredded muscular bodybuilder, I did lose 14kgs over 2 years and add some amount of muscle mass and some strength. This is another example of investing in you, this time the physical you. Oftentimes, as developers we don’t always take the best care of ourselves, but I believe investing in the physical you carries over to the work/business you.

As the adage goes, "if you want better answers, ask better questions". One question I’m asking myself this year is: how can I continue to add more value than anyone else? As a software developer and “techie-minded”, in the past I would have thought of a question like this as being big-headed or management-speaky. But if you want to help others you need to help yourself and if you want to help yourself you need to offer value to others.

If you want better answers, ask better questions

It’s good to take a step back sometimes and ask ourselves some questions, especially as we get laser focused on the test we’re writing or the feature we’re working on or the sprint that we’re in, or the next project that might be coming along.

I’m grateful for the opportunities I’ve been given in life, I’m grateful for the challenges and failures and what I’ve learned from them, and I’m grateful for the gift of my lifelong love of learning.

Whilst somewhat dramatic, there is some truth to the phrase “if you’re not growing you’re dying” and if you want to grow you have to invest in you.

SHARE:

What Would Easy Be Like?

As another (Gregorian) year edges ever closer, it’s a period that offers a natural reflection time on what happened in the past year and the forging, often weakly, of “New Years Resolutions”.

One interesting question to ask for your work (or personal) life is: “what would easy be like?”.

For example, looking back to the past year where was the pain, sadness, frustration, long hours, constant overtime, feelings of falling behind in new technologies, failed deployments, the same bugs re-occurring over and over again, unsupportive management, mean co-workers, feelings of inadequacy, disappointed customers, etc.

you should feel like you’re doing your best work

Take some time. Make a list. Write them all down.

Now imagine what it would feel like if all of the things on the list did not exist in the upcoming year – what would easy be like?

Fixing some of the things may mean radical decisions such as quitting your job and moving employer.

Some things may not be quite as radical: better automated testing to catch bugs earlier.

You probably won’t be able to fix everything on your list. Starting from the point of view that things should be easy, that you should feel like you’re doing your best work, can be a powerful way to frame where you’re currently at and where you want to be by this time next year.

SHARE: