package findyou.testcase;
import java.io.IOException;
import org.testng.Assert;
import org.testng.Reporter;
import org.testng.annotations.Test;
import findyou.Interface.Common;
import findyou.Interface.getCityWeather;
public class test {
public String httpResult= null, weatherinfo= null, city=null,exp_city = null;
public static String cityCode="";
getCityWeather weather=new getCityWeather();
@Test(groups = { "BaseCase"})
public void getShenZhen_Succ() throws IOException{
exp_city="深圳";
cityCode="101280601";
Reporter.log("【正常用例】:获取"+exp_city+"天气成功!");
httpResult=weather.getHttpRespone(cityCode);
Reporter.log("请求地址: "+weather.geturl());
Reporter.log("返回结果: "+httpResult);
weatherinfo=Common.getJsonValue(httpResult, "weatherinfo");
city=Common.getJsonValue(weatherinfo, "city");
Reporter.log("用例结果: resultCode=>expected: " + exp_city + " ,actual: "+ city);
Assert.assertEquals(city,exp_city);
}
@Test(groups = { "BaseCase"})
public void getBeiJing_Succ() throws IOException{
exp_city="北京";
cityCode="101010100";
Reporter.log("【正常用例】:获取"+exp_city+"天气成功!");
httpResult=weather.getHttpRespone(cityCode);
Reporter.log("请求地址: "+weather.geturl());
Reporter.log("返回结果: "+httpResult);
weatherinfo=Common.getJsonValue(httpResult, "weatherinfo");
city=Common.getJsonValue(weatherinfo, "city");
Reporter.log("用例结果: resultCode=>expected: " + exp_city + " ,actual: "+ city);
Assert.assertEquals(city,exp_city);
}
@Test(groups = { "BaseCase"})
public void getShangHai_Succ() throws IOException{
exp_city="上海";
cityCode="101020100";
Reporter.log("【正常用例】:获取"+exp_city+"天气成功!");
httpResult=weather.getHttpRespone(cityCode);
Reporter.log("请求地址: "+weather.geturl());
Reporter.log("返回结果: "+httpResult);
weatherinfo=Common.getJsonValue(httpResult, "weatherinfo");
city=Common.getJsonValue(weatherinfo, "city");
Reporter.log("用例结果: resultCode=>expected: " + exp_city + " ,actual: "+ city);
Assert.assertEquals(city,exp_city);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
httpAPITest.rar (29个子文件)
httpAPITest
.project 856B
src
META-INF
MANIFEST.MF 39B
findyou
Interface
getCityWeather.java 1KB
URLConnection.java 864B
Common.java 685B
testcase
test.java 2KB
test1.java 1KB
.settings
org.eclipse.wst.common.project.facet.core.xml 229B
org.eclipse.jdt.core.prefs 598B
org.eclipse.wst.common.component 239B
libs
jettison.jar 54KB
velocity-dep-1.4.jar 506KB
guice-4.0.jar 653KB
reportng-1.1.4.jar 42KB
test-output
html
index.html 556B
reportng.css 5KB
sorttable.js 17KB
overview.html 2KB
suite1_groups.html 931B
suite1_test1_results.html 3KB
output.html 3KB
suites.html 1KB
reportng.js 762B
.classpath 691B
bin
META-INF
MANIFEST.MF 39B
findyou
Interface
URLConnection.class 1KB
getCityWeather.class 2KB
Common.class 1KB
testcase
test.class 2KB
共 29 条
- 1
资源评论
- mzj20772017-05-09还不错,可以参考
- IACLC2017-08-17谢谢分享,正在导入,看看怎么用
- DongShuai6662018-08-08一般般一般般
- 简单_testing2018-03-25谢谢分享,正在导入
silsin
- 粉丝: 4
- 资源: 6
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功