Test Automation Essentials is a set of tools that are handy for any test automation project. It contains all the code that I want to take with me from one project to another. I hope you'll find it useful for your projects too :-)
This project is composed from 4 assemblies:
TestAutomationEssentials.Common - this assembly contains useful utilities and extension methods that are not related directly to test automation. In fact, you can find many of these utilities useful for non test project too! This assembly includes:
TryGet
(which provides functionality similiar to the Null-Conditional Operator) in C# 6, without C# 6!) and IsEmpty
extension method of IEnumerable
TimeSpan.FromMinutes(3)
you can now write 3.Minutes()
System.IO.Path
class. For example: IsInFolder(@"C:\Root\Child\GrandChild", @"C:\Root")
Wait
(static) class provides useful methods for polling until or while a condition is satisfied. For example: Wait.Until(() => PageIsLoaded(), 30.Seconds(), "Page wasn't loaded!");
TestAutomationEssentials.MSTest - this assembly contains useful classes and method to work with MS-Test based tests. This assembly includes:
TestBase
class which provides an improved cleanup mechanism for better test isolation. See this blog post for more details about the concept.TestUtils.ExpectException<T>(Action)
: a better (IMHO) way to assert for exceptions than the [ExpectedException]
attribute.TestAutomationEssentials.CodedUI - this assembly provides useful extension methods, specifically for Coded UI, that allows you to work without UIMaps but in an easy to read (and write) way. In fact, the API it provides is pretty similiar to Selenium's. For example, you can write: var customerNameTextBox = mainWindow.Find<WinPanel>(By.Id("CustomerDetails")).Find<WinText>(By.Name("CustomerName"));
In addition, it provides few other extension methods that improves the readability of the code. For example: myControl.RightClick();
, myControl.DragTo(otherControl);
and the very useful method myControl.IsVisible()
!
TestAutomationEssentials.Selenium - this assembly wrapps some of Selenium's native API, and provides the following benefits:
StaleElementException
s and the combersome need for SwitchTo()
.There are few ways that you can take advantage of this project:
Download any of the 3 project from NuGet!
Clone the GitHub repository to your machine, and compile (or add it to your solution)
Just copy and paste specific methods that you find useful...
The source code itself contains very detailed XML comments with remarks and some examples. I also strongly encourage you to look at the unit tests project as this is a very good source of documentation also!