The Lookout

MIA - well I have been in action but not really missing...

Posted on 2012-Jan-20 at 08:23

So, 2011 was a busy year working with SharePoint.  We did a major site upgrade where the old public site running on IIS was moved over to SharePoint, that was a major effort and took a lot of coordination with a lot of people.  It came off really well, and has been successful since not many people noticed the underlying change, only the new look of the site.  To me, that is a major success.

 

In addition I went through the task of learning SharePoint, as well as it's Search functionality, we had it going well for awhile then things just stopped.  We still have no idea why, but it's been slightly educational in learning how things work.  A nice environment where people just jump into things, help out where needed, and take the time to learn.  That's what makes this job great.

 

Testing was a big focus, not only because we added a new person to help test last year, though she moved on it was good to sort of settle things and document much more.  Teaching is always interesting since everyone comes in with a different focus and idea, that helps me readjust my thinking when I start to train someone.  From that I have more wiki pages, more places to document what we have been doing and more documentation on just everything.  I also got a start on automated testing, I now have a Framework with SpecFlow where I am now using BDD to create automated cases for Functional and Acceptance testing.  First time the Acceptance Test was used after a deploy we found an error, that is success to me.

 

I needed to add goals for the year, which I am bad at, for myself I have overall goals but they get subsumed by whatever is going on at work at the time.  Priorities come up and I need to learn something, say about writing a PowerShell script here or there, always something new.  Though I think I am better now at focusing more on what I need to do and I will be going through that as a task for 2012.  Should be an interesting year and I hope to do better about recording things here as well.

Troubleshooting SharePoint Issues

Posted on 2011-Apr-4 at 12:41

Since I am still in the midst of lots of SharePoint work, one of the recent items I started on was a quick list of things to check when troubleshooting.  As SharePoint is a framework and a platform it's often hard to find out where issues are coming from, so I use this as a guide to track down errors:

  • Check ULS logs with the ULS Viewer
  • Verify web.configs for the affected Site
  • Check the Event Log on the Central Administration machine or the Web Front End for errors
  • Turn on/off Custom Error Reporting for Local/Developer/Test environments only
  • Check IIS logs on the Web Front End for any errors not caught by ULS (this is a rare case)
  • Clear page cache
  • Assure the SharePoint User Permissions are correct

I also have a few locations I check to see if anyone else has my same issues

  • MSDN Forums
  • SharePoint Overflow (soon to be StackExchange Overflow)
  • The SharePoint Homepage, to check for updates

I've found SharePoint to be difficult to check sometimes because its not just a web server, often pages are encapsulated within what are called WSP files, these are basically templates that pull data from a database and build the pages.  It makes tracking issues down complex as often the problem is code related, not a missing bracket or end tage on a page.

SVN Release Notes with PowerShell

Posted on 2011-Feb-25 at 10:34

The environment I work in now is hevily Window-ified.  This is due to the extensive use of PowerShell for the Build/Release processes and the fact the major project is a SharePoint installation.  Now that we have moved to Subversion and have packages coming out, sometimes with only small fixes, I decided I needed a way to be able to get some information on a package.  To be able to include this in the Build scripts I needed something in PowerShell that would query Subversion and give me a list of comments from all commits since the last release version.  This worked out well, took a bit to figure out, but it came out nice in the end.

 

function GetLog([string]$target, [int]$base_version, [int]$target_version, $relNotesDir="C:\Temp")
{
 if(($relNotesDir -eq $null) -or ($relNotesDir -eq "")) {
  "The " + $relNotesDir + " is empty. `n"
  $relNotesDir="C:\Temp"
 }
 if (!(Test-Path -Path $target)) {
  $target + " does not exist.`n"
  "Try the $target path again, make sure it is typed correctly and exists.`n"
  exit
 }
 if (!(Test-Path -Path $relNotesDir)) {
  "The Release Notes directory " + $relNotesDir + " does not exist.`n"
  "Enter an existing directory and try again.`n"
  exit
 }
 
 "Looking for changes from " + $base_version + " to " + $target_version + " in " + $target
 "Writing Release Notes out to " + $relNotesDir
 $releaseNotes = Join-Path -Path $relNotesDir  -ChildPath( "releaseNotes_" + $target_version + ".txt")
 $Command = "svn.exe"
 $Range = "" + $base_version + ":" + $target_version
 $Params = "log",$target,"-r",$Range,"--xml"
 $svnlog = [xml](& $Command $Params)
 $svnlog.log.logentry | foreach {
  if ( $_.revision -gt $base_version ){
   $a = ( $_.revision + " : " + $_.author + " `n " + $_.msg )
   $a >> $releaseNotes
  }
 }
}

 

Hope this helps someone out!

Running Fitnesse with PowerShell - RESTful Tests

Posted on 2010-Aug-6 at 08:30

Previously I noted how I had written my original tests with Fitnesse to use the TestRunner and access Fitnesse in a way that worked, but as I recently discovered is no longer supported.  Oh well, so I update my tests.  Which was necessary anyway, since on the Build Machines where these tests would be run Fitnesse is not going to be running, and if it was I shouldn't need to usurp it for my tests.  So I moved over to using the RESTful method, which I had a hard time with earlier, but now is so insanely simple I wonder why I had a hard time with it before.

 

Without futher ado, here is the RESTful method to run Fitnesse tests.

 

