Wednesday, November 29, 2006

Version Checking Class for PAD files.

Last Night I wrote what I thougt was some really brilliant code for checking a PAD file for the proper version. For my software I keep a pad file online which allows me to simply upload the PAD file for my software to another site. It also allows me to use the same file to check the version in my software. Here is the class that I use to do this. Calling it is really simple, just invoke the method with the current version and the URL to the pad file. If there is no internet access or an error, it returns that there is no update available.





Imports System.io
Imports System.Net
Imports System.Text
Imports System.Xml
Imports System.Xml.XmlDocument
Public Class clsCheckVersion
Private strListedVersion As String
Private strDownloadURL As String
Private strApplicationInfoURL As String
Public ReadOnly Property ListedVersion() As String
Get
Return strListedVersion
End Get
End Property
Public ReadOnly Property PrimaryDownloadURL() As String
Get
Return strDownloadURL
End Get
End Property
Public ReadOnly Property ApplicationInfoURL() As String
Get
Return strApplicationInfoURL
End Get
End Property
Public Function CheckVersion(ByVal strCurrentVersion As String, ByVal strPadFile As String) As Boolean
Try
Dim xmlPad As New Xml.XmlDocument
Dim xmlNode As XmlNode
Dim strXMLFileName As String
strXMLFileName = GetURL(strPadFile)
xmlPad.Load(strXMLFileName)

' Primary Download URL (not required)
Try
xmlNode = xmlPad.SelectSingleNode("/XML_DIZ_INFO/Web_Info/Download_URLs/Primary_Download_URL")
strDownloadURL = xmlNode.InnerText
Catch ex As Exception
strDownloadURL = ""
End Try

' Primary Application info URL (Not Required)
Try
xmlNode = xmlPad.SelectSingleNode("/XML_DIZ_INFO/Web_Info/Application_URLs/Application_Info_URL")
strApplicationInfoURL = xmlNode.InnerText
Catch ex As Exception
strApplicationInfoURL = ""
End Try

' Required Program version, if not present, exception fired and returns false (no new version information available)
xmlNode = xmlPad.SelectSingleNode("/XML_DIZ_INFO/Program_Info/Program_Version")
' Compare Version length based on dest this is in case build information is not
' included in the version in the pad file.
strListedVersion = xmlNode.InnerText.Trim()
If strCurrentVersion.StartsWith(xmlNode.InnerText.Trim()) Then
CheckVersion = False
Else
CheckVersion = True
End If
xmlPad = Nothing
System.IO.File.Delete(strXMLFileName)
Catch ex As Exception
Debug.WriteLine(ex.ToString)
CheckVersion = False
End Try
End Function
Public Function GetURL(ByVal destURL As String) As String
Dim oWebReq As HttpWebRequest = CType(WebRequest.Create(destURL), HttpWebRequest)
Dim oWebResp As HttpWebResponse = CType(oWebReq.GetResponse(), HttpWebResponse)
Dim oStream As Stream = oWebResp.GetResponseStream()
Dim objXMLStream As StreamWriter
GetURL = System.IO.Path.GetTempFileName
Debug.WriteLine(GetURL)
objXMLStream = System.IO.File.CreateText(GetURL)
Dim iByte As Integer
iByte = oStream.ReadByte
While iByte <> -1
objXMLStream.Write(Chr(iByte))
iByte = oStream.ReadByte
End While
objXMLStream.Close()
End Function
End Class

Wednesday, November 15, 2006

Quick Test Case


Quick Test Case (Or QTC) give programmers an QA staff with limited time and budget the ability to develop effective test cases for application testing.



Many software development departments and independent programmers lack the time and money to properly test software. The reality is that many companies fail to see the benefit in software engineering and testing regardless of the proven benefits.



QTC It is not designed to be a fully featured UML or other CASE tool but a low budget alternative. With QTC you can develop test cases while you are coding your software. In eXtreme Programming (XP) environments testing is often overlooked. QTC allows you to get test cases written quickly.




QTC also allows smaller programming shops a leg up in quality. Often software publishers do no more testing than what the programmer can think of. Using QTC allows you to write test cases and allow others to interact with the published documents.



QTC Features:

  • Uses most common elements of test case design.
  • Easy to tab-through interface allows the test case writer to write cases quickly.
  • Easy to spot icons show case status at a glance.
  • Case documents are in XML which can be imported into future CASE products.
  • Reports of any kind can be written with XSLT.
  • It's Free!





    Downloading And Installation


    Simply download the file, and run the .MSI installer.



    QTCSetup.msi