Tag Archives: PowerShell

The new elements’ object model is out. A short intro


Many claim that it’s not so easy to decide which pattern cmdlet to use with a particular control. For long time we were tied to what Microsoft’s UI Automation outputs to us. However, there is a way to increase productivity: extension methods. Yes, they are not visible in PowerShell by default, nonetheless I’d like to offer an object model that grew from nothing else but extension methods.

To start, let’s page through the presentation, with binaries of 0.8.7 alpha 3 or higher in your hands. Enjoy!

A bug in ISE


As I heard, there were a million test cases in PowerShell v. 1.0. In PowerShell ISE v. 3.0 I faced the following bug (a repeatable bug), on a Windows 8 x64 box:

1. In ISE have been opened several script modules.

2. ISE was closed

3. Two modules have been renamed (like XXXTestCasesIteration1.psm1 -> XXXTestCasesIteration01.psm1) and their folders were also renamed (i.e., XXXTestCasesIteration1\XXXTestCasesIteration1.psm1 -> XXXTestCasesIteration01\XXXTestCasesIteration01.psm1)

4. ISE was opened again and one of renamed files was called via Recent with a right (and a bit verbose) message box.

5. After that, I opened the Open menu item, a second thereafter ISE crashed.

After crash, it points (on selecting the Open menu item) to the %SystemRoot%\system32\WindowsPowerShell\v1.0 folder (i.e., where the executable is situated).

How to repeat? I opened a file in a next to folder to renamed (to point the last folder to a similar place), performed steps 1-5 with the second module (i.e.,  XXXTestCasesIteration2\XXXTestCasesIteration2.psm1 -> XXXTestCasesIteration02\XXXTestCasesIteration02.psm1) and the answer from ISE was the same, crash. Arr!

Wow, Amazon published 578 cmdlets for AWS!


This is a great news! With this generously given module, we don’t need write cloud cmdlet by ourselves but concentrate on those things that are much more close to software testing!

I’ll put there the links the following blog post provides:

AWSPowerShellToolsPublished

The AWS Tools for Windows PowerShell page:

http://aws.amazon.com/powershell/

User’s Guid

 

 

 

 

Just for fun: after acquisition, our frameworks are used in a Fortune 50 company…


We’re here:

http://money.cnn.com/magazines/fortune/fortune500/2012/full_list/ , slightly above the fifty line…

Web automation: SePSX 0.4.0


 

To the version 0.4.0, though it’s still alpha, the following features, best known as belonged to the UIAutomation framework, have been added:

  • On error delay
  • On success delay
  • Automated test result generation

On error and on success scriptblocks (actions), and logging are not completely done yet.

Among other features that have been implemented the last week, the following list:

  • Smart wait for an element ([SePSX.Preferences]::Timeout as you have already understood, by the analogy with UIAutomation)
  • The square over the element a cmdlet returned has been tied to the right position

PowerShell and Selenium go ahead of paid competitors


An interesting query can be seen at the indeed.com portal:

The demand for test automation engineers with QTP experience grows, whereas primordial WinRunner goes towards zero in popularity. TestComplete and Ranorex have never been more than outsiders, but there is also a surprise about TestManager.

I think that all non-enterprise test tools are simply less known to serious enterprise customers. The second cause may be here that an average HR manager does know TFS but not MTM.
Anyway, the strong marketing machine of Microsoft and the tight integration with Studio and TFS should help in MTM’s advancement.

Here, one hope takes place. As, first and foremost, a big ally of open source testing solutions, I’d like to predict that in several areas, namely Windows UI Automation, Web Automation, maybe Metro UI automation and, definitely, automation of labs of any kind, there will be a breakthrough of open source testing instruments.

Let’s see what we have now. Regarding Windows desktop automation, there are a lot of frameworks with the ability to test Win32, Windows Forms, WPF, Silverlight applications. The only thing to perform a step to the mass-market is the need in a covering application that would embrace frameworks to an out-of-the-box solution. I mean a typical ‘download, set up and run’ and ‘click’n’play’ solution.

There are problems with third-party controls though. Nonetheless, we can now create an end-to-end testing solution on bare .NET or PowerShell (even me, just a tester, created one of such kind).

In the world of web automation, there is the unbeatable leader now. Supported by almost all browser vendors, Selenium is getting a standard tool for web-testing (and even going to become an official standard).

Well, the state of affairs seems to be very good, even though paid competitors struggle with FOSS. I’d like to think that one or more vendors of paid testing software will drop a free solution to the public within next two years. I don’t know, of course, whether it will be MTM Express, TestIncomplete or Ranorex UltraLite, but I believe that outsiders will act in this way too.

Happy testing with free solutions!

BGShell for Metro UI testing


Today I built an experimental version of BGShell. It allows you to run cmdlets hovering over the Metro UI. BGShel also support some intellisence and shows objects’ properties.

The package is here.
A fly in the oinment is that it’s built for .NET 3.5. Nonetheless, all what you need to do is to agree with your test Windows 8 when it offer to download .NET 2.0/3.5.

A small fix to the ESXiMgmt module


The module version has been incremented to 1.0.0.2 due to fixing a bug in the Register-ESXiVM cmdlet. There has been fixed a command string given to plink.exe, exactly the command line now braced with single quotes.

How to register virtual machines that copied to an ESXi host


Task: register virtual machines automatically.

Requirements: 1. register virtual machines not spending time to manual registration.

Solution: a PowerShell script that uses the Register-ESXiVM cmdlet. Additionally, there could be done answering the question (‘I moved it’ in my case) but didn’t.

Details: the following example demonstrates how to register test machines:

#######################################################################################################################
# File:             ESXiMgmt_register_all_virtual_machines_sample.ps1                                                 #
# Author:           Alexander Petrovskiy                                                                              #
# Publisher:        Alexander Petrovskiy, SoftwareTestingUsingPowerShell.WordPress.Com                                #
# Copyright:        © 2011 Alexander Petrovskiy, SoftwareTestingUsingPowerShell.WordPress.Com. All rights reserved.   #
# Prerequisites:    The module was tested with Vmware ESXi 4.1 U1 on the server side and                              #
#                       Vmware PowerCLI 4.1 U1                                                                        #
#                       plink.exe 0.60.0.0                                                                            #
# Usage:            To load this module run the following instruction:                                                #
#                       Import-Module -Name ESXiMgmt -Force                                                           #
#                   Please provide feedback in the SoftwareTestingUsingPowerShell.WordPress.Com blog.                 #
#######################################################################################################################
param([string]$Server,
	  [string]$User,
	  [string]$Password,
	  [string]$DatastoreName,
	  [string]$Drive
	  )
# USAGE: .\ESXiMgmt_register_all_virtual_machines_sample.ps1 192.168.1.1 root 123 datastore3 host1ds3

cls
Set-StrictMode -Version Latest
Import-Module ESXiMgmt -Force;

Connect-ESXi -Server $Server -Port 443 `
	-Protocol HTTPS -User $User -Password $Password `
	-DatastoreName $DatastoreName -Drive $Drive;

dir "$($Drive):" | %{ `
		# supposedly, all the *.vmx files have
		# the same names as their folders
		# like VMName\VMName.vmx
		if (Test-Path "$($_.FullName)\$($_.Name).vmx")
		{
			Register-ESXiVM  -Server $Server `
				-User $User -Password $Password `
				-Path "/vmfs/volumes/$($DatastoreName)/$($_.Name)/$($_.Name).vmx" `
				-OperationTImeout 5;
		}
	}

The script can be downloaded from poshcode and within the ESXiMgmt package.

%d bloggers like this: