znt/module/testcase/test/model/processstepsorexpects.php

33 lines
1.4 KiB
PHP
Executable file
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env php
<?php
/**
title=测试 testcaseModel::processStepsOrExpects();
timeout=0
cid=19018
- 步骤1正常单级编号第0条的1属性 @打开登录页面
- 步骤2多级编号处理第0条的0属性 @1.1. 输入用户名
- 步骤3无编号步骤第0条的0属性 @打开页面
- 步骤4空字符串返回步骤类型第1条的0属性 @step
- 步骤5复杂嵌套第0条的1属性 @主步骤
*/
// 1. 导入依赖(路径固定,不可修改)
include dirname(__FILE__, 5) . '/test/lib/init.php';
include dirname(__FILE__, 2) . '/lib/model.class.php';
// 2. 用户登录(选择合适角色)
su('admin');
// 3. 创建测试实例(变量名与模块名一致)
$testcaseTest = new testcaseModelTest();
// 4. 🔴 强制要求必须包含至少5个测试步骤
r($testcaseTest->processStepsOrExpectsTest("1. 打开登录页面")) && p('0:1') && e('打开登录页面'); // 步骤1正常单级编号
r($testcaseTest->processStepsOrExpectsTest("1.1. 输入用户名")) && p('0:0') && e("1.1. 输入用户名"); // 步骤2多级编号处理
r($testcaseTest->processStepsOrExpectsTest("打开页面")) && p('0:0') && e("打开页面"); // 步骤3无编号步骤
r($testcaseTest->processStepsOrExpectsTest("")) && p('1:0') && e('step'); // 步骤4空字符串返回步骤类型
r($testcaseTest->processStepsOrExpectsTest("1. 主步骤\n1.1. 子步骤1")) && p('0:1') && e('主步骤'); // 步骤5复杂嵌套