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 :)

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:
  1. Go to the directory where you want to create the WebTest project

    E.g.: C:\projects

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

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


  3. Change to the project directory

    C:\projects>
    cd myWebTestProject

  4. 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 :)

Sunday, December 30, 2007

The Screencast Blog

Today I found the screencast blog, which provides a huge number of screencast which mostly show Eclipse features.

Have a look, it's really interesting:
Enjoy!

Regards,
Tomi

Thursday, December 06, 2007

Groovy and Grails Posts & Links

Some interesting posts & links:
Enjoy :)

Regards,
Tomi

Tuesday, November 13, 2007

WebTest Screencast: Data Driven WebTest

We finally made it :)

Marc Guillemot (http://mguillem.wordpress.com/) and I published the new WebTest (http://webtest.canoo.com/) screencast showing Data Driven WebTest based on Google Calculations.

You can find the screencast here:

New screencasts will follow soon...

Enjoy!

Kind regards,
Tomi

Tuesday, November 06, 2007

Groovy Posts & Links

I'm following the Groovy (http://groovy.codehaus.org/) posts and links on http://www.dzone.com/ and http://del.icio.us/. It is amazing, how the number of posts and saved URL's increased over the last couple months.

If you would like to have a look at these, check the following links...

dzone

del.cio.us

Enjoy reading!

Regards,
Tomi

Monday, October 29, 2007

WebTest vs. Selenium

Marc Guillemot compares the features of two popular open source testing tools: WebTest and Selenium!

A must read post! Very interesting!

[..] The maintainability of automated tests depends primarily on the skills of the test authors, but different tools have different features that impact their efficiency. This blog post compares the features of two open source automated web testing tools: Canoo WebTest and Selenium.

http://mguillem.wordpress.com/2007/10/29/webtest-vs-selenium-webtest-wins-13-5/

Enjoy!

Regards,
Tomi

Monday, September 10, 2007

WebTest Screencast: New cast on its way...

Tonight we (Marc Guillemot and myself) were working on a new screencast for WebTest. The new cast will be about data driven web testing.

I'll try to bring the cast online till end of the week, or at least a first beta version :) As soon as I have it published, I'll post a new blog entry.

Regards,
Tomi

Wednesday, August 22, 2007

WebTest Screencast: Creating a first WebTest project

Marc Guillemot (http://mguillem.wordpress.com/) and myself are working on some screencasts to show WebTest capabilities. The first screencast has been announced on the WebTest mailing list:

and can be found here:

We are looking forward to publish a couple more screencasts within the next few months. If there are special features you would like to see in the upcoming screencast, let me know :)

Enjoy!

Regards,
Tomi

Wednesday, August 08, 2007

Dealing with critics?

There is an interesting post on Marc Guillemot's blog:

He's blog entry can be understood in a way, that the lack of XPath can be associated to the lack of test automation experience. If this relation is correct or not is not as interesting as the reaction which has raised based on his entry.

I'm very surprised, how personal this was taken, especially the comment of Neil: http://mguillem.wordpress.com/2007/07/31/xpath-power-2-detect-lack-of-experience/#comment-16. I would have expected more distance to such a statement and more tolerance.

My understanding of Marc's statement is, that the better an XPath expression is (better in the sense of robust), the better the tests are which might be based on the XPath expression. The first XPath statement Marc is quoting:

is not robust at all. If there a small change in the used tables or additional items in the lists, the test will break. If there is a relationship between robust and better, that this statement is not prefered and in this sense, I can understand the statement of Marc very well.

Regards,
Tomi


Thursday, August 02, 2007

Groovy & OpenOffice?

There are some blog posts about Groovy as an extension within OpenOffice. It's quite interesting to read...

Enjoy :)

Regards,
Tomi

Post on TheServerSide about HTMLUnit

I posted a small note on TheServerSide (http://www.theserverside.com/news/thread.tss?thread_id=46374) about the new features of HTMLUnit.

Regards,
Tomi


Wednesday, December 20, 2006

Groovy in Action

The book "Groovy in Action" is finally out! Have a look, it's worth reading it!

URL:

http://groovy.canoo.com/gina

Description:

Groovy in Action is a comprehensive description of the Groovy programming language, its libraries, and its everyday use. With the release of JSR 241, Groovy has become the second standard language for the Java platform. The book introduces Java developers to the new dynamic features that Groovy brings to this platform.

Enjoy!

Groovy in Action

The book "Groovy in Action" is finally out! Have a look, it's worth reading it!

URL:

http://groovy.canoo.com/gina

Description:

Groovy in Action is a comprehensive description of the Groovy programming language, its libraries, and its everyday use. With the release of JSR 241, Groovy has become the second standard language for the Java platform. The book introduces Java developers to the new dynamic features that Groovy brings to this platform.

Enjoy!

Monday, September 25, 2006

groovy articles on del.icio.us

Since I'm using Groovy in the current project (thanks to Dierk and Marc) I'll start collect articles about groovy...

This might help some other beginners to start with a steeper learning curve as well :)Enjoy!

