Monday, September 21, 2009

Read File Properties with Excel VBA

The VBA script for Excel below will read the 'File Version' from the file properties and will read file name and its version each into a column in a Excel sheet.


Sub getFileProductVersion()

Dim objShell As Shell
Dim objFolder As Folder
Dim objFolderItems As FolderItems
Dim objFolderItem As FolderItem
Dim numberOfFiles As Long
Dim i As Integer
Dim j As Integer

Set objShell = New Shell
Set objFolder = objShell.Namespace("C:\Temp\files")

If (Not objFolder Is Nothing) Then
Set objFolderItems = objFolder.Items()
numberOfFiles = objFolderItems.Count
Range("A1").Select

For i = 0 To numberOfFiles - 1
Set objFolderItem = objFolderItems.Item(i)
ActiveCell.Offset(i, 0) = objFolderItem.Name
ActiveCell.Offset(i, 1) = objFolder.GetDetailsOf(objFolderItem, 39)
Next i

End If

Set objFolder = Nothing
Set objShell = Nothing

End Sub


Enjoy :)

How to specify the browser that should be used in WebTest

In WebTest it is possible to define which browser shall be simulated. Currently WebTest support the following browsers:
  • Firefox3 (or FF3)
  • Firefox2 (or FF2)
  • InternetExplorer6 (or IE6)
  • InternetExplorer7 (or IE7)
To get a more detailed list, have a look at the WebTest config page (http://webtest.canoo.com/webtest/manual/config.html).

As you can see in the simple example below, it is very easy to define the simulated browser for your test:







'Here goes your test code...'







This example is an extract from a browser test of the self test suite of WebTest. For more details, have a look a the self test suite (https://svn.canoo.com/trunk/webtest/selftests/).

Enjoy :)

Wednesday, August 12, 2009

How to create a WebTest project in less than a minute

Assuming you have WebTest installed you can create a WebTest project in less than a minute:

Go to the directory where you want to create the WebTest project


E.g.:

C:\projects


Call the createProject task and provide a name for the project, e.g. myWebTestProject


C:\projects>ant -f %WEBTEST_HOME%\webtest.xml wt.createProject


Change to the project directory


C:\projects>cd myWebTestProject


Call WebTest


C:\projects\myWebTestProject>webtest


Done :)

Tuesday, August 11, 2009

Functional Testing for Joomla! with WebTest

Joomla! is a very popular open-source CMS based on PHP. It is simple to use and makes creating and maintaining Web sites easy for everyone, from total beginners setting up their first site to IT professionals managing enterprise installations.

Like many other projects (not only open-source projects) testing is not the most popular subject. However, testing is very crucial for every project to be able to grow and handle complexity within the project.

Functional testing is one aspect of testing which can focus on the users perspective of using an application.

I started a functional test suite for Joomla! with Canoo WebTest, an open-source tool for automated testing of web applications in a very effective way.

If you would like to have a look at the current state of the work, see here:
Some initial documentation can be found here:
Enjoy :)