The Takeaway: Using GitHub as your repository for version control makes development of your automation solution MUCH easier!
An important element of your automation project is to make sure you can keep it backed up and available.
A great way to do that is with GitHub. As a version control system and repository, GutHub allows you to keep track of changes in your automation solution, make the code available to others working on the project, and fork your project in order to further develop the project in new directions.
This article will assume that you:
Already understand the basics of version control and repositories. If not, this video and associated YouTube channel can help out there
Already have a GitHub username and password. If not, do that here.
Already have the GitHub Extension installed as part of Visual Studio, If not, here it is.
Open your Automation solution in Visual Studio.
Right-click on the solution for the project and select Add Solution to Source Control
At this point, Visual Studio will create a git folder in the folder where your solution is saved (which is typically hidden). This folder is needed to keep track of changes to your solution
You will also notice that your solution, folders, and files have a blue lock on them
Navigate to the Team Explorer window
Click the Sync link, and the Publish to GitHub option should display
Click the Get Started link. Since the repository you just created doesn’t haver a remote version, we can use this tool to create a version on the GitHub website
Click Publish. Now you should be able to go to your GitHub Profile, click your Repositories link, and view your repo
Click here to find the above page, so you can either clone or download the files for this solution as well!
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.