Read more at del.icio.us/TomiSchuetz...

Monday, August 28, 2006

Groovy: Parsing an XML file with Groovy

Groovy comes with a handy XML parser. With this parser you can load an XML file quickly and navigate it easy.

Currently I'm working with WebTest (http://webtest.canoo.com/) for testing functional aspects of an web application.

WebTest comes with a nice overview to present the results of the test runs. The report itself is transformed out of an XML file. For statistics reason, I'm using this XML file to extract specific data. This extraction is done with a little Groovy script.

To get an idea of the WebTest report XML file, have a look a the fragment below:

WebTestReport.xml:

<?xml version="1.0" encoding="ISO-8859-1"?>
<summary Implementation-Title="Canoo Webtest" Implementation-Version="R_1304">
<testresult>
<config>
<parameter>
...
<results>
<step>
<parameter name="taskName" value="ant:goToRelationshipOpening"/>
<result>
<completed duration="0"/>
</result>
<step>
<parameter name="taskName" value="invoke"/>
<parameter name="description" value="Get the page: Relationship Opening"/>
<parameter name="url" value="website"/>
<parameter
name="resultFilename" value="response_1156746643278_invoke.html"/>
<parameter name="method" value="GET"/>
<result>
<completed duration="8219"/>
</result>
</step>
<step>
<parameter name="taskName" value="storeCookie"/>
<parameter name="property" value="wtSessionCookie"/>
<parameter name="description" value="Store the session id to jump in the session from a normal browser"/>
<parameter
name="-> cookie value" value="1234;
<parameter name="name" value="JSESSIONID"/>
<result>
<completed duration="15"/>
</result>
</step>
</step>
...

This file can be parsed with the following code:

import java.text.SimpleDateFormat

FormatUS = new SimpleDateFormat('EEE MMM dd hh:mm:ss z yyyy', Locale.US)
FormatDE = new SimpleDateFormat('dd.MM.yyyy hh:mm:ss', Locale.GERMAN)

def folder = args?.size() ? args[0] : "data"
println "reading files from directory '$folder'"
def basedir = new File(folder)

// result files of the current run
files = basedir.listFiles().grep(~/.*xml$/)

