Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
seniors Please help---New to QTP and forum---Datatable question
#3
Not Solved
This is very crude I left all the comments in and invalid tests for you to see how i've tested the code.

Code:
'test valid input
InValue="0000123_200908_201208.xml"
'test dates same
'InValue="0000123_200908_200908.xml"
'test invalid Year
'InValue="0000123_200908_200808.xml"
'test same year invalid month
'InValue="0000123_200908_200907.xml"
'test invalid first string legth
'InValue="000123_200908_201207.xml"

'split string to remove .xml
NewInValue=Split(InValue,".")
NewString=NewInValue(0)
'msgbox(NewString)

'load into an array to split the Strings by '_"
splitValues=Split(NewString,"_")

FirstSeven=splitValues(0)
'msgbox(FirstSeven)

FirstDate=splitValues(1)
'msgbox(FirstDate)

SecondDate=(splitValues(2))
'msgbox(SecondDate)

'check the length of the string
LenthFirstSeven=Len(FirstSeven)
'msgbox(LenthFirstSeven)
If LenthFirstSeven = 7 Then
  Reporter.ReportEvent micPass, "StringLength", "The String length was "&LenthFirstSeven&""
Else
  Reporter.ReportEvent micfail, "StringLength", "The String length was "&LenthFirstSeven&""  
End If

FirstYear=left(FirstDate,4)
'msgbox(FirstYear)
Firstmonth=right(FirstDate,2)
'msgbox(firstmonth)


SecondYear=left(SecondDate,4)
'msgbox(SecondYear)
Secondmonth=right(SecondDate,2)
'msgbox(Secondmonth)

If FirstYear > SecondYear Then
Reporter.ReportEvent micfail, "DateCheck", "The First Year Was Greater than the Second Year"
Elseif FirstYear < SecondYear then
Reporter.ReportEvent micPass, "DateCheck", "The First Year Was Less than the Second Year"
Elseif FirstYear = SecondYear then
    If Firstmonth > Secondmonth Then
        Reporter.ReportEvent micfail, "DateCheck", "The First Year Equal to Second Year, First Month was greater than second month"
    ElseIf Firstmonth < Secondmonth Then
        Reporter.ReportEvent micPass, "DateCheck", "The First Year Equal to Second Year, First Month was Less than second month"    
    Else
        Reporter.ReportEvent micfail, "DateCheck", "The Dates are the same"    
    End If
End If
Reply


Messages In This Thread
RE: seniors Please help---New to QTP and forum---Datatable question - by Jackomcnabb - 05-28-2009, 05:58 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  The most reputed and oldest Q & A forum on HP Unified Functional Testing tool (earlie qtptouft 0 1,261 09-30-2015, 01:52 PM
Last Post: qtptouft
  Hello All -Nice forum to start learning QTP. Few questions QTP.learning 0 1,806 05-18-2014, 04:10 PM
Last Post: QTP.learning
  Question about QTP tutorial - Yousuf 1 2,500 11-15-2013, 09:25 PM
Last Post: Yousuf
  qtp interview question raaj123 2 2,289 01-21-2013, 03:12 PM
Last Post: Ankesh
  Datatable add and datatable import sheet wheelercha 4 33,366 06-14-2012, 04:53 PM
Last Post: Arul

Forum Jump:


Users browsing this thread: 1 Guest(s)