The purpose of this video is to get you from zero to a first install and a successful test run. So let’s get started!
Hi everybody! I’m Jason, from Continuus Technologies, and I’m going to show you how to install deltaTest.
Just to set the stage: deltaTest is an open-source, universal, PowerShell-based unit testing platform that is suitable for use in just about any Data Management context. deltaTest is in fact the only test platform that could make that last claim, and it enables full-fledged Test Driven Development and automated regression testing, even on Data Management platforms like Markit EDM that are intrinsically hard to test. That’s a game changer for Data Management teams!
Anyway the purpose of this video is to get you from zero to a first install and a successful test run. So let’s get started.
First we need to set the stage. As a developer, I usually have local administrator permissions on my machine. That makes a lot of this easy. If you can’t get that level of local permissions, then you still need to accomplish the same steps you’ll see here, but you might have to jump through some extra hoops. Your local SysAdmin should be able to help you out.
The deltaTest code repository resides at GitHub, and the first step in the installation process is easy: clone the repo to a network drive shared by your development team. But in order to do THAT, you’ll need to have Git installed on your local machine! And the easiest way to do that is to head over to gitforwindows.org and hit the download button. I’ll put the link in the notes, and for now let’s just assume you have Git installed.
So deltaTest is best used in a shared context. That means a couple of things. One, it means that, when you run a test, the test calls code that lives in a location shared by the entire team. So upgrades are easy: you only have to do them in one place. This shared location also hosts settings that are specific to your project–say, network data file drop locations–but also might differ across environments, from DEV to TEST to UAT and so on.
The way we set that up is to clone the deltaTest GitHub repo to the project’s network share.
Here’s the top level of our demo project’s network share. I’m just going to clone the repo right here. To do that, I’ll go to the repo and copy the web URL. Then I’ll right-click on my file share and open up a Git BASH prompt. From here, cloning is easy: just type “git clone” and paste in your repo URL.
There it is, and you can see the new directory here. So let’s close our BASH window and then go take a look.
Now remember, deltaTest is PowerShell based… in fact, every test and configuration file is expressed as a short PowerShell script. But PowerShell is usually locked down pretty tight by default, even with your local admin permissions. So we probably need to loosen up local execution policy.
Also, because your core scripts–the deltaTest code base–were downloaded from the Internet, many environments will “block” the files, preventing them from being run as scripts without manual confirmation. If we want to automate testing, that’s no help to us at all.
We can handle both of these issues with just a few steps.
First, go to your network deltaTest clone directory and copy its path.
Next, bring up a PowerShell command prompt with Admin privileges–yes, even though you’re already a local admin–type cd, paste in that path, and hit return. That sets your operating directory to the deltaTest repo.
Finally, run this command:
That’s it! Behind the scenes, your execution policy has been set to Unrestricted and your repo files are all unblocked. We can close this command prompt now.
The next thing we have to do is to create a shared configuration script. This is the script that contains all the settings specific to your development and testing environments, which are shared across your team. These are documented extensively in the wiki, and you don’t really need to care about the contents for now… we just need the script to exist so we can run the installer. You’ll see a template here… just make a copy and call it config.ps1.
Now we’re ready! Jump into the Install directory and double-click the +INSTALL shortcut.
The first thing that happens is that the script elevates itself to adminstrative previleges. Then it starts performing some checks.
deltaTest requires Powershell to be updated at least to a major version of 3. The current major version is 5, so this will rarely be a problem.
The unblock script already set our execution policy to Unrestricted, so no problem there.
deltaTest depends on a Microsoft-developed PowerShell module called SQL Server. It was already installed here, but if not, PowerShell will download and install it, with some manual confirmations along the way.
The installer will then write the current module location to your Windows Registry and prompt you for further configuration details. Each has a default value; to accept the default, just hit return. Note that you will also run the installer to CHANGE your configuration, for example to start running your tests in a different environment. In that case, the prompts will default to whatever the current value is.
The first configuration indicates whether tests should run silently, with no user interaction. This is appropriate if a machine is under use by a test agent performing automated regression testing, but this time around we’re going to invoke tests manually, so we’ll just leave it set to its default of No.
The second config item designates the active environment. This must be one of the values enumerated in the config.ps1 script we created earlier. The default happens to be one of those, so we’ll accept it.
The third config captures the location of my local Markit EDM command line executable, the assumption being that I am going to be testing Markit EDM solutions. I might be, later, but for the purposes of this Hello World test no Markit EDM solutions will be disturbed.
Finally–and this is only if we answered NO to the no-input question–the installer checks to see if I have the open-source text differencing engine WinMerge installed locally. In this case I do; if I did not, the WinMerge installer would run.
And that’s it! deltaTest is now installed locally and on the network share, and we’re ready to run a test!
And we have just the test to run. Let’s pop back up to the main deltaTest repo directory and then down into the Test directory. This folder contains some sample tests to get you started, and also our HelloWorld test. Before we run it, let’s edit it and have a look.
Not much to see, is there? That’s the beauty of deltaTest: the tests are very declarative and easy to understand, even if you don’t know PowerShell.
Well… maybe except for that first line. This is the line that locates the deltaTest module way out on the network share and loads it. That exact line will be at the top of every test you write, and what it actually DOES is run your shared config.ps1 script.
The second line just displays “Hello, World!” But it does so with a deltaTest-specific function. So if the module load fails, no Hello World. Let’s give it a try. We’ll close the editor, right-click on HelloWorld.ps1, and select Run With PowerShel.
Voila! We’re in business!
Ok so today you leaned the following skills:
- How to install deltaTest in your shared environment.
- How to prepare your local machine to accept the deltaTest installation.
- How to perform the local installation.
- How to execute a test.
Next time I’ll show you how to author and execute a non-trivial test against an actual–in parentheses for our lawyers: simulated–Markit EDM solution operating against real market data. Meanwhile, thanks for watching, and please don’t hesitate to contact us with any questions about how to use deltaTest or how to get involved in the project!