First I set up my variables, I've also added in an archive file now, so I can keep track of my results, the RESTful results are nice so I actually output each test into its own results file, and I make an aggregate to be an archive.  Eventually I will get rid of the individual results and keep the archive around - this also let's me go onto any machine that ran a test and see how things have been going.  The Arrays I have are suites that I set up in Fitnesse to contain my tests, I have one for QA that I would run, and a Smoke suite that is a selected set to verify the build worked.

 

# Get the current directory

Push-Location .

# Variables for the script

# This location should not change, since its the standard checkout location

[string]$fitnesseLocale = "C:\MAIN\trunk\AutomatedTests\Fitnesse\Fitnesse"

[string]$fitnesseJar = "fitnesse.jar"

# Need to get the local machine here, it will be how Fitnesse runs

[string]$serverName = $env:COMPUTERNAME

[string]$portName = "8080"

# These are needed for the CheckFitnessProcess function,

# placing them here

$fitRunning = $false

# Set Java executable to use within PowerShell

$Java = "java.exe"

# Archive file

$archiveFile = "fitnesseArchive.txt"

# Use a Test Array to be able to bundle all the tests

# Tests that are commented out are having issues being run

# Smoke Testing is Development Based

# although its now geared towards checking Login

$smokeArray = ( "SpringsLoginLiteTests" )

# Tests for the QA environment

# although its now geared towards checking page links

$qaArray = ( "SpringsLinkChecks" )

# Tests to check how this script runs, this is a hidden command

# This just validates the Registration Verify Fields

$checkArray = ( "SpringsTest.UserLoginFfTests" )

# Location of the Test Results, this is hardcoded within the SVN structure

# so it should always be available, I am sure there are better ways of doing this

$testResultsDir = "C:\IHI_MAIN\trunk\AutomatedTests\Fitnesse\Fitnesse\testResults"

if (!(Test-Path -path $testResultsDir))

{

  New-Item $testResultsDir -type directory > $null

}

Then I still run my check on whether Fitnesse is running, it doesn't really need to be running anyway; so I decided that since REST only runs as needed then I was going to shut down Fitnesse if it was going.

 

# CheckFitnesseProcess determines if Fitnesse is running, if Fitnesse is not running

# then the script continues. The current test configuration does not require Fitnesse

# to run and does a better job when it's not.

# Adapted from: http://odetocode.com/Blogs/scott/archive/2006/07/17/5330.aspx

function CheckFitnesseProcess {

  param ([string]$AppPoolName="")

  $ProcessId = $null

  if ($AppPoolName.ToUpper() -ne $NOT_PASSED) {

    [string]$filter = $null

    if ((Get-Process java -ErrorAction SilentlyContinue) -ne $null) {

      Get-Process java | ForEach {

      # use WMI API to get process details

      $filter = "Handle='" + $_.Id + "'"

      $wmip = Get-WmiObject Win32_Process -filter $filter

      # CommandLine property has AppPool name; grab name using contains

      if($wmip.CommandLine.contains("fitnesse")) {

        # Uncomment the next line for debugging

        # Write-Host "Found this java process: $wmip.CommandLine `n"

        $fitRunning = $true

        # Saving the Process ID to stop the process later,

        # using a Global as I could not get this work if I declared

        # the variable at the beginning.

        $Global:fitProcess = $_.Id

      }

    }

  }

  if ($fitRunning -eq $false) {

    # All is good

  }

  if ($fitRunning -eq $true) {

    Write-Host "Fitnesse is running, it's best if its not - shutting it down...`n" -ForegroundColor Red

    # Stop the Fitnesse process

    Stop-Process -Id $fitProcess

  }

 }

}

I'm going to skip the Help function, if you need that it should be in my previous post, the important one is the Main function.

 

function main()

{

  # Need to be in the Fitnesse directory to access TestRunner, and

  # the Fitnesse batch file in case Fitnesse needs to be started

  cd $fitnesseLocale

  #Check and see if Fitnesse is running

  CheckFitnesseProcess

  foreach ($test in $testArray)

  {

    # Start the test

    $myDate = Get-Date

    Write-Host "`nRunning $test`n"

    # Build RESTful URL

    $testLink = $test +"?" + $testType +"&format=text"

    # Get the output from TestRunner so we can scrape it for test passes and fails

    $testResults = & $Java "-jar" "$fitnesseJar" "-c" "$testLink"

    Write-Host "Completed $test`n"

    # Write-Host "Test Results..."

    # Scan through the output, then display the results

    # Dump $testResults out to a File

    $testFile = $test + $myDate.Day + $myDate.Month + $myDate.Year + $myDate.Hour + $myDate.Minute + ".txt"

    $testResults | Out-File "$testResultsDir\$testFile"

    # Print out date to an archive file

    $testDate = "Last run time: " + $myDate.Day + "/" + $myDate.Month + "/" + $myDate.Year + " at " + $myDate.Hour + ":" + $myDate.Minute

    $testDate >> "$testResultsDir\$archiveFile"

    foreach ($line in $testResults)

      {

      if ($line -match "\A\.\s"){

        # This is a Pass

        Write-Host $line -ForegroundColor Green

        # Output to archive file

        $line >> "$testResultsDir\$archiveFile"

      }

      if ($line -match "\AX\s") {

        # This is an Exception, a warning but not a Failure

        Write-Host $line -ForegroundColor Yellow

        # Output to archive file

        $line >>


Last Page | Page 1 of 19 | Next Page