Fitnesse and Fitnium Fun
Posted on 2009-Oct-16 at 08:23
Some things I have learned when using Fitnium and Fitnesse. SuiteSetUp and SuiteTearDown are not for actions, those need to go into regular tables, the SetUp and TearDown are not for Action Fixtures. fit.exception.FitParseException: Can't find tag: table - typically means malformed HTML in a page but MOSTLY means you don't have a SetUp or TearDown in your Suite, and within those pages you need something, ANYTHING, even if its simple text. Another possibility is if the wiki page containing the test has both the Suite and Test properties showing in the left property bar, both properties can also generate the error as its trying to run a Test but has nothing to do.
The jar file usually needs to be on any page its called on, don't trust the inheritance with the Parent pages or the Root page, you can try it but if you start getting function errors on the page - well now you know what needs to be added.
When adding URL's make sure they are not in camel case, especially URL's that have been parameterized otherwise the URL may not be sent to Selenium the way you think...and oh yes, PARAMETIZE everything.
Fitnesse Parameterization
Posted on 2009-Oct-14 at 03:17
In order to adjust for the multiple environments that the Fitnesse tests will be running in, within my environment later on, I have spent the time to parameterize the framework now and just added in some Symbolic Links. The Symbolic Links is a wonderful feature for Fitnesse, as it allows a wiki page to be called from another, so I can set up one page with a test, or a set of tests, and have it called from another. The true power in this comes from being able to set up multiple high level pages with specific environment information, so one set of tests can be run on Server A if its called from the Server A Test Page which has a Symbolic Link to Server Tests, I can also call the same tests from the Server B Test Page, which has different test settings, and reuse Server Tests within it. Simple, yet powerful.
It did take a little bit of playing around to get the set up working, so here is what I found out.
- Create the page that will contain the Symbolic Link
- Go to Properties and set the Suite property on the page and save it, as this page is calling another Suite is needed so the Page will go down the Hierarchy
- Find the path that will be in the Symbolic Link
- Go to Properties and set the Name for the Link then the path to the Page, click on Create/Replace
- Save the settings and edit the page with whatever is needed, the Symbolic Link if used once is automatically called
I don't know what will happen with the need for multiple calls, I have seen examples where instead of looping a page was set up as follows:
[Username1]
[Password1]
[Symbolic Link]
[Username2]
[Password2]
[Symbolic Link]
This should allow testing each Username and Password on that Linked Test Page, I have not tried this yet, have not had a need to, but it should be workable as I believe Fitnesse will take the settings it comes to last.
There is probably more to get out of Fitnesse that I haven't discovered yet, I can't wait to see what I find next.
Books On My Shelf
Posted on 2009-Oct-9 at 09:42
Over the years I have collected quite a few books, not always on testing as I used to be able to get enough online and through discussions with people to keep up. Occasionally I still bought the book that to me, was useful, or was a necessary part of the books I wanted to always take with me from Job to Job. So here is the list of what I have (your mileage may vary): Testing Books (some of these come into the office with me, especially Lessons Learned In Software Testing, which I have pulled out from time to time to get a point across to Dev Managers), this is not in any special order: - Quality Software Management - Volume 1: Systems Thinking, Weinberg
- The Complete Guide To Software Testing, Hetzel
- Effective Software Testing, Dustin
- How To Break Software, Whittaker
- Lessons Learned In Software Testing, Kaner & Bach & Petticord
- Managing The Testing Process, Black
- Customer Orientated Software Quality Assurance, Ginac
- Software Testing In The Real World, Kit
- Change-Based Test Management, Sistowicz & Arell
- How We Test Software At Microsoft, Page, Johnston, Rollison
- Writing Solid Code, Maguire
- Debugging The Development Process, Maguire
- How To Break Software Security, Whittaker, Thompson
- Implementing Automated Software Testing, Dustin, Garrett, Gauf
Technology Books (I use Perl ALOT as you can see), since I am mostly self taught these are all the things I have needed for my job in past...most of this is O'Reilly, a geeks best friend. - Learning Perl On Win32 Systems, Programming Perl, Advanced Perl Programming, Perl Best Practices, Perl CD Bookshelf, Mastering Regular Expressions, Perl Cookbook
- Debugging Perl
- Learning Bash Shell
- Sed & Awk
- JavaScript
- CGI Programming
- SQL In A Nutshell
- Unix Shell Programming
- Unix In A Nutshell
- Python Visual Quickstart Guide
- Python Programming For Beginners
- Python Essential Reference
- Unit Test Frameworks
- Teach Yourself Java
- Java Development With Ant
- Open Source Programming with CVS
- Unit Test Framework, O'Reilly
- Pragmatic Unit Testing, Hunt, Thomas
- Practical Performance Analyst, Gunther
- Aptana RadRails, Ramirez
- Test Driven .NET Development with Fitnesse, Adzic
- Fit For Developing Software, Mugridge, Cunningham
- Head First C#
- Windows PowerShell In Action
PowerShell fun with Fitnesse
Posted on 2009-Oct-8 at 03:53
Fitnesse is the newest automation tool I have introduced here, we also use PowerShell to drive a lot of the builds, because there is some integration between the two (think Smoke Test) I worked on getting the TestRunner working with PowerShell. I couldn't get the .Net version to run properly, it kept dying when it would render the page, but the Java runner worked great once I was able to work through the java command line with the BuildMaster. If not for his help I wouldn't have been able to finish.
This script launches the Java TestRunner, points it to the Fitnesse server, and runs the three tests (one Test and two Suites) I currently have set up, then scans through the XML results to display some results in the command line window.
# Variables for the script
[ string]$fitniumLocale = "C: itnium"
[ string]$fitnesseJar = "fitnesse.jar"
[ string]$fitnesseClass = "fitnesse.runner.TestRunner"
[ string]$serverName = "my_server"
[ string]$portName = "8888"
# Use a Test Array to be able to bundle all the tests
$testArray = ( "Test1" , "Test2", "Test3" )
function main()
{
Write-Host "Running Fitnesse Tester.`n"
cd $fitniumLocale
# Run through each test in the bundle
$Java = "java.exe"
foreach ($test in $testArray)
{
# Make a date string to get the right file date/format
$dateStr = [string] (get-date)
$Month,$Day,$Year,$Hour,$Minute,$Second = $dateStr.split(" :/")
$testResults = "$test" + "$Month" + "$Day" + "$Year" + "$Hour" + "$Minute" + ".xml"
[ string]$opts = "-xml $testResults"
# Start the test
Write-Host "`nRunning $test`n"
# Get the output from Java so we can scrape it for the test passes and fails
& $Java "-cp" "$fitnesseJar" "$fitnesseClass" "-xml" "$testResults" "$serverName" "$portName" "$test"
Write-Host "Completed $test`n"
Write-Host "Test Results"
# Scan through the output file, we want that for archiving
[ System.Xml.XmlDocument] $xd = new-object System.Xml.XmlDocument
$file = resolve-path($testResults)
$xd.load($file)
$nodelist = $xd.selectnodes("/testResults/finalCounts") # XPath is case sensitive
foreach ($testCaseNode in $nodelist)
{
$right = $testCaseNode.selectSingleNode("right").get_InnerXml()
$wrong = $testCaseNode.selectSingleNode("wrong").get_InnerXml()
$ignores = $testCaseNode.selectSingleNode("ignores").get_innerXml()
$exception = $testCaseNode.selectSingleNode("exceptions").get_InnerXml()
}
# Send a summary of the results to the console
Write-Host "Passed: $right" -ForegroundColor Green
Write-Host "Failed: $wrong" -ForegroundColor Red
Write-Host "Ignored: $ignores"
Write-Host "Exceptions: $exception" -ForegroundColor Yellow
}
}
main
It needs some cleaning up, but its a good first step that runs well, I especially like the color coding for Pass, Fail and Exceptions so I can visually be drawn to the values I want to see.
Last Page | Page 4 of 19 | Next Page
|
|
|