List resultLines() {
List result = []
for (currentFile in files) {
println " processing $currentFile"
def summary = new XmlParser().parse(currentFile)

// List with all 'testresult' elements
def testresults = summary.testresult


testresults.each { testcase ->
def entry = [:]
entry.name = testcase.'@testspecname'.split(/\W/)[0]
entry.time = testcase.'@starttime'
entry.time = FormatUS.parse(entry.time)
entry.time = FormatDE.format(entry.time)
entry.ok = testcase.'@successful'

def rt = testcase.depthFirst().findAll { element ->
if (element.name() != 'parameter') return false
if (element.'@name' != 'taskName') return false
def roundtripTags = 'clickLink clickButton clickElement'
roundtripTags.tokenize().contains(element.'@value')
}
entry.roundtrips = rt.size()

def fields = testcase.depthFirst().findAll { element ->
if (element.name() != 'parameter') return false
if (element.'@name' != 'taskName') return false
def fieldsTags = 'selectForm setCheckbox setFileField setInputField setRadioButton'
fieldsTags.tokenize().contains(element.'@value')
}
entry.fields = fields.size()

def verifies = testcase.depthFirst().findAll { element ->
if (element.name() != 'parameter') return false
if (element.'@name' != 'taskName') return false
def fieldsTags = 'verifyCheckbox verifyCookie verifyDocumentURL verifyElement'
fieldsTags.tokenize().contains(element.'@value')
}
entry.verifies = verifies.size()

if (testcase.results.error) {
entry.resultsError = testcase.results.error.'@exception'[0]
} else {
entry.resultsError = ''
}

/*
if (testcase.results.failure) {
entry.resultsFailure = testcase.results.failure.'@message'[0].replaceAll(/\W/, " ")
println "####" + entry.resultsFailure
} else {
entry.resultsFailure = ''
}
*/

def groupSteps = testcase.results.step.findAll { step ->
step.parameter.any { param ->
param.'@name' == 'taskName' && param.'@value' == 'group'
}
}

def goodSteps = groupSteps.findAll{ it.result?.completed }

// assumed: there is always at least one group step, size() never 0
if (groupSteps.size() != 0) {
entry.complete_pct = goodSteps.size() / groupSteps.size()
} else {
entry.complete_pct = 0
}

if (goodSteps) {
entry.description = goodSteps[-1].parameter.findAll{it.'@name'=='description'}.'@value'[0]
} else {
entry.description = ''
}

result <<>
writer <<
"Testfall\t" <<
"Datum\t" <<
"Erfolgreich\t" <<
"Prozent\t" <<
"Error\t" <<
"Server Roundtrips\t" <<
"Number of Fields\t" <<
"Verifications\t" <<
"Beschreibung\n"
for (entry in resultLines()) {
writer <<
entry.name << "\t" <<
entry.time << "\t" <<
entry.ok << "\t" <<
entry.complete_pct << "\t" <<
entry.resultsError << "\t" <<
entry.roundtrips << "\t" <<
entry.fields << "\t" <<
entry.verifies << "\t" <<
entry.description << "\n"
}
}


Now you get a tab seperated file with the content of your result files from the web testing runs. I
import this file into Excel and create a pivot table to understand the results better.

I hope this helps :)

Friday, August 25, 2006

Groovy: Get all XML files from a directory tree

Currently I'm working in a project, where Groovy (a dynamic scripting language for the JVM) is used. One of the project members is Dierk König, which is a Groovy commiter and the author of Groovy in Action. This gives a real insight in the beauty of Groovy :)

Below you can see a nice solution for finding all XML files in a directory tree:

// pass a directory or use the current directory
def folder = args?.size() ? args[0] : "."
println "reading files from directory '$folder'"
def basedir = new File(folder)

// result files of the current run
files = basedir.listFiles().grep(~/.*xml$/)

List resultLines() {
List result = []
for (currentFile in files) {
println " processing $currentFile"
}
return result
}

Monday, August 14, 2006

GWT Widget Library

Google released a new version of GWT today, version 1.1.0. There were some API changes made that broke a few things in the GWT-WL, namely the FormPanel and SVG support. This release is to make the GWT-WL compatible with the latest GWT release. Below are a list of changes...

[from the site]

Read more at gwt-widget.sourceforge....

Friday, August 11, 2006

Eclipse Summit Europe 2006

The Eclipse Summit Europe will take place in Esslingen, Germany from October 11-12, 2006

Read more at www.eclipsecon.org/summ...

Eclipse 3.3 M1 - New and Noteworthy

It's amazing, how fast the Eclipse people work! Thanks to all of them :)

Read more at download.eclipse.org/ec...

Tuesday, August 08, 2006

Lint4j Maven Plugin - Lint4j

Lint4j comes with a Maven Plugin that simplifies generation of reports significantly.

I'll have to check this plugin with WebTestClipse ...

Read more at www.jutils.com/maven-pl...

dzone.com

An interesting site for developers. It's similar to del.icio.us and stumbleupon , but more focused on developers.

I like these community driven sites, because it allows me to find high quality sites.

Read more at www.dzone.com/

Thursday, August 03, 2006

SourceForge.net: WebTestClipse

I added WebTestClipse as a project to Sourceforge.net ( http://sourceforge.net/projects/webtestclipse/ ). The idea is, to use Sourceforge.net as a portal and to redirect to http://webtestclipse.canoo.com/ where the project is hosted and developed...

Read more at sourceforge.net/project...

Friday, July 28, 2006

Setting up the master Maven 2 project for WebTestClipse - Install Maven 2

I'm setting up the master Maven 2 project for WebTestClipse . You can follow these steps to set up any kind of project.In this post I'll descripe the installation of Maven 2, based on links and some minor notes. It's not to be considered to be a complete installation guide.

1.) Download Maven 2

Download Maven 2 from http://maven.apache.org/download.html and chose the right distribution. I'm using http://www.apache.org/dyn/closer.cgi/maven/binaries/maven-2.0.4-bin.zip .

2.) Unpack Maven into a local directory

I've chosen C:\dev\maven-2.0.4 as my Maven 2 home directory.

3.) Environment Variable

Define a %MAVEN_HOME% variable and extend the %PATH% variable. This will make it possible to call Maven 2 commands from the command line

4.) Test your Installation

