Requirements:
Sub Requirements_Req_New
On Error Resume Next
' This sets the default value to current date and time whenever a new Requirement is created.
Req_Fields("RQ_USER_01").Value = Cstr(Now())
On Error GoTo 0
End Sub
Test Plan:
Sub TestPlan_Test_New
On Error Resume Next
' This sets the default value to current date and time whenever the New Test button is pressed.
Test_Fields("TS_USER_01").Value = Cstr(Now())
On Error GoTo 0
End Sub
'Declare a public boolean variable to determine if the New Step button is pressed. public dsstpbtnprss
Function TestPlan_ActionCanExecute(ActionName)
On Error Resume Next
'If the New Step button is pressed, set the public variable to true.
If ActionName = "act_new_step" or ActionName = "act_AddStep" then
dsstpbtnprss = true
end if
TestPlan_ActionCanExecute = Project_DefaultRes
On Error GoTo 0
End Function
Sub TestPlan_EnterModule
On Error Resume Next
'Initialize the public variable to false whenever entering the Test Plan module.
dsstpbtnprss = false
On Error GoTo 0
End Sub
Sub TestPlan_DesignStep_MoveTo
On Error Resume Next
' This sets the default value to current date and time whenever the New Step button is pressed.
if dsstpbtnprss = true then
DesignStep_Fields("DS_USER_01").Value = Cstr(Now())
end if
'Reset the public variable to false.
dsstpbtnprss = false
On Error GoTo 0
End Sub
Test Lab:
Sub TestLab_TestSet_New
On Error Resume Next
' This sets the default value to current date and time whenever the New Test Set button is pressed.
TestSet_Fields("CY_USER_01").Value = Cstr(Now())
On Error GoTo 0
End Sub
Sub TestLab_TestSetTests_FieldChange(FieldName)
On Error Resume Next
' This sets the default value to current date and time whenever the Test is run or whenever the Status field is changed.
If FieldName = "TC_STATUS" then
TestSetTest_Fields("TC_USER_01").Value = Cstr(Now())
end if
On Error GoTo 0
End Sub
Manual Runner:
Function ManualRun_Run_CanPost
On Error Resume Next
' This sets the default value to current date and time whenever the Test is run.
Run_Fields("RN_USER_01").Value = Cstr(Now())
ManualRun_Run_CanPost = Project_DefaultRes
On Error GoTo 0
End Function
Sub ManualRun_Step_FieldChange(FieldName)
On Error Resume Next
' This sets the default value to current date and time whenever the Step Status is changed.
'NOTE: This code will not work if either the "Pass All" or "Fail All" button is pressed.
' This is a limitation in the VBScript Workflow feature.
If FieldName = "ST_STATUS" then
Step_Fields("ST_USER_02").Value = Cstr(Now())
end if
On Error GoTo 0
End Sub
Defects:
Sub Defects_Bug_New
On Error Resume Next
' This sets the default value to current date and time whenever the Add Defect button is pressed.
Bug_Fields("BG_USER_01").Value = Cstr(Now())
On Error GoTo 0
End Sub
NOTE: When adding a new record, the date and time will show up in the user-defined field as "5/1/2001 6:47:28 PM." If only the date is desired, the user-defined field can be configured as type "Date" and the result will appear as "5/1/2001."