Commit 68e97ea1 by Li Yongyu

update frame

parent 2c58ee57
......@@ -9,7 +9,7 @@
<property name="srcdir" location="src" />
<property name="libdir" location="lib" />
<property name="full-compile" value="true" />
<property name="basedir" value="D:/workspace/auto_test/" />
<property name="basedir" value="." />
<path id="classpath.test">
<fileset dir="${libdir}">
......@@ -62,9 +62,8 @@
</target>
<target name="testoutput" depends="runtest">
<java classname="com.offcn.TestUnti.Mail" classpath="${basedir}/bin">
<sysproperty key="file.encoding" value="UTF-8" />
<java classname="com.offcn.TestUnti.MyNewMail" classpath="${basedir}/bin" classpathref="classes">
<sysproperty key="file.encoding" value="UTF-8"/>
<classpath>
<pathelement location="lib/javax.mail.jar" />
</classpath>
......
<project name="auto_test" default="testoutput" basedir=".">
<!-- Define <testng> task -->
<taskdef name="testng" classname="org.testng.TestNGAntTask" >
<classpath>
<pathelement location="lib/testng-6.8.6.jar" />
</classpath>
</taskdef>
<property name="testoutputdir" location="test-output" />
<property name="srcdir" location="src" />
<property name="libdir" location="lib" />
<property name="full-compile" value="true" />
<property name="basedir" value="D:/workspace/auto_test/" />
<path id="classpath.test">
<fileset dir="${libdir}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${testoutputdir}" />
<pathelement location="${srcdir}" />
</path>
<target name="clean">
<delete dir="${basedir}/bin" />
</target>
<target name="compile" depends="clean">
<mkdir dir="${basedir}/bin" />
<javac srcdir="${srcdir}" encoding="UTF-8" destdir="${basedir}/bin" verbose="${full-compile}" classpathref="classpath.test" includeantruntime="off" debug="on" debuglevel="lines,vars,source" />
</target>
<path id="classes">
<fileset dir="${libdir}" includes="*jar"/>
<fileset dir="${libdir}" includes="*zip"/>
<pathelement location="${basedir}/bin/"/>
</path>
<!--如果testng里面没有配置reportng监听器,则使用这个方式,如果testng里面配置了 reportng监听器,那么就使用这个配置
<target name="runtest" depends="compile">
<testng outputdir="${testoutputdir}" classpathref="classes"
useDefaultListeners="false"
delegateCommandSystemProperties="true" haltOnFailure="true"
listeners="org.uncommons.reportng.HTMLReporter,org.uncommons.reportng.JUnitXMLReporter,org.testng.reporters.FailedReporter">
<sysproperty key="file.encoding" value="UTF-8" />
<xmlfileset dir="${basedir}" includes="testng.xml" />
</testng>
</target>-->
<!--如果testng里面配置了 reportng监听器,那么就使用这个配置-->
<target name="runtest" depends="compile">
<!---->
<testng outputdir="${testoutputdir}" classpathref="classes"
useDefaultListeners="false" >
<sysproperty key="file.encoding" value="UTF-8" />
<xmlfileset dir="${basedir}" includes="testng.xml" />
</testng>
</target>
<target name="testoutput" depends="runtest">
<java classname="com.offcn.TestUnti.Mail" classpath="${basedir}/bin">
<sysproperty key="file.encoding" value="UTF-8" />
<classpath>
<pathelement location="lib/javax.mail.jar" />
</classpath>
</java>
<!--
ui自动化测试报告部分
<xslt in="${testoutputdir}/testng-results.xml" style="${testoutputdir}/testng-results.xsl" out="${testoutputdir}/index.html ">
<param name="testNgXslt.outputDir" expression="${basedir}/testoutput/" />
<classpath refid="classpath.test" />
</xslt>
-->
</target>
</project>
......@@ -6,7 +6,7 @@
<classes>
<class name="com.puhui.test.RenMai_APITest">
<methods>
<include name="f" invocation-numbers="0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 39 40 41 42 43 44 "/>
<include name="f" invocation-numbers="0 1 2 3 "/>
</methods>
</class>
</classes>
......
......@@ -6,6 +6,7 @@ import com.offcn.TestUnti.ReadExcels;
import com.offcn.TestUnti.ReadProperties;
public class offcn_api_testData {
public static int Testcount=0;//总得用力数量
@DataProvider(name="renmai")
public static Object[][] dp(){
......
......@@ -52,6 +52,7 @@ public class HttpRequest {
try {
// String urlNameString = url ;
String urlNameString = url + "?" + param;
// System.out.println(urlNameString);
URL realUrl = new URL(urlNameString);
// 打开和URL之间的连接
URLConnection connection = realUrl.openConnection();
......
......@@ -2,8 +2,12 @@ package com.offcn.TestUnti;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
......@@ -14,19 +18,58 @@ import net.sf.json.JSONObject;
public class MapUtil {
public static void main(String[] args) {
//"id":code,"status":"0"
String string=getParameter("\"id\":code,\"status\":\"0\"","id");
System.out.println(string);
// HashMap<String, Object> hm=new HashMap<String, Object>();
// hm.put("1", "a1");
// hm.put("statusCode", "a2");
// hm.put("3", "a3");
// hm.put("errcode", "a4");
// hm.put("5", "a5");
// hm.put("errmsg", "a6");
// HashMap<String, Object> newhm=Expect(hm);
// System.out.println("@AfterClass_data_ext="+JSONObject.fromObject(newhm).toString());
HashMap<String, Object> hm=new HashMap<String, Object>();
hm.put("1", "a1");
hm.put("statusCode", "a2");
hm.put("3", "a3");
hm.put("errcode", "a4");
hm.put("5", "a5");
hm.put("errmsg", "a6");
HashMap<String, Object> newhm=Expect(hm);
System.out.println("@AfterClass_data_ext="+JSONObject.fromObject(newhm).toString());
}
//降序排序
public static <K, V extends Comparable<? super V>> Map<K, V> sortByValueDescending(Map<K, V> map)
{
List<Map.Entry<K, V>> list = new LinkedList<Map.Entry<K, V>>(map.entrySet());
Collections.sort(list, new Comparator<Map.Entry<K, V>>()
{
@Override
public int compare(Map.Entry<K, V> o1, Map.Entry<K, V> o2)
{
int compare = (o1.getValue()).compareTo(o2.getValue());
return -compare;
}
});
Map<K, V> result = new LinkedHashMap<K, V>();
for (Map.Entry<K, V> entry : list) {
result.put(entry.getKey(), entry.getValue());
}
return result;
}
//升序排序
public static <K, V extends Comparable<? super V>> Map<K, V> sortByValueAscending(Map<K, V> map)
{
List<Map.Entry<K, V>> list = new LinkedList<Map.Entry<K, V>>(map.entrySet());
Collections.sort(list, new Comparator<Map.Entry<K, V>>()
{
@Override
public int compare(Map.Entry<K, V> o1, Map.Entry<K, V> o2)
{
int compare = (o1.getValue()).compareTo(o2.getValue());
return compare;
}
});
Map<K, V> result = new LinkedHashMap<K, V>();
for (Map.Entry<K, V> entry : list) {
result.put(entry.getKey(), entry.getValue());
}
return result;
}
//马洪亮
// 生成数组格式的json串
public static String getArrayJson(String para) {
......@@ -213,11 +256,7 @@ public class MapUtil {
StringBuffer sb=new StringBuffer();
for(int k=0;k<comma;k++){
//此时是多个,,,
String[] str=strcomma[k].split("\":\"");
if(str.length==1){
str=strcomma[k].split(":");
}
String[] str=strcomma[k].split(":");
String str_strcomma=Arrays.toString(str);
// System.out.println("str="+Arrays.toString(str));
//按参数传过来的字符串做为子串,在以逗号为节点的串中分别查找子串的关键字,
......@@ -240,9 +279,8 @@ public class MapUtil {
int comma=strcomma.length;
StringBuffer sb=new StringBuffer();
for(int k=0;k<comma;k++){
String str_strcomma_s=strcomma[k].split("=")[0];
String str_strcomma=strcomma[k];
if(str_strcomma_s.equals(Letter)){
if(str_strcomma.contains(Letter)){
int start=str_strcomma.indexOf('=');
sb.append(str_strcomma.substring(start+1,str_strcomma.length()));
return sb.toString();
......
......@@ -15,6 +15,8 @@ import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import com.offcn.TestData.offcn_api_testData;
public class ReadExcels {
private String fileName;
private String SheetName;
......@@ -64,6 +66,9 @@ public class ReadExcels {
list.add(getCellValue(cell));
}
}
offcn_api_testData.Testcount=arrmap.length;//保存总体的用例数量
Log.logInfo("数据源读取记录:共有几列数据="+list.size());
Log.logInfo("数据源读取记录:共有几行数据="+arrmap.length);
for(int i = 1 ; i < sheet.getPhysicalNumberOfRows() ; i++){
......
......@@ -17,7 +17,7 @@ import java.util.zip.ZipOutputStream;
* @author ZENG.XIAO.YAN
* @date 2017年11月19日 下午7:16:08
* @date 2017年11月19日 下午7:16:0811
* @version v1.0
......@@ -289,9 +289,10 @@ public class ZipUtils {
public static boolean ZipTestResult(String mailpath){
deleteFile(mailpath+"测试报告详细资料.zip");//删除文件
List<File> fileList = new ArrayList<>();
// fileList.add(new File(mailpath));
fileList.add(new File(mailpath+"index.html"));
fileList.add(new File(mailpath+"overview.html"));
fileList.add(new File(mailpath+"reportng.css"));
......@@ -314,4 +315,20 @@ public class ZipUtils {
}
public static boolean deleteFile(String fileName) {
File file = new File(fileName);
// 如果文件路径所对应的文件存在,并且是一个文件,则直接删除
if (file.exists() && file.isFile()) {
if (file.delete()) {
System.out.println("删除单个文件" + fileName + "成功!");
return true;
} else {
System.out.println("删除单个文件" + fileName + "失败!");
return false;
}
} else {
System.out.println("删除单个文件失败:" + fileName + "不存在!");
return false;
}
}
}
package com.offcn.TestUnti;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import com.offcn.listener.SkipIInvokedMethodListener;
public class fileUntil {
public static void main(String[] args) {
try {
readFile_("caseOut.txt");
// WriterFile("12345");
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public static String readFile_(String filename)throws IOException{
File directory = new File(".");
String sourceFile = directory.getCanonicalPath() +File.separator+"src"+File.separator+"resources"+File.separator+filename;
FileInputStream fis = new FileInputStream(sourceFile);
byte[] buf = new byte[1024];
int len = 0;
StringBuffer sb=new StringBuffer();
while((len=fis.read(buf))!=-1){
sb.append(new String(buf,0,len));
// System.out.println(new String(buf,0,len));
}
fis.close();
return sb.toString();
}
public boolean WriterFile(List<Set<String>> listt){
File directory = new File(".");
String sourceFile;
try {
sourceFile = directory.getCanonicalPath() +File.separator+"src"+File.separator+"resources"+File.separator+"case.txt";
BufferedWriter bw=new BufferedWriter(new FileWriter(sourceFile));
String cases="";
for(int i=0;i<listt.size();i++){
Object[] obj=listt.get(i).toArray();
cases=Arrays.toString(obj).trim();
cases=cases.substring(1, cases.length()-1);
bw.write(cases);
bw.newLine();
}
bw.flush();
bw.close();
return true;
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
public static boolean WriterFile_map(Integer Percentage){
File directory = new File(".");
String sourceFile;
try {
sourceFile = directory.getCanonicalPath() +File.separator+"src"+File.separator+"resources"+File.separator+"map.txt";
BufferedWriter bw=new BufferedWriter((new OutputStreamWriter(new FileOutputStream(sourceFile),"utf-8")));
String cases="";
SkipIInvokedMethodListener.serviceUrlMap=(HashMap<String,Integer>)MapUtil.sortByValueDescending(SkipIInvokedMethodListener.serviceUrlMap);
Set<String> keySet = SkipIInvokedMethodListener.serviceUrlMap.keySet();
//有了Set集合。就可以获取其迭代器。
Iterator<String> it = keySet.iterator();
boolean sm=true;
while(it.hasNext()){
String key = it.next();
if(sm){
cases="<font size='4' color='#FF0000'>流程错误列表</font><table border='1'><th>URL</th><th>错误次数</th>";
bw.write(cases);
bw.newLine();
sm=false;
}
//有了键可以通过map集合的get方法获取其对应的值。
Integer value = SkipIInvokedMethodListener.serviceUrlMap.get(key);
cases="<tr><td>"+key+"</td><td>错误了"+value+"次。</td></tr>";
bw.write(cases);
bw.newLine();
}
if(!sm){
cases="</table>";
bw.write(cases);
bw.newLine();
}
boolean asd=true;
Set<String> keySet1 = SkipIInvokedMethodListener.SkipMap.keySet();
//有了Set集合。就可以获取其迭代器。
Iterator<String> it1 = keySet1.iterator();
while(it1.hasNext()){
String key1 = it1.next();
//有了键可以通过map集合的get方法获取其对应的值。
String value1 = SkipIInvokedMethodListener.SkipMap.get(key1);
String[] valuearr=value1.split("____");
double v1=Double.valueOf(valuearr[0]);
value1=valuearr[1];
if(v1>Percentage){
if(asd){
cases="<font size='4' color='#FF0000'>场景错误列表</font><table border='1'><th>包含错误的场景名称</th><th>场景包含错误案例数量</th><th>错误占比</th>";
bw.write(cases);
bw.newLine();
asd=false;
}
cases="<tr><td><font size='3' color='#0000CD'>"+key1+"</font></td>"
+ "<td><font size='3' color='#0000CD'>"+value1+"</font></td>"
+ "<td><font size='3' color='#0000CD'>"+v1+"%</font></td></tr>";
bw.write(cases);
bw.newLine();
}
}
if(!asd){
cases="</table>";
bw.write(cases);
bw.newLine();
}
bw.flush();
bw.close();
return true;
} catch (IOException e) {
e.printStackTrace();
}
return false;
}
/**
* BufferedReader bufr = new BufferedReader(fr);
String line = null;
while((line=bufr.readLine())!=null)
{
System.out.print(line);
}
bufr.close();
*/
public static String readFile_line(String filename)throws IOException{
File directory = new File(".");
String sourceFile = directory.getCanonicalPath() +File.separator+"src"+File.separator+"resources"+File.separator+filename;
BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(sourceFile),"utf-8"));
BufferedReader bufr = new BufferedReader(in);
String line = null;
StringBuffer sb=new StringBuffer();
while((line=bufr.readLine())!=null)
{
sb.append(line);
}
bufr.close();
in.close();
return sb.toString();
}
}
......@@ -3,6 +3,9 @@ package com.offcn.api.nwn.process;
import io.restassured.path.json.JsonPath;
import io.restassured.response.Response;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
......@@ -53,6 +56,9 @@ public class code extends NWN implements API {
public String handleOutput(Response re, HashMap<String, Object> data) {
String body=re.asString();
// InputStream input = new FileInputStream(file);
StringBuffer buffer = new StringBuffer();
boolean result = true;
String failReason = "";
......@@ -74,10 +80,7 @@ public class code extends NWN implements API {
}else{
System.out.println(re.asString());
// System.out.println(MapUtil.showMap_String(re.getCookies()));
// System.out.println(re.getHeaders().toString());
// admin_login_ssid=re.getCookie("admin_login_ssid");
// admin_31_encode=re.getCookie("admin_31_encode");
}
}
......
......@@ -73,7 +73,7 @@ public class login extends NWN implements API {
Map<String,String> m=new HashMap<String,String>();
m.put("user_name", user_name);
m.put("password", password);
m.put("code", nwn_sign);
// m.put("code", nwn_sign);
Response re = RequestDataUtils.post_form_data(data,"", Url+".html?action=login",m);
return re;
......
......@@ -64,6 +64,7 @@ public class sign extends NWN implements API {
public Response SendRequest(HashMap<String, Object> data, String Url,
String Request) {
Response re = RequestDataUtils.Get_token(data, Url, "");
return re;
}
......
......@@ -103,7 +103,7 @@ public class addStudent extends NWN implements API {
String Request) {
System.out.println("url ===" + Url);
System.out.println("parameter ===" + parameter);
Response re = HttpRequest.sendGet("http://beta.alitest.eoffcn.com"
Response re = HttpRequest.sendGet("http://nwn.t.eoffcn.com"
+ Url, parameter);
/*
......
......@@ -68,7 +68,7 @@ public class checkVideoUrl extends NWN implements API {
rs_bankcard.last();
package_id = rs_bankcard.getString("package_id");
System.out.println("package_id=== "+ package_id);
System.out.println("n_package_idList=== "+ n_package_idList.get(0));
//System.out.println("n_package_idList=== "+ n_package_idList.get(0));
if (package_id.equals(n_package_idList.get(0))) {
System.out.println("successful");
}else {
......
package com.offcn.listener;
import org.testng.ITestContext;
import org.testng.ITestListener;
import org.testng.ITestResult;
import com.offcn.TestUnti.ReadProperties;
import com.offcn.TestUnti.fileUntil;
public class MyTestListener implements ITestListener{
public static Integer SkippedCount=0;
@Override
public void onFinish(ITestContext arg0) {
String Percentage=ReadProperties.GetTestPropertyByKey("Percentage");
Integer Percentage_Integer=Integer.valueOf(Percentage);
fileUntil.WriterFile_map(Percentage_Integer);
}
@Override
public void onStart(ITestContext arg0) {
}
@Override
public void onTestFailedButWithinSuccessPercentage(ITestResult arg0) {
}
@Override
public void onTestFailure(ITestResult arg0) {
}
@Override
public void onTestSkipped(ITestResult arg0) {
SkippedCount++;
}
@Override
public void onTestStart(ITestResult arg0) {
}
@Override
public void onTestSuccess(ITestResult arg0) {
}
}
package com.offcn.listener;
import java.math.BigDecimal;
import java.util.Arrays;
import java.util.HashMap;
import org.testng.IInvokedMethod;
import org.testng.IInvokedMethodListener;
import org.testng.ITestResult;
import org.testng.SkipException;
import com.offcn.TestData.offcn_api_testData;
import com.offcn.TestUnti.Log;
public class SkipIInvokedMethodListener implements IInvokedMethodListener{
//需求1,流程错误案例
public static String Parameter_TCNO="";//当前场景名称
public static String Parameter_ServiceUrl="";//错误的流程url
public static HashMap<String,Integer> serviceUrlMap= new HashMap<String,Integer>();
public static boolean Success=true;//场景测试的状态,发生错误false,未发生错误true
//需求2,模块错误案例占比,数量
public static Integer Parameter_TCNO_count=0;//存在错误的场景总数
public static Integer SkipTestnumber=0;//错误用例次数
public static HashMap<String,String> SkipMap= new HashMap<String,String>();//错误比例
//测试结果是成功还是失败还是跳过
public static Integer resultStatus=0;
//运行之前
@Override
public void beforeInvocation(IInvokedMethod Method, ITestResult result) {
//获取方法名称
String MethodName=Method.getTestMethod().getMethodName();
Object s[]=result.getParameters();
if(s.length==1){//当可以获取到用例的时候
String Step=getParameter(Arrays.toString(s),"Step");
String TCNO=getParameter(Arrays.toString(s),"TCNO");
String []Parameters=TCNO.split("_");
TCNO=Parameters[0];
//查看是否上一条是错误的(错误场景名称和当前场景名称一致),并且当前用例Step不等于1,都满足就跳过当前即将要运行的这条
int IntegerStep=Integer.parseInt(Step.trim());
if(IntegerStep!=1 && !Success && "f".equals(MethodName)){
Log.logInfo("跳过");
if(resultStatus!=3){
recordTases(Parameter_ServiceUrl);//流程错误案例保存上一条的信息和次数
}
throw new SkipException("skip the test");
}else if(IntegerStep==1 && TCNO.equals(Parameter_TCNO) && "f".equals(MethodName)){//遇到1,场景状态清除
Success=true;
}else if(IntegerStep==1 && !TCNO.equals(Parameter_TCNO) && "f".equals(MethodName) && Parameter_TCNO_count!=0){//计算该场景错误用例比例和该场景的错误案例数量
Success=true;
double TCNO_double=SkipTestnumber/(Parameter_TCNO_count*1.0);
TCNO_double=m1(TCNO_double*100);
SkipMap.put(Parameter_TCNO, TCNO_double+"____"+SkipTestnumber);
SkipTestnumber=0;
Parameter_TCNO="";
}
}
}
@Override
public void afterInvocation(IInvokedMethod Method, ITestResult result) {
try {
resultStatus=result.getStatus();
//获取方法名称
String MethodName=Method.getTestMethod().getMethodName();
Object s111[]=result.getParameters();
String NO=getParameter(Arrays.toString(s111),"NO");
if(s111.length==1){//当可以获取到用例的时候
if(!result.isSuccess() && "f".equals(MethodName)){
SkipTestnumber++;
Success=false;//记录本条用例错误,在下条用例前调用查看
//只要有错误就记录,用例名称、url、步骤数
Object s[]=result.getParameters();
Parameter_ServiceUrl=getParameter(Arrays.toString(s),"serviceUrl");
// recordTases(Parameter_ServiceUrl);
String TCNO=getParameter(Arrays.toString(s),"TCNO");
String []Parameters=TCNO.split("_");
Parameter_TCNO=Parameters[0];
Parameter_TCNO_count=Integer.valueOf(Parameters[1]);
}
if(offcn_api_testData.Testcount==Integer.valueOf(NO) && !Success){
Success=true;
double TCNO_double=SkipTestnumber/(Parameter_TCNO_count*1.0);
TCNO_double=m1(TCNO_double * 100);
SkipMap.put(Parameter_TCNO, TCNO_double+"____"+SkipTestnumber);
SkipTestnumber=0;
Parameter_TCNO="";
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
//记录测试过程中流程用例的错误数量
public static void recordTases(String serviceUrlName){
Integer value = serviceUrlMap.get(serviceUrlName);
int count=1;
if(value==null){
serviceUrlMap.put(serviceUrlName, count);
}else{
serviceUrlMap.put(serviceUrlName, ++value);
}
}
//在parameter中查看,是否有(第二个参数)verifyCode的关键字,有的话返回他的字母值
public static String getParameter(String parameter,String Letter){
if(parameter==null){
return "";
}
String[] strcomma=parameter.split(",");
int comma=strcomma.length;
StringBuffer sb=new StringBuffer();
for(int k=0;k<comma;k++){
//此时是多个,,,
String[] str=strcomma[k].split("=");
String str_strcomma=Arrays.toString(str);
// System.out.println("str="+Arrays.toString(str));
//按参数传过来的字符串做为子串,在以逗号为节点的串中分别查找子串的关键字,
//在找到后的位置开始查找数字,最后把数字的字符串返回
if(str_strcomma.contains(Letter)){
int start=str_strcomma.indexOf(',');
sb.append(str_strcomma.substring(start+2,str_strcomma.length()-1));
return sb.toString();
}
}
return sb.toString();
}
public double m1(double f ) {
BigDecimal bg = null; //new BigDecimal(f);
bg = BigDecimal.valueOf(f);
double f1 = bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue();
return f1;
}
}
......@@ -21,8 +21,10 @@ import com.offcn.TestUnti.StringUtils;
import com.offcn.TestUnti.XMLread;
import com.offcn.api.nwn.md5.nwngetsign;
import com.offcn.interfaces.API;
import com.offcn.listener.MyTestListener;
import com.offcn.listener.ProcessTestng;
import com.offcn.listener.ResultTestng;
import com.offcn.listener.SkipIInvokedMethodListener;
import com.offcn.process.BasicsGM;
import com.offcn.process.NWN;
import com.offcn.process.TK;
......@@ -32,7 +34,7 @@ import org.testng.annotations.BeforeClass;
import org.testng.annotations.Listeners;
import org.testng.annotations.Test;
@Listeners({ ProcessTestng.class ,ResultTestng.class })
@Listeners({MyTestListener.class, SkipIInvokedMethodListener.class })
public class APITest_nwn extends NWN{
@BeforeClass
......@@ -72,7 +74,6 @@ public class APITest_nwn extends NWN{
serviceUrl = serviceUrl + "/sign/" + nwngetsign.nwnGetSign(parameter);
data.put("serviceUrl", serviceUrl);
}
Long startTime=System.currentTimeMillis();
Response re = obj.SendRequest(data, data.get("serviceUrl").toString(), data.get("Request").toString());
......@@ -103,7 +104,6 @@ public class APITest_nwn extends NWN{
result = obj.handleOutput(re, data);
}
}
}
result = obj.handleOutput(re, data);
......
......@@ -35,7 +35,7 @@ public class MakeTestCases {
public static void main(String[] args) {
make("TestData/CaseMake.xls","Sheet1","get","nwn_service");
make("TestData/CaseMake.xls","Sheet1","get","study");
}
......
<?xml version="1.0" encoding="UTF-8"?>
<systems>
<system name="xyzb"><!-- 小雨直播 -->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>bestbuy-acceptance</client_id>
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>N</isProduct>
<RM_URI>http://live.offcncloud.com</RM_URI>
<RM_port></RM_port>
<RM_basePath></RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://192.168.10.222:3306/xyu?useUnicode=true&amp;characterEncoding=UTF-8&amp;zeroDateTimeBehavior=convertToNull</sqlurl>
<sqlname>root</sqlname>
<sqlpwd>offcn.com</sqlpwd>
</system>
<system name="xyzbxs"><!-- 小雨直播 线上环境-->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>bestbuy-acceptance</client_id>
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>N</isProduct>
<RM_URI>http://live.offcncloud.com</RM_URI>
<RM_port></RM_port>
<RM_basePath></RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://59.110.207.90:3306/xyu?useUnicode=true&amp;characterEncoding=UTF-8&amp;zeroDateTimeBehavior=convertToNull</sqlurl>
<sqlname>master</sqlname>
<sqlpwd>EDCdd22LLZBCADF123</sqlpwd>
</system>
<system name="tk"><!-- 题库 -->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>bestbuy-acceptance</client_id>
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>false</isProduct>
<RM_URI>http://test.tiku.eoffcn.com</RM_URI>
<RM_port></RM_port>
<RM_basePath></RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://180.76.155.235:3306/tiku?useUnicode=true&amp;characterEncoding=UTF-8&amp;zeroDateTimeBehavior=convertToNull</sqlurl>
<sqlname>tiku</sqlname>
<sqlpwd>PFQ6nJ7YlG8Y</sqlpwd>
</system>
<system name="tkxs"><!-- 题库线上环境 -->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>bestbuy-acceptance</client_id>
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>false</isProduct>
<RM_URI>http://test.tiku.eoffcn.com</RM_URI>
<RM_port></RM_port>
<RM_basePath></RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://180.76.155.235:3306/tiku?useUnicode=true&amp;characterEncoding=UTF-8&amp;zeroDateTimeBehavior=convertToNull</sqlurl>
<sqlname>tiku</sqlname>
<sqlpwd>PFQ6nJ7YlG8Y</sqlpwd>
</system>
<system name="nwn"><!-- nwn -->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
......@@ -71,7 +8,7 @@
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>false</isProduct>
<RM_URI>http://beta.alitest.eoffcn.com</RM_URI>
<RM_URI>http://nwn.t.eoffcn.com</RM_URI>
<RM_port></RM_port>
<RM_basePath></RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
......@@ -81,29 +18,15 @@
<sqlpwd>Beta@&amp;123</sqlpwd>
</system>
<system name="nwn_service"><!-- nwn -->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>bestbuy-acceptance</client_id>
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>false</isProduct>
<RM_URI>http://beta.alitest.eoffcn.com</RM_URI>
<RM_port></RM_port>
<RM_basePath></RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
<redis_db_index>5</redis_db_index>
<sqlurl>jdbc:mysql://39.105.124.219:3312/nwn?useUnicode=true&amp;characterEncoding=UTF-8&amp;zeroDateTimeBehavior=convertToNull</sqlurl>
<sqlname>nwnBeta</sqlname>
<sqlpwd>Beta@&amp;123</sqlpwd>
</system>
<system name="nwn_ht"><!-- nwn -->
<system name="nwn_ht">nwn
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>bestbuy-acceptance</client_id>
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>false</isProduct>
<RM_URI>http://beta.alitest.eoffcn.com</RM_URI>
<RM_URI>http://nwn.t.eoffcn.com</RM_URI>
<RM_port></RM_port>
<RM_basePath></RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
......@@ -111,15 +34,15 @@
<sqlurl>jdbc:mysql://39.105.124.219:3312/nwn?useUnicode=true&amp;characterEncoding=UTF-8&amp;zeroDateTimeBehavior=convertToNull</sqlurl>
<sqlname>nwnBeta</sqlname>
<sqlpwd>Beta@&amp;123</sqlpwd>
</system>
</system>
<system name="nwn_template"><!-- nwn -->
<access_token_uri>http://106.75.5.205:8082/uaa/oauth/token</access_token_uri>
<client_id>bestbuy-acceptance</client_id>
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>false</isProduct>
<RM_URI>http://beta.alitest.eoffcn.com</RM_URI>
<RM_URI>http://nwn.t.eoffcn.com</RM_URI>
<RM_port></RM_port>
<RM_basePath></RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
......@@ -134,7 +57,7 @@
<client_secret>bestbuy-acceptance</client_secret>
<grant_type>client_credentials</grant_type>
<isProduct>false</isProduct>
<RM_URI>http://beta.alitest.eoffcn.com</RM_URI>
<RM_URI>http://nwn.t.eoffcn.com</RM_URI>
<RM_port></RM_port>
<RM_basePath></RM_basePath>
<redis_URI>10.10.229.48</redis_URI>
......
xls=DataAll.xls
sheet=Testcase4
mysql_local_Online=local
\ No newline at end of file
sheet=try
mysql_local_Online=local
Percentage=10
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment