Project 2

这篇博客详细介绍了TerpCalc的Standard、Scientific和Graphic三种模式的测试用例设计,包括每个模式下的操作和状态机。同时,也概述了TerpSpreadsheet版本1的基本功能及其测试用例,如文件操作、编辑、格式化、函数应用和打印等。测试脚本被记录并用于验证软件功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

12331002 陈果
12331015 孟泽宇

Task 2: Design test cases for version 1


TerpCalc Version1

TerpCalc有三种模式:

  1. Standard
  2. Graphic
  3. Scientific

每一种模式对应一个window,共三个window


Standard模式

  • operator1
OperatorPerform-a-simple-calculation
ParametersFirst number:[0-9]; button:[+, -, *, /, C]; second number:[0-9]
PreconditionSet the calculator as the initialization state
EffectsGet a result

Test case:
- Calculate 1 + 1
- Calculate 1 - 1
- Calculate 2 * 2
- Calculate 4 / 2
- Calculate 1 / 0
- Calculate 2 * 0

State machine:
这里写图片描述

  • operator2
OperatorUse-the-memory
Parametersnumber:[0-9]; button:[MS, MR, MC, M+]
Preconditionthe memory is empty
Effectsthe number is in the memory or removed from the memory

Test case:
- Input a number and store it in the memory
- Recall the number from the memory
- Remove the number from the memory
- Add a number into the memory

State machine:
这里写图片描述

  • operator3
OperatorPerform-the-square-root-calculation
Parametersnumber:[0-9]; button:[sqrt]
PreconditionSet the calculator as the initialization state
EffectsGet the square root

Test case:
- Calculate sqrt(9)
- Calculate sqrt(-9)
- Calculate sqrt(0)
- Calculate sqrt(1/9)
- Calculate sqrt(-1/9)
- Calculate sqrt(3)

State machine:
这里写图片描述

  • operator4
OperatorFormat-the-number
Parametersnumber:[0-9]; button:[Digital Grouping]
Preconditionnull
Effectsthe number is convert to another format

Test case:
- Input 1234 then format it
- Input 123 then format it

State machine:
这里写图片描述


Scientific模式

  • operator1
OperatorSwitch-between-number-systems
Parametersnumber:[0-9]; button[Bin, Oct, Hex, Dec]
Preconditionnull
Effectsthe number is convert to another format

Test case:
- Input pi, then convert it to other systems.
- Input 9, then convert it to other systems.
- Input 12, then convert it to other systems.
- Input 18, then convert it to other systems.

State machine:
这里写图片描述

  • operator2
OperatorUse-scientific-notation
Parametersnumber:[0-9]; button:[F-E]
Preconditionnull
Effectsthe number is convert to scientific notation

Test case:
- Input -5, then convert it to scientific notation
- Input -0.5, then convert it to scientific notation
- Input 0, then convert it to scientific notation
- Input 0.5, then convert it to scientific notation
- Input 5, then convert it to scientific notation

State machine:
这里写图片描述

  • operator3
OperatorUse-statistics
Parametersnumber:[0-9]
Preconditionnull
Effectsdo some statistic operation

Test case:
- Click “Sta” to open the box
- Click “Dat” to add some number
- Click “Sum” to calculate sum
- Click “Ave” to calculate average
- Click “s” to calculate standard deviation

State machine:
这里写图片描述


Graphic模式

  • operator1
OperatorGraph-a-equation
Parametersnumber:[0-9]; button[+, -, *, /]; button:[graph]
Preconditionnull
Effectsthe equation is graphed

Test case:
- Input 5 * x to get the equation “y = 5 * x”, then click the “GRAPH” button

State machine:
这里写图片描述

  • operator2
OperatorCalculate-the-value-at-a-point
Parametersbutton:[Get Y value]; number:[0-9]
Preconditionthe current window is a graph view
Effectsget the result

Test case:
- Input two boundary and a non-boundary value to calculate

State machine:
这里写图片描述

  • operator3
OperatorZoom-in-or-out
Parametersnumber:[0-9]; button:[xMin, xMax, yMin, yMax]
Preconditionthe current window is a graph view
EffectsThe graph window size is larger or smaller

Test case:
- Input a positive number for xMin, xMax, yMin and yMax, and xMin < xMax, yMin< yMax
- Input a positive number for xMin, xMax, yMin and yMax, and xMin > xMax, yMin >yMax
- Input a positive number for xMin, xMax, yMin and yMax, and xMin = xMax, yMin = yMax
- Input a negative number for xMin, xMax, yMin and yMax
- Input 0 for xMin, xMax, yMin and yMax

