一起买beta版PHP单元测试
一起买beta版PHP单元测试
测试目的
保证代码质量,对各个单元进行测试,可以有效地保证代码的可靠性,让模块在与别的模块整合时出现更少的错误。
单元描述
完成帖子接口
将“正在进行”帖子状态更改为“已完成”。
获取用户信息接口
获得用户的个人信息。
获取我的帖子接口
获取用户帖子,包括“正在进行”、“已过期”、“已完成”。
类型搜索接口
返回指定类型的帖子。
修改用户信息接口
修改用户的个人信息,包括头像。
管理员登录接口
管理员登入系统。
获得被举报帖子接口
管理员获取被举报的帖子列表。
举报帖子接口
用户举报非法帖子。
删除举报接口
管理员删除用户的某个举报。
更新帖子接口。
用户修改帖子信息。
过期设置接口
把过期的帖子状态设置成已过期。
获取用户相关帖子接口
获取我的收藏和我的足迹。
测试过程
- 完成帖子测试
use PHPUnit\Framework\TestCase;
require_once 'FinishPosts.class.php';
class FinishPostsTest extends TestCase
{
public function testFinishPosts()
{
$test = new FinishPosts();
$test->finishTest(1);
}
}
测试结果:

- 获取用户信息测试
use PHPUnit\Framework\TestCase;
require_once 'GetUser.class.php';
class GetUserTest extends TestCase
{
public function testGetUser()
{
$test = new GetUser();
$test->getUserTest("linlin");
}
}
测试结果:

- 获取我的帖子测试
use PHPUnit\Framework\TestCase;
require_once 'MyPosts.class.php';
class MyPostsTest extends TestCase
{
public function testMyPosts()
{
$test = new MyPosts();
$test->myTest("linlin","正在进行");
}
}
测试结果:

- 类型帖子返回(类型搜索)测试
use PHPUnit\Framework\TestCase;
require_once 'TypeSearch.class.php';
class TypeSearchTest extends TestCase
{
public function testTypeSearch()
{
$test = new TypeSearch();
$test->typeTest("食品",0,5);
}
}
测试结果:

- 修改用户信息测试
use PHPUnit\Framework\TestCase;
require_once 'UpdateUser.class.php';
class UpdateUserTest extends TestCase
{
public function testUpdateUser()
{
$test = new UpdateUser();
$test->templateTest("linlin","boy","boss","1995-04-09","fzu","cs","","say:yes");
}
}
测试结果:

- 管理员登录测试
use PHPUnit\Framework\TestCase;
require_once 'AdminLogin.class.php';
class AdminLoginTest extends TestCase
{
public function testAdminLogin()
{
// $this->assertTrue(true);
$test = new AdminLogin();
$test->adminLoginTest("b","b");
}
}
测试结果:

- 获得被举报帖子测试
use PHPUnit\Framework\TestCase;
require_once 'GetReportedList.class.php';
class GetReportedListTest extends TestCase
{
public function testGetReported()
{
// $this->assertTrue(true);
$test = new GetReportedList();
$test->getListTest(1,3);
}
}
测试结果:

- 举报帖子测试
use PHPUnit\Framework\TestCase;
require_once 'ReportMessage.class.php';
class ReportMessageTest extends TestCase
{
public function testReportMessage()
{
$test = new ReportMessge();
$test->reportMessageTest(8);
}
}
测试结果:

- 删除举报测试
use PHPUnit\Framework\TestCase;
require_once 'ReportIgnore.class.php';
class ReportIgnoreTest extends Testcase
{
public function testReportIgnore()
{
$test = new ReportIgnore();
$test->ignoreTest(3);
}
}
测试结果:

- 更新帖子测试
use PHPUnit\Framework\TestCase;
require_once 'UpdatePosts.class.php';
class UpdatePostsTest extends TestCase
{
public function testUpdatePosts()
{
$test = new UpdatePosts();
$test->updateTest(2,"buysomething","","食品","bread",12.1,"piece",3,1,1,"willyoubuy","qq123321");
}
}
测试结果:

- 过期设置接口
<?php
use PHPUnit\Framework\TestCase;
require_once 'OverTimeSet.class.php';
class OverTimeSetTest extends TestCase
{
public function testOverTimeSet()
{
$test = new OverTimeSet();
$test->OverTimeSetTest(1);
}
}
测试结果:

- 获取用户相关帖子测试
use PHPUnit\Framework\TestCase;
require_once 'GetStatePosts.class.php';
class GetStatePostsTest extends TestCase
{
public function testGetStatePosts()
{
$test = new GetStatePosts();
$test->getStatePosts("linlin",1);
}
}
测试结果:

