Category: Pipeline
Specifications?
This is more of a “what I’m thinking” post than something full of good information. I am trying to frame my idea of feature specifications and I need to answer some questions. This seemed like as good a place as any to store my questions, but you are more than welcome to provide answers and opinions. Continue reading
The Phoenix Project – A Novel about IT
We had to do a restore of a production database and it made me remember a book I read that you may enjoy. It’s called The Phoenix Project. It’s not the best written book, a little unbelievable and hokey at times, but I honestly couldn’t put it down (I’m a tech geek). I have never read a book like it.
It’s about DevOps yet, it’s a novel not a tech book. It leans more on the Ops perspective, is a retelling of The Goal, and is rooted in Kanban and Manufacturing Operations. Yet, it’s something I believe anyone working in Enterprise IT can relate to.
The Kindle version is only $10. If you read it let me know what you think as DevOps is something I am passionate about and I’d like to hear your perspective.
http://www.amazon.com/The-Phoenix-Project-Helping-Business/dp/0988262592
http://itrevolution.com/ – Author’s website
Production Updates with a Big Red Button
Imagine if you would, a modified game of Jeopardy hosted by Alex Trebec of course. This game is all about getting changes to production and a smart Dev is in the hot seat.
Dev: Can I have Daily Production Pushes for $200?
Alex: You just deployed a new code change to production, it is causing major issues with performance and you need to roll it back. How do you roll back the troublesome change without having to roll back the entire release? (Jeopardy theme music playing)…
Dev: What is a Feature Toggle.
Alex: Correct.
Dev: Can I have Daily Production Pushes for $500?
Alex: You just started work on a new feature that is no where near ready and you check in your changes to source control. The powers that be want to push to production the branch you’ve checked in the new feature… and they want to do it NOW! How do you push the branch and not expose the unfinished feature changes without having to revert the feature and other work mixed in between your feature changes?
Dev: What is a Feature Flag.
Alex: Correct.
Dev: Can I have Daily Production Pushes for $1,000?
Alex: Daily Double
Alex: Marketing wants to be able to turn a feature on and off for customers depending on their transaction volume. How do you accomplish it?
Dev: What is a Ticket Flag.
Alex: Correct.
Alex: You are our Production Jeopardy Champion?
Automated Testing in Visual Studio
NUnit in Visual Studio 2012/2013
I normally us MSTest as I like the integration with Visual Studio. At work we do a lot of NUnit and it just feels dirty having to run my tests outside of Visual Studio (we don’t have a runner for VS). Well we finally got a VS upgrade and I was able to install the NUnit Test Adapter for Visual Studio 2012 and 2013, http://nunit.org/index.php?p=vsTestAdapter&r=2.6.2.
I just installed it through the Extension Manager with Nuget, easy peasy. Now I can run NUnit tests without having to run the NUnit GUI or command line manually. Tests will appear in the VS Test Explorer so organizing, running and debugging tests is incredibly simplified.
Dev Life
This was a blast from the past from a draft post from January 2013 when unit tests in Visual Studio was becoming easier to deal with. Below we review the current state of automated testing in Visual Studio.
Modern Automated Testing in Visual Studio: A Seamless Experience
As developers, we thrive on tools that simplify our workflows and integrate seamlessly into our development environments. Back in the day, running NUnit tests without a dedicated Visual Studio runner felt clunky and disjointed. Fast forward to today, Visual Studio has matured into an incredibly robust IDE for automated testing, offering rich support for various frameworks like MSTest, NUnit, and xUnit, all within the IDE itself. Let’s explore how modern Visual Studio takes automated testing to the next level.
Integrated Test Adapters
One of the major advancements in Visual Studio since the olden days is the seamless integration of test adapters via the NuGet package manager. For example, installing the NUnit Test Adapter or xUnit.net Test Adapter is as simple as adding the package to your test project. Once installed, tests are automatically discovered by the Visual Studio Test Explorer. No additional configuration is required, and the days of running separate GUIs or command-line tools are long behind us.
Test Explorer: The Nerve Center
The Visual Studio Test Explorer has become the central hub for managing and executing tests. It’s packed with features:
- Test Discovery: Automatically detects and organizes tests from all supported frameworks in your solution.
- Grouping and Filtering: Group tests by project, namespace, or custom traits for easy navigation. Filters allow you to focus on failing tests or specific categories.
- Real-Time Feedback: See pass/fail results instantly, with options to debug failing tests directly from the Test Explorer.
- Continuous Testing: Enable live unit testing (available in Visual Studio Enterprise) to automatically run tests impacted by your code changes in real-time.
Debugging Tests
Debugging unit tests is now as straightforward as debugging application code. Simply set breakpoints in your test or application code and run the test in debug mode from the Test Explorer. Visual Studio’s rich debugging tools, including watch variables, call stacks, and IntelliTrace (in Enterprise), make diagnosing issues a breeze.
Code Coverage and Test Impact Analysis
Understanding how well your tests cover your codebase is critical. Visual Studio provides built-in tools for:
- Code Coverage Analysis: Highlighting which parts of your code are tested and which are not.
- Test Impact Analysis: Identifying which tests are affected by your recent code changes, optimizing the tests you need to run.
Cross-Platform and CI/CD Integration
With .NET Core and .NET 6+, Visual Studio supports cross-platform testing, allowing you to run and debug tests on Windows, macOS, and Linux. Additionally, automated tests integrate seamlessly with CI/CD pipelines using Azure DevOps, GitHub Actions, or other CI platforms. Test results can be published as part of your build and deployment workflows, ensuring quality gates are met.
Choosing the Right Framework
While MSTest remains the native framework for Visual Studio, NUnit and xUnit are popular for their flexibility and extensive ecosystem. All three frameworks are first-class citizens in Visual Studio, making it easy to choose one based on your project’s needs or team preferences.
Getting Started
Here’s a quick guide to setting up automated testing in Visual Studio:
- Install the Framework: Use NuGet Package Manager to add MSTest, NUnit, or xUnit to your test project.
- Install the Adapter: Add the corresponding Test Adapter package for NUnit or xUnit.
- Write Your Tests: Create test classes and methods following the chosen framework’s conventions.
- Run Your Tests: Open Test Explorer and run or debug your tests directly from within Visual Studio.
- Analyze Results: Use Test Explorer’s grouping, filtering, and debugging tools to refine your tests.
Dev Life Today
Automated testing in Visual Studio has come a long way since the early days. Whether you’re building enterprise-grade software or experimenting with side projects, Visual Studio’s modern testing tools streamline the process, reduce context switching, and let you focus on delivering quality code.
Gone are the days of manually running tests in external tools. With Visual Studio, everything you need for automated testing is right at your fingertips, making it an indispensable tool for modern developers. We can also mimic a lot of this functionality in VS Code so .NET developers have options. What are your favorite testing features in Visual Studio or VS Code?