State machine:
这里写图片描述

  • operator4
OperatorAdd-or-change-x(y)-label-and-title
Parametersbutton[xLable, yLable, Title]; string:[label, title]
Preconditionthe current window is a graph view
EffectsThe graph has labels and a title

Test case:
- Add labels to both x and y
- Add a title

State machine:
这里写图片描述

  • operator5
OperatorAdd-user-defined-function
Parametersstring:[label]; file:[Function.java]
PreconditionExsit a java file
EffectsThe user defined function is created

Test case:
- Modify the “UserFunctions.java” to define a function

  • operator6
OperatorPrint-the-graph
Parametersbutton:[Print]
Preconditionthe current window is a graph view
Effectsthe graph is printed

Test case:
- Click the “Print” button.

State machine:
这里写图片描述


TerpSpreadsheet Version1

TerpSpreadsheet的基本功能:

  • Menu Bar
    • File: New; Save; Save as; Open; Print; Exit
    • Edit: Cut; Copy; Paste; Clear
    • Format: Column Width; Row Height; Format Cells
    • Functions: Sum; Average; Max; Min; Square Root; Sine; Count
  • Tool Bar
    • 设置字体,大小,粗体,斜体
  • Worksheet
    • 输入字符数字等

Test Cases

  • operator1
OperatorCreat-a-new-file
Parametersbutton:[new]
Preconditionnull
Effectscreat a new file

Test case:
- Click file->new

  • operator2
OperatorOpen-a-file
Parametersbutton:[open]; file:[file.ums]
Preconditionexist a .ums file
Effectsopen the file

Test case:
- Click openfile->file.ums->打开

  • operator3
OperatorSave-file
ParametersString:[filename]
Preconditionnull
EffectsSave the file

Test case:
- Click save(or Ctrl+s)->[filename].ums->保存

  • operator4
OperatorPrint-file
Parametersbutton:[print]; file[file.xps]
Preconditionexist a .xps file
Effectsprint the file

Test case:
- Click Print->Print selected area->xx.xps

  • operator5
OperatorCut-some-area
Parametersbutton:[cut]
Preconditionthere is some text in the window
Effectsthe selected area is cut

Test case:
- Click edit->cut

  • operator6
OperatorCopy-and-paste-some-area
Parametersbutton:[copy, paste]
Preconditionthere is some text in the window
Effectsthe selected area is copyed and paste it to another place

Test case:
- Click edit->cut, then click edit->paste

  • operator7
OperatorTable-a-form
ParametersString:[name]; int:[id, age]
Preconditionnull
Effectscreat a form

Test case:
这里写图片描述

  • operator8
OperatorSum
Parametersint:[age]
Preconditionthere exist a form
Effectsresult the sum of ages

Test case:
- input =sum(c1, c2, c3)

  • operator9
OperatorAverage
Parametersint:[age]
Preconditionthere exist a form
Effectsresult the average of ages

Test case:
- input =Average(c1, c2, c3)

  • operator10
OperatorMax
Parametersint:[age]
Preconditionthere exist a form
Effectsresult the max of ages

Test case:
- - input =Max(c1, c2, c3)

  • operator11
OperatorOverstriking
ParametersString:[name]; button[加粗]
Preconditionthe string didn’t get overstriking before
Effectsthe “name”is bolded than before

Test case:
- select the name and click “加粗”

  • operator12
OperatorSet-the-size
ParametersString:[name]
Preconditionnull
Effectsmake the string bigger

Test case:
- select the name and set the size to 20


Task 3: Record the test scripts for version 1

根据TASK2中设计的测试用例,我们组合了以下几个脚本:
1. 测试TerpCalc Standard模式的功能
2. 测试TerpCalc Scientific模式的功能
3. 测试TerpCalc Graph模式的功能
4. 测试TerpSpreadsheet的文件功能:新建文件->写文件->保存文件
5. 测试TerpSpreadsheet的文件编辑功能:剪切-> 粘贴, 复制->粘贴,删除
6. 测试TerpSpreadsheet的函数功能:sum,average,max,min,square root, sine,count
7. 测试TerpSpreadsheet的打印功能
8. 测试TerpSpreadsheet的字体变化功能

以下是部分脚本的日志截图:

  • 脚本1:
    这里写图片描述
  • 脚本2:
    这里写图片描述
  • 脚本3
    这里写图片描述
  • 脚本5
    这里写图片描述

Task4:Maintain test scripts version 2 and report failures in the test scripts

对于Version2,脚本我们选择重新录制,具体的请查看文件。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值