Testing the installation is fairly simple. Just call a Maven 2 command from the command shell:

mvn -v

As a result you should see:

Maven version: 2.0.4

Joined WebTestClipse

I joined the WebTestClipse project. The goal of the project is to provide a set of Eclipse features and plugins to develop tests for WebTest .

Read more at webtestclipse.canoo.com...

Daily IT Thoughts...

I'll start making daily notes about my work, this shall be a collection of impressions but also of small code fragments which help me on my daily projects...

Monday, January 09, 2006

Eclipse and Java on USB Memory Stick

I bought myself a memory stick a few days ago, mainly to store data which I download in a internet coffee shops. I find it quite annoying to transport my laptop every time I just would like to read some mails...

Somehow I found portableapps.com which has a nice collection of tools (Firefox, Thunderbird, etc.) which can be copied on the USB memory stick and started from there. This makes it easy to use my favorite browser and mail client...

For me the next question was: can I install Eclipse and Java on the memory stick and use it? Yes, you can :)

Here a short description on what I did:

1.) Copy a current installation of Java to the memory stick. I really copied it, I didn't install it!
2.) Copy Eclipse on the memory stick.
3.) Write a simple batch file to start Eclipse.

that's it!

My directory structure on the memory stick looks like this:

%USB_MEMORY_STICK_ROOT%
| Eclipse.bat
+---Applications
+---jdk1.5.0_05
| \---bin
| \---javaw.exe
|
+---eclipse
\---eclipse.exe

Eclipse.bat looks like this:

.\Applications\eclipse\eclipse.exe
-data .\Projects
-vm .\Applications\jdk1.5.0_05\bin\javaw.exe
-vmargs -Xmx256M



Enjoy :)

Monday, December 19, 2005

Maven 2 - How To: Where to put the properties?

1) The properties, in Maven 1 in build.properties and project.properties, are stored in settings.xml

2) Create the settings.xml in your user directory

Under Windows XP, this is:

C:\Documents and Settings\<user>\.m2\settings.xml

If you have to configure a proxy, it would look like this:

<?xml version="1.0" encoding="UTF-8"?>
<settings>
<proxies>
<proxy>
<active/>
<protocol>http</protocol>
<username>user</username>
<password>passwd</password>
<port>8080</port>
<host>proxy-url</host>
<id/>
</proxy>
</proxies>
</settings>

3) Since settings.xml is not part of your workspace and won't be stored in the project repository, you don't have it within your development environment. I'm using Eclipse for my development and I included the settings.xml in my project as a linked resource to the file system.

This approach gives you the advantage, that you can edit settings.xml easily within Eclipse and you don't have to leave your development environment :)

* * *

Reference:

http://maven.apache.org/maven-settings/settings.html

Saturday, December 17, 2005

Maven 2 - How To: Multiple Module (flat project layout)

1) Create at least two Maven projects in a flat project layout...

%PROJECT_WORKSPACE%\%YOUR_PROJECT_MASTER%pom.xml
...

%PROJECT_WORKSPACE%\%YOUR_PROJECT_SLAVE%pom.xml
...

2) Define the <groupId> and <artifactId> of the modules...

%PROJECT_WORKSPACE%\%YOUR_PROJECT_MASTER%\pom.xml:

<project>
...
<groupId>somegroup.master</groupId>
<artifactId>master</artifactId>
...
</project>

%PROJECT_WORKSPACE%\%YOUR_PROJECT_SLAVE%\pom.xml:

<project>
...
<groupId>somegroup.slave</groupId>
<artifactId>slave</artifactId>
...
</project>

3) Define the modules in the master project...

Here I added first the artifactId, but it didn't work. I changed it to the directory and everything was fine.

%PROJECT_WORKSPACE%\%YOUR_PROJECT_MASTER%\pom.xml:

<project>
...
<modules>
<module>../%YOUR_PROJECT_SLAVE%</module>
</modules>
...
</project>

4) Add the <parent> and <dependency> element in the slave module...

%PROJECT_WORKSPACE%\%YOUR_PROJECT_SLAVE%\pom.xml:

<project>
...
<parent>
<groupId>somegroup.master</groupId>
<artifactId>master</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
...
<dependencies>
<dependency>
<groupId>somegroup.master</groupId>
<artifactId>master</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
...
</dependencies>
...
</project>

5) Call mvn install...

First the master project will be called and than slaven... That's it :)

* * *

References:

- http://maven.apache.org/
- http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
- http://maven.apache.org/guides/mini/guide-ide-eclipse.html