Commit 78235e3e by Li Yongyu

nwn

parent e4c3890b
...@@ -43,7 +43,7 @@ public class addAccount extends NWN implements API { ...@@ -43,7 +43,7 @@ public class addAccount extends NWN implements API {
public void initialize(HashMap<String, Object> data) { public void initialize(HashMap<String, Object> data) {
if (!isProduct && data.get("CleanDB").toString().contains("Y")) { if (!isProduct && data.get("CleanDB").toString().contains("Y")) {
this.cleann_n_admin_card_no_List_FromDB(); this.cleann_n_admin_card_no_List_FromDB();
this.cleann_n_admin_card_no_List_FromDB_beforeTest();
} }
} }
...@@ -94,9 +94,9 @@ public class addAccount extends NWN implements API { ...@@ -94,9 +94,9 @@ public class addAccount extends NWN implements API {
if (json.length() != 0) { if (json.length() != 0) {
String msg=StringUtils.decodeUnicode(getMsg(re)); String msg=StringUtils.decodeUnicode(getMsg(re));
String code=getCode(re); String retcode=getCode(re);
if ((data.get("code") != null ) && (code != null) && (!code.equals(data.get("code").toString()))) { if ((data.get("code") != null ) && (retcode != null) && (!retcode.equals(data.get("code").toString()))) {
result = result && false; result = result && false;
failReason = failReason + "code is expected " failReason = failReason + "code is expected "
+ data.get("code").toString() + " but actually " + data.get("code").toString() + " but actually "
...@@ -121,7 +121,7 @@ public class addAccount extends NWN implements API { ...@@ -121,7 +121,7 @@ public class addAccount extends NWN implements API {
} }
} }
if("添加成功!".equals(msg)){ if("0".equals(retcode)){
//是否验证数据库 //是否验证数据库
if (!isProduct) { if (!isProduct) {
......
...@@ -50,12 +50,11 @@ public class sign extends NWN implements API { ...@@ -50,12 +50,11 @@ public class sign extends NWN implements API {
// n_admin_username_List.clear(); // n_admin_username_List.clear();
// user_id_List.clear(); // user_id_List.clear();
this.cleann_n_admin_card_no_List_FromDB(); this.cleann_n_admin_card_no_List_FromDB();
this.cleann_n_admin_card_no_List_FromDB_beforeTest();
this.cleann_n_package_List_FromDB(); this.cleann_n_package_List_FromDB();
this.cleann_user_id_List_FromDB(); this.cleann_user_id_List_FromDB();
} }
} }
@Override @Override
public HashMap<String, Object> handleInput(HashMap<String, Object> data) { public HashMap<String, Object> handleInput(HashMap<String, Object> data) {
return data; return data;
......
...@@ -398,9 +398,9 @@ public abstract class BasicsGM { ...@@ -398,9 +398,9 @@ public abstract class BasicsGM {
} }
try { try {
String code=JSONObject.fromObject(re.body().asString()).getString("retcode"); String retcode=JSONObject.fromObject(re.body().asString()).getString("retcode");
if(StringIsNull(code)){ if(StringIsNull(retcode)){
return code; return retcode;
} }
} catch (Exception e) { } catch (Exception e) {
} }
...@@ -426,9 +426,9 @@ public abstract class BasicsGM { ...@@ -426,9 +426,9 @@ public abstract class BasicsGM {
} }
try { try {
String errmsg=JSONObject.fromObject(re.body().asString()).getString("message"); String message=JSONObject.fromObject(re.body().asString()).getString("message");
if(StringIsNull(errmsg)){ if(StringIsNull(message)){
return errmsg; return message;
} }
} catch (Exception e) { } catch (Exception e) {
} }
......
...@@ -94,7 +94,7 @@ public class NWN extends BasicsGM{ ...@@ -94,7 +94,7 @@ public class NWN extends BasicsGM{
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
Log.logInfo("清除数据失败n_admin_card_no_List"); Log.logInfo("清除数据失败n_admin_card_no_qty50636");
} }
......
package com.offcn.test; package com.offcn.test;
import io.restassured.response.Response; import io.restassured.response.Response;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.HashMap; import java.util.HashMap;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.testng.Assert; import org.testng.Assert;
import org.testng.annotations.AfterClass; import org.testng.annotations.AfterClass;
import com.offcn.TestData.offcn_api_testData; import com.offcn.TestData.offcn_api_testData;
import com.offcn.TestUnti.Log; import com.offcn.TestUnti.Log;
import com.offcn.TestUnti.Mail; import com.offcn.TestUnti.Mail;
...@@ -23,28 +27,21 @@ import com.offcn.process.NWN; ...@@ -23,28 +27,21 @@ import com.offcn.process.NWN;
import com.offcn.process.TK; import com.offcn.process.TK;
import com.offcn.process.XYZB; import com.offcn.process.XYZB;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Listeners; import org.testng.annotations.Listeners;
import org.testng.annotations.Test; import org.testng.annotations.Test;
@Listeners({ ProcessTestng.class ,ResultTestng.class }) @Listeners({ ProcessTestng.class ,ResultTestng.class })
public class APITest_nwn extends NWN{ public class APITest_nwn extends NWN{
@AfterClass @BeforeClass
public void beforeClass() { public void beforeClass() {
//测试结束删除测试所用的数据 //测试结束删除测试所用的数据
if (!isClearMysql) { if (!isClearMysql) {
System.out.println("start del **************");
this.cleann_n_admin_card_no_List_FromDB_beforeTest(); this.cleann_n_admin_card_no_List_FromDB_beforeTest();
System.out.println("end del **************");
try {
if(stmt!=null){
stmt.close();
}
if (conn != null){
conn.close();
}
} catch (SQLException e) {
e.printStackTrace();
}
} }
Log.logInfo("========测试开始========"); Log.logInfo("========测试开始========");
......
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