In your automation solution (which you can find the previous post for here), Navigate to Tools > NuGet Package Manager > Manage NuGet Packages for Solution
Select the Browse option and search for Selenium
For each package Selenium. WebDriver and Selenium.Support, select the package. Notice that the project where our tests live is the only option available installing this package. Remember, since the framework is a Shared Project, there’s no DLL file created for that project, but the files required for the tests will be automatically included when the test project is built
Select the Test project (UI Tests in the example above) and select the Install Button
You’ll probably need to confirm the install of each package as well
After both the Selenium.WebDriver and Selenium.Support packages are installed, search for and install the NUnit and NUnit .Console packages as well
Once the NUnit packages are installed, you can select the Installed link and see that several NUnitpackagaes were installed. These packages will be the basis for our framework and tests, but we’ll add more as we progress.
The Takeaway: Using shared projects with class libraries is a good way to start your Visual Studio automation project.
Setting Up Your Visual Studio Project
One of the initial things you need to decide when you start an automation project is what the structure of your Visual Studio Solution will be. I have worked with several different scenarios, involving various types of projects:
Default project type
Results in the compilation of a DLL (Dynamic Linked Library) that can be ran by Nunit
Provides code snippets that make getting up and running with NUnit a bit quicker
Unit Test Project:
Similar to the NUint VS Templates project template, the Unit Test project template creates a class file with a basic frame of a unit test already built in (including a using statement for the Microsoft.VisualStudio.TestTools.UnitTesting package and properties for a class and method to mark them as a test class and test method).
I’m sure there are others that are and have been used as well. BUT, one of my favorite project types for testing has become the Shared Project.
What I love about Shared Projects is that any code in that project, referenced by other projects, is automatically added to and complies with the other project. So, you can have multiple types of test projects in your solution (one for UI testing, one for API testing, one for database testing, one for security testing), and one single repository for your framework. When you compile the code for that project, the shared code that applies to that project.
Starting Your Automation Solution
Open up Visual Studio. I will use Visual Studio 2015, but these examples should all work in Visual Studio 2017 just as easily
Navigate to File > New > Project
In the New Project window, select the Templates TreeView > Other Project Types
There should be a Blank Solution template available to you. Select that in the Window, give your solution a name (I’m calling mine Automation), ensure that the Create directory for solution checkbox is checked, and click the OK Button:
Now, you should have a blank solution with nothing in itNow, we need to add at least two projects to this solution: one Shared Project, and one
Navigate to File > New > Project
Select the Templates TreeView > Visual C#
Select Shared Project, name it Framework, select Add to solution, make sure you’re in the same location as your blank solution, make sure the Create Directory for solution checkbox is selected, and select the OK Button
Visual Studio Automation Project – Shared Project
Now, you should have a solution with an empty shared project. Time to add the test library:
Navigate to File > New > Project
Select the Templates TreeView > Visual C#
Select Class Library, name it Framework, select Add to solution, make sure you’re in the same location as your blank solution, make sure the Create Directory for solution checkbox is selected, and select the OK Button
So, you should wind up with a solution with two project templates: a Shared Project for your framework, and a Class Library for your tests. This is the base off of which we will build our automation and framework. Using a Shared Project, we can add whatever we need into the framework portion of our solution, then simply use the necessary components when we build and deploy our tests.
The Takeaway: The modern Web is a platform for user connections, and automation can play an important role in ensuring platform integrity.
The advent of Web 2.0 has altered the way users interact with enterprise-level software and the way enterprises incorporate software into their business.
Tim O’Reilly’s definitional article (2005) describes the shift that started around that time and points to a number of factors that have led to the proliferation of Web applications for business use.
The Web as a Platform
The World Wide Web has become its own platform, upon which developers are developing next-generation Web applications and rich Internet applications. The evolution of the Web as a platform allows developers to think about applications as browser-based services, independent of user operating systems. Some even argue that the Internet browser is becoming the next operating system, capable of delivering applications and extending architectural capabilities in much the same way traditional, desktop operating systems have worked for many years (Wayner, 2013; Garaizar, P., Vadillo, M. A., López-de-Ipiña, D., & Matute, H., 2012).
Using the Web as a platform, instead of a specific operating system or specific browser, frees developers from the constraints imposed by utilizing operating systems and browsers, allowing the large amounts of interoperability organizations require from their Web applications. Thinking of the Web as a platform also highlights the network effects possible with Web applications, where the value that the Web application provides the organization using it increases as the number of individuals using the application increases.
What This Means for Automation
Automation plays a valuable role in the Web as a Platform in several ways:
The World Wide Web allows us to start abstracting applications from traditional operating systems, but the implementation of the same browser in various operating systems still means there is a need to test those implementations in order to minimize risk. That’s where Sauce Labs, BrowserStack, and the Selenium Grid come into play.
We, as automation engineers, need to understand that, for the web applications we automate, a core strength is an application’s flexibility and “lack of control”. Once a vendor attempts to control both ends of communication, you lose the primary value of the Web. There are ways to mitigate risk, whether it’s by only supporting particular browsers and not using resources to troubleshoot user issues on other browsers, or by testing your application on multiple browsers/versions/operating systems to make sure your application performs as well as it can on a wide variety of end-user machines. Thankfully, we are also able to mitigate risk with responsive websites that can display information in different ways depending on the browser and the end-user device. Decisions made
Decisions made at the beginning of any software project about browser/device compatibility impact automation effort scope and automation engineers should be in on these conversations from the start.
A key tenant of Web 2.0 is that the service improves as the number of users increase. The WWW’s focus is on connections, clients, hosts, and, most importantly, the information that flows between through these connections and between these end-points. Automation’s ability to precisely execute a set of inputs, and then compare the actual outputs with expected outputs helps ensure that all possible execution paths of an information system meet user expectations.
The Takeaway: Automation adds value to your DevOps/SDLC process and can be a large part of your project’s success in the marketplace.
I feel that management theory is not only necessary for understanding a individual’s place on a team, a team’s place in an organization, and an organization’s place in the market. Not only that, but I like reading and talking management theory.
While I do recommend Michael Porter’s Competitive Strategy and Competitive Advantage to anyone wanting to know how to better understand how businesses compete in the market or how their business affects and is affected by internal and external forces, I also understand these books are a bit hard to read through with understanding.
“…strategically relevant activities [disaggregated] in order to understand the behavior of costs and the existing and potential sources of differentiation.” (Porter, Competitive Advantage, p. 33).
The way you stay in business is by doing things either cheaper and/or better than its competition. Once you separate and examine each individual activity in your collection of activities performed to design, produce, market, deliver, and support the thing you make, you start to gain an understanding of where the resources go. Where do we spend time that we can cut out? Where do we spending money that makes our product better than our competitors’? This is the (basic) idea behind the aglie manifesto, right? Cut out the things that cost time and money unnecessarily
processes and tools
over contract negotiation
following a plan,
and focus on the valuable things
individuals and interactions
responding to change.
Focus resources on the things that matter, and you’re a step ahead of competitors that don’t.
Value Activities + Margin = Value Chain
The total Value Chain is comprised of Value Activities and Margin:
“…physically and technologically distinct activities a firm performs… building blocks by which a firm creates a product valuable to its buyers…” (Porter, Competitive Advantage, p. 38).
There are Primary and Secondary (Support) activities. We’ll focus on support just to keep things simple.
The typical primary value activities do not apply across all industries equally. Manufacturing, for example, relies much more heavily on inbound and outbound logistics than software development, for example. For our purposes, I’ll rely on a classical approach to software value chains provided by Boehm and Papaccio(1987, NTRS), and state that the majority of software development falls under the Operations and Service value activities.
Operations: Transforming inputs into the final product form (requirements into an application)
Service: Providing service to enhance and maintain the product’s value
“…the difference between total value and collective cost of performing the value activities…”(Porter, Competitive Advantage, p. 38).
Margin depends upon the efforts placed in the value chain that add value to a product over and above the costs incurred in the value activities.
What Automation has to Do With The Value Chain
The good news for automation engineers, is that automation can be a crucial part of the value chain. For any task that can be automated effectively, the cost of that activity decreases significantly. For testing, as an example, instead of using three resources for a week to regression test your application, you can do it overnight, and view the results the next morning. Certainly, there are resources required to develop and maintain the regression testing suite, where the value obtained form those efforts starts small, but will increase over time. However, proper planning and execution can help ensure that value is delivered as quick as possible.
Additionally, automation is helpful in the detection, reporting, and verification of defects. A system defect drives down the “worthwhile-ness” of any product. Good automation efforts discover defects before your customers do, and can, if executed correctly, discover them before manual testing efforts.
The important thing is to start thinking of any repeated task as something that can be automated. Not every repeatable task should be automated, so discernment is required in order to ensure that the right things are automated. But, progression of automation efforts has been shown to increase the value of the activities you perform in your software development life cycle.
As we continue this series, we’ll delve further into aspects of automation that help deliver value over its costs, how you can implement automation to achieve these goals, and what to look for in order to be successful with software automation.
For the past few years, I’ve struggled with a desire to publish a “how-to” series
on automation. On one hand, there are already LOTS of resources out there, frankly, written by people much better at development and programming than
However, as I’ve grown as an automation engineer, especially in the past year, I still find it hard to find resources that do a great job of explaining how to expand your automation palette, moving beyond the
basic ideas of UI automation, and including:
Data-Driven Automation and Testing
Keyword-Driven Automation and Testing
API Automation and Testing
Furthermore, finding resources that speak to the implementation of these ideas in a C#/.NET environment is even more difficult.
So, the idea is to show some real-life examples of how to implement an automation solution for testing websites and browser-based applications.
Check out my webiste to get an idea of the tools I use in my own automation.
Some of the ideas I share are ones that I implement in my own work, some may not be. Some may be ones that I figure out while I’m writing these articles and implement because of them.
If you have ANY questions or want to discuss anything, please feel free to comment or e-mail me.