Test-Driven Development (TDD) is a discipline that helps to create error-free, quality code, and drives productivity by reducing and eliminating errors as well as providing many other benefits.
This entry-level training course is designed to bring you quickly up to speed with the basic features and processes involved in performing C# based test-driven development using xUnit. It covers the key principles and practices of test-driven development, which you can then utilize within your own software engineering projects.
In this course, you'll be guided through an end-to-end sample project in which we use test-driven development to build, test, and package a .NET Core 3.1 C# based library that will provide an API to convert Bitcoins into foreign currency.
If you have any feedback relating to this course, please contact us at support@cloudacademy.com.
Learning Objectives
- Understand the fundamentals of TDD and xUnit
- Use TDD to build, test, and package a .NET Core 3.1 C# based library
- Perform TDD by performing Red-Green-Refactor iterations
- Learn how to use TDD to build, test, and package a .NET Core 3.1 C# based library
- Learn how to create unit tests using the xUnit testing framework
Intended Audience
- Software developers interested in using TDD to build .NET Core applications using C#
Prerequisites
To get the most out of this course, you should have a basic understanding of .NET Core and the C# programming language, as well as software development and the software development life cycle (SDLC).
Resources
Welcome back. In the previous demonstration, I showed you how to use GitHub actions to set up a workflow that automatically built, tested, and stored the resulting artifact for our Bitcoin converter library. In this demonstration, I'm going to expand on that a little bit more. And what I'm going to do is, I'm going to demonstrate how to produce an actual GitHub release. So, this part here. So that when we update any of our code and then when we check it in and push it up into this repository. If all of the unit tests are successful and we're able to produce a binary, then we automatically also produce a release.
Okay, let's get started. So I'll jump back into our workflow. And this time I'm going to add the snippet of code, "Make Release". That leverages this custom action. And what it does, is it searches for or checks the current push to see whether it's a tag being pushed up. The point here is that we need to actually tag our push for this to generate a release.
So this will become clearer when I actually perform it. So I'll save this. And again, I'll just simply do a commit and push in one hit. So that's pushed our updated GitHub action workflow back into our repository. Now that alone won't trigger what we want to be triggered because we need to do a tag. So, I'll add a tag. And then finally I'll push these tags.
Okay. That looks good. We'll jump back over into our repository now. And I'll jump onto actions. And here we can see a action is in place. It's operating on this tag. I'll navigate into it, into the actual build. And what we're interested in this time is to see whether the Make Release actually runs and generates an automated release for us. Jumping back out into the repo.
We can see that our release has indeed been automatically generated. This is very cool. Navigating into it. Here we can see we've got three assets for our release v1.0.0. This was all automated and performed by a GitHub action based on us tagging our source code and pushing that tag up into the GitHub repo. This is very cool.
Okay, go ahead and close this demonstration and I'll see you shortly in the next one.
Jeremy is a Content Lead Architect and DevOps SME here at Cloud Academy where he specializes in developing DevOps technical training documentation.
He has a strong background in software engineering, and has been coding with various languages, frameworks, and systems for the past 25+ years. In recent times, Jeremy has been focused on DevOps, Cloud (AWS, Azure, GCP), Security, Kubernetes, and Machine Learning.
Jeremy holds professional certifications for AWS, Azure, GCP, Terraform, Kubernetes (CKA, CKAD, CKS).