关于项目自动化测试架构的改良计划 - 读取原始xml文件
发表于:2026-10-31 作者:千家信息网编辑
千家信息网最后更新 2026年10月31日,按照我们的架构,第一步是读取原始的xml文件到一个xml字符串中:/** * *@author cwang58 *@created date: Jun 10, 2013 */public class
千家信息网最后更新 2026年10月31日关于项目自动化测试架构的改良计划 - 读取原始xml文件
按照我们的架构,第一步是读取原始的xml文件到一个xml字符串中:
/** * *@author cwang58 *@created date: Jun 10, 2013 */public class XMLReader { private static final String LINE_SEPARATOR=System.getProperty("line.separator"); private static String userDir = System.getProperty("user.dir"); private static final String fileSeparator=System.getProperty("file.separator"); private static final String dataFileName="test_suite.xml"; /** * build the data file path which depends on the platform * @param projectName * @return */ public static String buildDataFilePath (String projectName){ return userDir+fileSeparator+"src" +fileSeparator+"test" +fileSeparator+"resources" +fileSeparator+projectName +fileSeparator+"data" +fileSeparator+dataFileName; } /** * read the file content then store contant into a string * @param source the file source name * @return * @throws IOException */ public static String readContentFromFile(String source) throws IOException{ File file = new File(source); // open a file reader to read the file content FileInputStream fis = null; InputStreamReader isr = null; BufferedReader reader = null; try { fis = new FileInputStream(file); isr = new InputStreamReader(fis, "utf-8"); reader = new BufferedReader(isr); StringBuffer bufferedFileContent = new StringBuffer(); String line = null; while ((line = reader.readLine()) != null) { bufferedFileContent.append(line).append(LINE_SEPARATOR); } return bufferedFileContent.toString(); } catch (FileNotFoundException ex) { ex.printStackTrace(); return null; } finally { if(reader!=null) reader.close(); if(isr!=null) isr.close(); if(fis!=null) fis.close(); } }代码很简单,就是一个基于文件流的操作,不再自己讲解。这个步骤对于架构图的第一步。
文件
架构
原始
代码
字符
字符串
就是
步骤
utf-8
项目
测试
自动化
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
互联网最新的科技
互联网科技公司税收优惠
美国互联网科技巨头监管
期待互联网科技
融贸通互联网科技
猫创互联网科技
互联网金融 科技创新
左右互联网络科技
科技与互联网的利与弊
互联网企业和科技型企业
河南猎农互联网科技有限公司
移动互联网年度科技创新
新兴科技互联网创新大赛颁奖典礼
上海京穆互联网科技有限公司
互联网科技实习生岗位
富国互联网金融科技混合基金
互联网科技年终奖
全球科技与互联网公司市值变化
吉林省码上互联网科技电话
青岛互联网科技园
广东猪兼强互联网科技有限公司
互联网科技网
互联网科技工作委员会副主任毛军
易通互联网络科技有限公司
互联网养老 桔豆科技
恒生互联网科技指数跳水
佛山市拉法互联网科技有限公司
产业互联网科技服务公司
互联网科技平台产品运营
保山浩联互联网科技有限公司