(1)被测试的程序段如下:\nbegin\ns1;\nif (x=0) and (y> 2)\nthen s2;\nif (x\u003C1) or (y= 1)\nthen s3;\ns4;\nend\n画出程序流程图采用语句覆盖、条件覆盖和判定覆盖设计测试用例。
时间: 2024-04-10 21:25:12 浏览: 29
根据给出的程序段,我们可以画出以下的程序流程图:
```
+--(x=0) and (y>2)--+
| |
+--v--+ |
| s1; | |
+--+--+ |
| |
v |
+--+--+ |
| (x<1) or | |
| (y=1) | |
+--+--+ |
| |
v |
+--+--+ |
| s4; | |
+--+ |
|
v
+--+
|END|
+--+
```
接下来,我们可以使用语句覆盖、条件覆盖和判定覆盖的方法来设计测试用例。
1. 语句覆盖要求每个语句至少执行一次。根据程序流程图,我们需要设计以下测试用例:
- 输入:x=0, y>2
- 输入:x=0, y<=2
- 输入:x!=0, y>2
- 输入:x!=0, y<=2
2. 条件覆盖要求每个条件的取值至少覆盖一次。根据程序流程图,我们需要设计以下测试用例:
- 输入:x=0, y>2
- 输入:x=0, y<=2
- 输入:x!=0, y>2
- 输入:x!=0, y<=2
3. 判定覆盖要求每个判定的取值至少覆盖一次。根据程序流程图,我们需要设计以下测试用例:
- 输入:x=0, y>2
- 输入:x=0, y<=2
- 输入:x!=0, y>2
- 输入:x!=0, y<=2
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pptx](https://img-home.csdnimg.cn/images/20210720083543.png)
![xlsx](https://img-home.csdnimg.cn/images/20210720083732.png)