图5.5 图书信息登记界面
图书查询界面如图5.6所示。
图5.6 图书信息查询界面
代码如下:
Private Sub cmdQuery_Click()
CheckConnect 'If objRs is open then close it
33
If ConnectToServer = True Then
Set objRs = New ADODB.Recordset If optCheck(0).Value = True Then
'This is check if your query by is null If Trim(txtbookID.Text) = \
MsgBox \ txtbookID.SetFocus Exit Sub End If
StrSql = \ GetData StrSql 'Reverence function to ger data If objRs.RecordCount = 0 Then
MsgBox \book do not exist,please input another books ID or choose another query way !\ txtbookID.Text = \
optCheck(0).Value = False
EnabledSet 'Reference function to set checkbox enabled
CheckConnect 'Reference function if objrs is open then close it
Exit Sub End If
optCheck(0).Value = False
ElseIf optCheck(1).Value = True Then
'This is check if your query way is null If Trim(txtBookName.Text) = \
MsgBox \ txtBookName.SetFocus Exit Sub End If
StrSql = \\
GetData StrSql 'Reference function to get data If objRs.RecordCount = 0 Then
MsgBox \ or choose another query way!\ txtBookName.Text = \ optCheck(1).Value = False
EnabledSet 'Reference function to set checkbox enabled
CheckConnect 'Reference function if objrs is open then close it cmdQuery.Enabled = False Exit Sub
34
End If
optCheck(1).Value = False
ElseIf optCheck(2).Value = True Then 'This is check if your query by is null If Trim(txtBookAuthor.Text) = \
MsgBox \ txtBookAuthor.SetFocus 'Reference function to ger data Exit Sub End If
StrSql = \\
GetData StrSql 'Reference to get data If objRs.RecordCount = 0 Then
MsgBox \author do not exist,please input another author or choose another query way!\ txtBookAuthor.Text = \
EnabledSet 'Reference function to set checkbox enabled
CheckConnect 'Reference function if objrs is open then close it optCheck(2).Value = 0 cmdQuery.Enabled = False Exit Sub End If
optCheck(2).Value = False
ElseIf optCheck(3).Value = True Then 'This is check if your query is null If Trim(txtBookPublisher.Text) = \
MsgBox \ txtBookPublisher.SetFocus 'Reference function to get data Exit Sub End If
StrSql = \& \
GetData StrSql 'Reference function to get data If objRs.RecordCount = 0 Then
MsgBox \publisher do not exist,please input another publisher or choose another query way!\ txtBookPublisher.Text = \ optCheck(3).Value = False
EnabledSet 'Reference function to set checkbox enabled
CheckConnect 'Reference function if objrs is open then close it
35
cmdQuery.Enabled = False Exit Sub End If
optCheck(3).Value = False Else
Exit Sub 'If you don't choice query then exit sub End If
Set dgdResult.DataSource = objRs 'change columns name
dgdResult.Columns(0).Caption = \图书编号\ dgdResult.Columns(1).Caption = \图书名称\ dgdResult.Columns(2).Caption = \号\ dgdResult.Columns(3).Caption = \作者\ dgdResult.Columns(4).Caption = \出版社\ dgdResult.Columns(5).Caption = \类别\ dgdResult.Columns(6).Caption = \价格\ dgdResult.Columns(7).Caption = \藏书数量\ dgdResult.Columns(8).Caption = \库存数量\ 'Bond data to text
txtbookID.Text = objRs.Fields(0).Value txtBookName.Text = objRs.Fields(1).Value txtBookAuthor.Text = objRs.Fields(3).Value txtBookPublisher.Text = objRs.Fields(4).Value End If
cmdQuery.Enabled = False
EnabledSet 'Reference function to set checkbox enabled End Sub
Private Sub Form_Activate()
FormMiddle frmBookQuery 'Reference function to make form in MDIForm'mddile End Sub
36
第六章 测试分析报告
有两种基本方法可以用来标识测试用例,即功能测试(黑盒测试)和结构测试(白盒测试)。本次测试我主要采用了功能测试。
功能测试的基本观点是,任何程序都可以看作是将输入定义域取值映射到输出值域的函数。
6.1 测试计划和要点
软件测试的本质是针对要测试的内容确定一组测试用例。在讨论之前,我先把要测试各个模块的计划和要点列出: 6.1.1 主模块测试要点
数据库连接情况:正常情况,数据库文件缺少,外部系统异常。 系统设置获取:正常情况,外部系统异常。
对用户输入的响应:合法输入,能够正常调用子模块;
非法输入,系统能否辨别,并作出响应(提出警告); 子模块的异常状况,系统能否及时做出响应。
6.1.2 借阅模块测试要点
模块正常运行流程
用户输入数据检查(学生学号、图书书号),包括数据合理性检查,以及合法性检查 数据库操作
数据库连接异常时的响应情况 6.1.3 学生查询模块测试要点
数据库连接正常时 输入合理合法参数
37