结果统计
十二个模块的测试,十二个模块无出现错误。
质量评估
总体上,模块并没有出错什么致命错误。
测试总结
更新帖子模块出现bug,是由于本地的操作系统为Windows7,和实际服务器的系统Ubuntu处理文件的方式不一致,因此,在图片文件的处理上,无法应用到本地的windows7系统,故有报错。这种情况下,就采用实际测试,测试结果该模块也可以正常使用。
在测试过程中,遇到了个难以解决且最终没有解决的问题——dos窗口无法正常显示返回的中文字符!百度无果后就放弃了。实际测试,中文显示正常。
觉得单元测试比起以前用postman之类工具测试的时候,觉得最大的益处就是在改以前代码的时候会感受的作用,而且还能指出哪里出了问题,很棒。
一起买beta版PHP单元测试的更多相关文章
- 一起买beta版模块单元测试
一起买beta版模块接口单元测试 测试目的 保证代码质量,对各个模块进行单元测试,不仅可以有效地保证代码的可靠性,让模块在与别的模块整合时出现更少的错误. 而且不用每次启动程序而等待浪费时间. 单元描 ...
- 一起买beta版本文档报告汇总
一起买beta版本文档报告汇总 031402401鲍亮 031402402曹鑫杰 031402403常松 031402412林淋 031402418汪培侨 031402426许秋鑫 一.Beta版本冲 ...
- 一起买beta版UI测试
一起买beta版UI测试 测试目的 保证代码质量,对各个单元进行测试,可以有效地保证代码的可靠性,让模块在与别的模块整合时出现更少的错误. UI测试 登录模块测试 登录模拟过程. 发帖模块测试 ...
- 一起买Beta版本系列文档
一起买beta版本文档报告汇总 031402401鲍亮 031402402曹鑫杰 031402403常松 031402412林淋 031402418汪培侨 031402426许秋鑫 一.Beta版本冲 ...
- 旅图beta版 asp.net web api 单元测试
旅图 beta版 asp.net web api 单元测试 测试接口:http://120.27.7.115:1010/Help 测试目的 对每个接口单元进行测试,保证每个接口的可靠性. 单元描述 注 ...
- XE8 & IOS开发之免费证书真机调试:开发证书、AppID、开发授权profile的申请,附Debug真机调试演示(XCode7 Beta版或以上版本适用,有图有真相)
网上能找到的关于Delphi XE系列的移动开发的相关文章甚少,本文尽量以详细的图文内容.傻瓜式的表达来告诉你想要的答案. 原创作品,请尊重作者劳动成果,转载请注明出处!!! 注意,苹果发布Xcode ...
- 《Bluez 》Beta版强势回归!!!
Bluez .Beta 巅峰塔防 强势回归! Z.XML为您呈现 经过了第二轮迭代,我们骄傲的宣布,Bluez Beta版本,正式发布. 下载地址:-> 第二轮的迭代是辛苦的,但是不同于其他队伍 ...
- 福大软工 · BETA 版冲刺前准备(团队)
BETA 版冲刺前准备 队名:第三视角 作业链接 组长博客 应作业要求为了更加顺利地开展beta版本的冲刺,上次的alpha版本展示后,我们组对之前开发过程中存在的各种问题进行了全面的讨论,并对其进行 ...
- Home 安转beta版软件
今天想装测试版的cocoapods,用 brew install cocoapods 后,总是安装稳定版,就是1.1.0,不是最新的beta版,发现用下面这个命令可以装最新beta版 brew ins ...
随机推荐
- iOS各种调试技巧豪华套餐
转载自http://www.cnblogs.com/daiweilai/p/4421340.html 目录 前言 逼优鸡 知己知彼 百战不殆 抽刀断Bug 普通操作 全局断点(Global Break ...
- 使用ssh连接远程主机
在linux系统中,ssh是远程登录的默认工具,因为该工具的协议使用了RSA/DSA的加密算法.该工具做linux系统的远程管理是非常安全的. ssh登录远程主机(服务器)一般有两种方式:无密钥方式 ...
- C++拼接字符串
例如: 在"/data/misc/media/out.yuv"后面添加序号操作,并输出在path char path[128] = {0}; int Num=this->mN ...
- Winform DataGridView控件添加行号
有很多种方法,这里介绍三种: A: 控件的RowStateChanged事件中添加,RowStateChanged事件是在行的状态更改(例如,失去或获得输入焦点)时发生的事件: e.Row.Hea ...
- jmeter执行顺序
- seaJS循环依赖的解决原理
seajs模块的六个状态. var STATUS = { 'FETCHING': 1, // The module file is fetching now. 模块正在下载中 'FETCHED': ...
- linux+php+apache web调用python脚本权限问题
lamp : linux + apache + mysql + php 在近期项目中使用 linux + apache + php调用python脚本是出现以下权限问题: build/bdist.li ...
- APS.net controller
在controller 路由配置为: routes.MapRoute( name:"Default", url:"{controller}/{action}/{id}&q ...
- 谈谈springMVC和Strut2的理解
关于struts2框架原理 执行流程 struts2框架的核心是一个过滤器,我们编写的action类都继承ActionSupport的接口(顶层是一个过滤器filter),用户发送请求,经过核心过滤器 ...
- IELTS Writing Tips