diff --git a/ConfigurationFiles/CaseConfigurationFile/FileTemplet/jira测试用例导入模板.xml b/ConfigurationFiles/CaseConfigurationFile/FileTemplet/jira测试用例导入模板.xml
index 059e2fd..19d0803 100644
--- a/ConfigurationFiles/CaseConfigurationFile/FileTemplet/jira测试用例导入模板.xml
+++ b/ConfigurationFiles/CaseConfigurationFile/FileTemplet/jira测试用例导入模板.xml
@@ -26,7 +26,7 @@
-
+
diff --git a/Result/测试用例.xlsx b/Result/测试用例.xlsx
index 0f776be..97bed0e 100644
Binary files a/Result/测试用例.xlsx and b/Result/测试用例.xlsx differ
diff --git a/Test/ListDataFile/模块信息.csv b/Test/ListDataFile/模块信息.csv
new file mode 100644
index 0000000..d5c2cd8
--- /dev/null
+++ b/Test/ListDataFile/模块信息.csv
@@ -0,0 +1,17 @@
+?模块,呵呵,,?4模块,?0模块,
+?模块,?4模块,,?5模块,?1模块,?3模块
+?模块,?5模块,?5模块,?6模块,?2模块,?4模块
+?模块,?6模块,?6模块,?7模块,?3模块,?5模块
+?模块,?7模块,?7模块,?8模块,?4模块,?6模块
+?模块,?8模块,?8模块,?9模块,?5模块,?7模块
+?模块,?9模块,?9模块,?0模块,?6模块,?8模块
+?模块,?0模块,?0模块,?1模块,?7模块,?9模块
+?模块,?1模块,?1模块,?2模块,?8模块,?0模块
+?0模块,?2模块,?2模块,?3模块,?9模块,?1模块
+?1模块,?3模块,?3模块,?4模块,,?2模块
+?2模块,,哈哈,?5模块,,?3模块
+?3模块,,,?6模块,,?4模块
+,,,?7模块,,?5模块
+,,,?8模块,?0模块,?6模块
+,,,?9模块,?1模块,?7模块
+,,,咯咯,?2模块,
diff --git a/src/test/java/pres/auxiliary/tool/readfile/模块信息.doc b/Test/ListDataFile/模块信息.doc
similarity index 63%
rename from src/test/java/pres/auxiliary/tool/readfile/模块信息.doc
rename to Test/ListDataFile/模块信息.doc
index 7e21037..8f7099c 100644
Binary files a/src/test/java/pres/auxiliary/tool/readfile/模块信息.doc and b/Test/ListDataFile/模块信息.doc differ
diff --git a/src/test/java/pres/auxiliary/tool/readfile/模块信息.docx b/Test/ListDataFile/模块信息.docx
similarity index 50%
rename from src/test/java/pres/auxiliary/tool/readfile/模块信息.docx
rename to Test/ListDataFile/模块信息.docx
index 8f1ee60..63a3ee4 100644
Binary files a/src/test/java/pres/auxiliary/tool/readfile/模块信息.docx and b/Test/ListDataFile/模块信息.docx differ
diff --git a/Test/ListDataFile/模块信息.txt b/Test/ListDataFile/模块信息.txt
new file mode 100644
index 0000000..4b5dcfd
--- /dev/null
+++ b/Test/ListDataFile/模块信息.txt
@@ -0,0 +1,17 @@
+第1模块 呵呵 第34模块 第50模块
+第2模块 第14模块 第35模块 第51模块
+第3模块 第15模块 第25模块 第36模块 第52模块
+第4模块 第16模块 第26模块 第37模块 第53模块
+第5模块 第17模块 第27模块 第38模块 第54模块
+第6模块 第18模块 第28模块 第39模块 第55模块
+第7模块 第19模块 第29模块 第40模块 第56模块
+第8模块 第20模块 第30模块 第41模块 第57模块
+第9模块 第21模块 第31模块 第42模块 第58模块
+第10模块 第22模块 第32模块 第43模块 第59模块
+第11模块 第23模块 第33模块 第44模块
+第12模块 哈哈 第45模块
+第13模块 第46模块
+ 第47模块
+ 第48模块 第60模块
+ 第49模块 第61模块
+ 咯咯 第62模块
diff --git a/src/test/java/pres/auxiliary/tool/readfile/模块信息.xls b/Test/ListDataFile/模块信息.xls
similarity index 72%
rename from src/test/java/pres/auxiliary/tool/readfile/模块信息.xls
rename to Test/ListDataFile/模块信息.xls
index d49a2d6..7e43d09 100644
Binary files a/src/test/java/pres/auxiliary/tool/readfile/模块信息.xls and b/Test/ListDataFile/模块信息.xls differ
diff --git a/Test/ListDataFile/模块信息.xlsx b/Test/ListDataFile/模块信息.xlsx
new file mode 100644
index 0000000..ade534f
Binary files /dev/null and b/Test/ListDataFile/模块信息.xlsx differ
diff --git a/src/main/java/pres/auxiliary/tool/readfile/ListFileRead.java b/src/main/java/pres/auxiliary/tool/readfile/ListFileRead.java
index 8a54541..9f70d55 100644
--- a/src/main/java/pres/auxiliary/tool/readfile/ListFileRead.java
+++ b/src/main/java/pres/auxiliary/tool/readfile/ListFileRead.java
@@ -39,9 +39,41 @@ import pres.auxiliary.tool.file.UnsupportedFileException;
*/
public class ListFileRead {
/**
- * 存储文件的后缀名
+ * 切分标记:tap
*/
- private String suffix = "";
+ public static final String SPLIT_TAB = "\\t";
+ /**
+ * 切分标记:空格
+ */
+ public static final String SPLIT_SPACE = " ";
+ /**
+ * 切分标记:中文逗号
+ */
+ public static final String SPLIT_COMMA_CH = ",";
+ /**
+ * 切分标记:英文逗号
+ */
+ public static final String SPLIT_COMMA_EN = ",";
+ /**
+ * 切分标记:中文分号
+ */
+ public static final String SPLIT_SEMICOLON_CH = ";";
+ /**
+ * 切分标记:英文分号
+ */
+ public static final String SPLIT_SEMICOLON_EN = ";";
+ /**
+ * 切分标记:中文顿号
+ */
+ public static final String SPLIT_STOP_CH = "、";
+ /**
+ * 切分标记:斜杠
+ */
+ public static final String SPLIT_SLASH = "/";
+ /**
+ * 切分标记:反斜杠
+ */
+ public static final String SPLIT_BACKSLASH = "\\\\";
/**
* 存储被切分的词语
@@ -50,11 +82,6 @@ public class ListFileRead {
*/
private ArrayList> wordList = new ArrayList>();
- /**
- * 存储对文本分词处理的分隔符
- */
- private String splitWord = "";
-
/**
* 存储当前获取到的内容组成的表格最大行数
*/
@@ -86,10 +113,15 @@ public class ListFileRead {
* @throws IOException 文件状态或路径不正确时抛出的异常
*/
public ListFileRead(File file, String regex) throws IOException {
+ //若regex为null,则赋为空
+ if (regex == null) {
+ regex = "";
+ }
+
// 存储文件的名称
String fileName = file.getName();
//存储文件名的后缀,并根据后缀来判断采用哪一种读取方式
- switch ((suffix = fileName.substring(fileName.lastIndexOf(".") + 1))) {
+ switch ( fileName.substring(fileName.lastIndexOf(".") + 1)) {
case "doc":
case "docx":
readWord(file, regex);
@@ -134,13 +166,13 @@ public class ListFileRead {
* @return 相应的数据
*/
public List getColumn(int columnIndex, int startRowIndex, int endRowIndex) {
- columnIndex = columnIndex >= maxColumnNum ? maxColumnNum : columnIndex;
+ columnIndex = columnIndex >= maxColumnNum ? maxColumnNum - 1 : columnIndex;
columnIndex = columnIndex < 0 ? 0 : columnIndex;
//若传值大于最大maxRowNum时,则直接赋予maxRowNum
- startRowIndex = (startRowIndex > maxRowNum) ? maxRowNum : startRowIndex;
+ startRowIndex = (startRowIndex >= maxRowNum) ? maxRowNum - 1 : startRowIndex;
startRowIndex = startRowIndex < 0 ? 0 : startRowIndex;
- endRowIndex = (endRowIndex > maxRowNum) ? maxRowNum : endRowIndex;
+ endRowIndex = (endRowIndex >= maxRowNum) ? maxRowNum - 1 : endRowIndex;
endRowIndex = endRowIndex < 0 ? 0 : endRowIndex;
//若两个传值相同,则endRowIndex+1
@@ -150,9 +182,9 @@ public class ListFileRead {
ArrayList texts = new ArrayList<>();
int minRowIndex = startRowIndex < endRowIndex ? startRowIndex : endRowIndex;
- int maxRowIndex = startRowIndex < endRowIndex ? endRowIndex : endRowIndex;
+ int maxRowIndex = startRowIndex < endRowIndex ? endRowIndex : startRowIndex;
//获取数据
- for (int rowIndex = startRowIndex; rowIndex < endRowIndex; rowIndex++) {
+ for (int rowIndex = minRowIndex; rowIndex < maxRowIndex; rowIndex++) {
texts.add(wordList.get(columnIndex).get(rowIndex));
}
@@ -180,15 +212,15 @@ public class ListFileRead {
ArrayList> newWordList = new ArrayList<>();
//若传值大于最大maxColumnNum时,则直接赋予maxColumnNum,小于0,则直接赋予0
- startColumnIndex = startColumnIndex >= maxColumnNum ? maxColumnNum : startColumnIndex;
+ startColumnIndex = startColumnIndex >= maxColumnNum ? maxColumnNum - 1 : startColumnIndex;
startColumnIndex = startColumnIndex < 0 ? 0 : startColumnIndex;
- endColumnIndex = endColumnIndex >= maxColumnNum ? maxColumnNum : endColumnIndex;
+ endColumnIndex = endColumnIndex >= maxColumnNum ? maxColumnNum - 1 : endColumnIndex;
endColumnIndex = endColumnIndex < 0 ? 0 : endColumnIndex;
//若传值大于最大maxRowNum时,则直接赋予maxRowNum,小于0,则直接赋予0
- startRowIndex = (startRowIndex > maxRowNum) ? maxRowNum : startRowIndex;
+ startRowIndex = (startRowIndex >= maxRowNum) ? maxRowNum - 1 : startRowIndex;
startRowIndex = startRowIndex < 0 ? 0 : startRowIndex;
- endRowIndex = (endRowIndex > maxRowNum) ? maxRowNum : endRowIndex;
+ endRowIndex = (endRowIndex >= maxRowNum) ? maxRowNum - 1 : endRowIndex;
endRowIndex = endRowIndex < 0 ? 0 : endRowIndex;
//若两个传值相同,则endXXXIndex+1
@@ -199,7 +231,7 @@ public class ListFileRead {
int minColumnIndex = startColumnIndex < endColumnIndex ? startColumnIndex : endColumnIndex;
int maxColumnIndex = startColumnIndex < endColumnIndex ? endColumnIndex : startColumnIndex;
int minRowIndex = startRowIndex < endRowIndex ? startRowIndex : endRowIndex;
- int maxRowIndex = startRowIndex < endRowIndex ? endRowIndex : endRowIndex;
+ int maxRowIndex = startRowIndex < endRowIndex ? endRowIndex : startRowIndex;
//获取数据
for (int columnIndex = minColumnIndex; columnIndex < maxColumnIndex; columnIndex++) {
ArrayList columnTextList = new ArrayList<>();
diff --git a/src/main/java/pres/auxiliary/work/n/testcase/file/TestCaseTemplet.java b/src/main/java/pres/auxiliary/work/n/testcase/file/TestCaseTemplet.java
index 94aec88..0814fbb 100644
--- a/src/main/java/pres/auxiliary/work/n/testcase/file/TestCaseTemplet.java
+++ b/src/main/java/pres/auxiliary/work/n/testcase/file/TestCaseTemplet.java
@@ -3,6 +3,7 @@ package pres.auxiliary.work.n.testcase.file;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.List;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
@@ -19,6 +20,7 @@ import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
+import pres.auxiliary.tool.readfile.ListFileRead;
import pres.auxiliary.work.n.testcase.templet.LabelNotFoundException;
/**
@@ -32,7 +34,7 @@ import pres.auxiliary.work.n.testcase.templet.LabelNotFoundException;
* 编码时间:2020年2月11日下午11:12:56
*
*
- * 修改时间:2020年2月11日下午11:12:56
+ * 修改时间:2020年4月1日下午7:11:18
*
*
* @author 彭宇琦
@@ -284,18 +286,7 @@ public class TestCaseTemplet {
titleCell.setCellStyle(columnStyle(xw));
// 添加数据,获取相应datas下的所有data标签
- List dataList = datasList.get(datasIndex).elements();
- for (int j = 0; j < dataList.size(); j++) {
- //判断当前行是否被创建,若未被创建,则创建其行并创建单元格;反之,则直接创建单元格
- XSSFRow row;
- // 添加数据,若该行已被创建,则直接获取来创建单元格
- if ((row = dataSheet.getRow(++rowIndex)) == null) {
- dataSheet.createRow(rowIndex).createCell(columnIndex)
- .setCellValue(dataList.get(j).attributeValue("name"));
- } else {
- row.createCell(columnIndex).setCellValue(dataList.get(j).attributeValue("name"));
- }
- }
+ writeDataValidity(datasList.get(datasIndex), dataSheet, rowIndex, columnIndex);
}
}
}
@@ -328,4 +319,69 @@ public class TestCaseTemplet {
return xcs;
}
+
+ /**
+ * 用于将写入数据有效性至相应的sheet页
+ * @param datasElement
+ * @param dataSheet
+ * @param rowIndex
+ * @param columnIndex
+ */
+ @SuppressWarnings("unchecked")
+ private void writeDataValidity(Element datasElement, XSSFSheet dataSheet, int rowIndex, int columnIndex) {
+ // 添加数据,获取相应datas下的所有data标签
+ List dataElementList = datasElement.elements();
+ ArrayList dataTextList = new ArrayList<>();
+ for (int j = 0; j < dataElementList.size(); j++) {
+ //判断标签是否为文件标签,若为文件标签,则读取外部数据
+ if ("file".equalsIgnoreCase(dataElementList.get(j).getName())) {
+ try {
+ dataTextList.addAll(getFileDataValidity(dataElementList.get(j)));
+ } catch (Exception e) {
+ //若抛出任何异常,则说明xml配置不正确,故不进行操作
+ }
+ } else {
+ dataTextList.add(dataElementList.get(j).attributeValue("name"));
+ }
+ }
+
+ //写入文件
+ for (String dataText : dataTextList) {
+ //判断当前行是否被创建,若未被创建,则创建其行并创建单元格;反之,则直接创建单元格
+ XSSFRow row;
+ // 添加数据,若该行已被创建,则直接获取来创建单元格
+ if ((row = dataSheet.getRow(++rowIndex)) == null) {
+ dataSheet.createRow(rowIndex).createCell(columnIndex)
+ .setCellValue(dataText);
+ } else {
+ row.createCell(columnIndex).setCellValue(dataText);
+ }
+ }
+ }
+
+ /**
+ * 用于获取写在外部文件中的数据有效性
+ * @param textElement 数据标签
+ * @return 从外部文件中读取到的数据
+ */
+ private ArrayList getFileDataValidity(Element textElement) {
+ ArrayList dataList = new ArrayList<>();
+ try {
+ //读取数据有效性文件内容
+ File dataFile = new File(textElement.attributeValue("path"));
+ String sheet = textElement.attributeValue("regex");
+ ListFileRead lfr = new ListFileRead(dataFile, sheet);
+
+ //存储需要读取的列和行信息
+ int columnIndex = Integer.valueOf(textElement.attributeValue("column"));
+ int startRowIndex = Integer.valueOf(textElement.attributeValue("start_row"));
+ int endRowIndex = Integer.valueOf(textElement.attributeValue("end_row"));
+ //获取数据信息
+ dataList.addAll(lfr.getColumn(columnIndex, startRowIndex, endRowIndex));
+ } catch (Exception e) {
+ //若抛出任何异常,则说明xml配置不正确,故不进行操作
+ }
+
+ return dataList;
+ }
}
diff --git a/src/main/java/pres/auxiliary/work/n/testcase/file/TestCaseWrite.java b/src/main/java/pres/auxiliary/work/n/testcase/file/TestCaseWrite.java
index eee2180..614d42c 100644
--- a/src/main/java/pres/auxiliary/work/n/testcase/file/TestCaseWrite.java
+++ b/src/main/java/pres/auxiliary/work/n/testcase/file/TestCaseWrite.java
@@ -32,6 +32,7 @@ import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
+import pres.auxiliary.tool.readfile.ListFileRead;
import pres.auxiliary.work.n.testcase.templet.Case;
import pres.auxiliary.work.n.testcase.templet.LabelNotFoundException;
@@ -121,10 +122,7 @@ public class TestCaseWrite {
} catch (DocumentException e) {
throw new IncorrectFileException("用例xml文件有误");
}
-
- // 获取xml文件中的第一个sheet标签,则将该标签的name属性内容传入getColumnId中
- switchSheet(configXml.getRootElement().element("sheet").attributeValue("name"));
-
+
// 判断路径是否包含“.xlsx”(使用的方法为XSSFWork)
if (caseFile.isFile() && caseFile.getAbsolutePath().indexOf(".xlsx") > -1) {
this.caseFile = caseFile;
@@ -132,6 +130,9 @@ public class TestCaseWrite {
throw new IncorrectFileException("不正确的文件格式:" + caseFile.getAbsolutePath());
}
+ // 获取xml文件中的第一个sheet标签,则将该标签的name属性内容传入getColumnId中
+ switchSheet(configXml.getRootElement().element("sheet").attributeValue("name"));
+
// 创建存储测试用例的document类对象
caseXml = DocumentHelper.createDocument();
// 写入根节点
@@ -710,17 +711,22 @@ public class TestCaseWrite {
// 查找xml文件中数据有效性标签
List datasList = sheetElement.elements("datas");
ArrayList datas = new ArrayList();
- // 遍历所有的数据有效性标签,若存在,则将datas设置为true
+ // 遍历所有的数据有效性标签,若存在,则存储相应的数据有效性
for (Element datasElemenet : datasList) {
if (datasElemenet.attributeValue("id").equals(column.get(index).attributeValue("id"))) {
//存储当前的数据有效性的内容
((List)(datasElemenet.elements())).forEach(textElement -> {
- datas.add(textElement.attributeValue("name"));
+ //判断数据有效性的存放位置,并按照相应的方法读取数据有效性
+ if ("file".equalsIgnoreCase(textElement.getName())) {
+ datas.addAll(getFileDataValidity(textElement));
+ } else {
+ datas.add(getLabelDataValidity(textElement));
+ }
});
break;
}
}
-
+
// 存储字段信息
fieldMap.put(column.get(index).attributeValue("id"),
new Field(column.get(index).attributeValue("id"), column.get(index).attributeValue("align"), index,
@@ -729,6 +735,41 @@ public class TestCaseWrite {
}
}
+ /**
+ * 用于获取写在xml文件中的数据有效性
+ * @param textElement 数据标签
+ * @return 标签内的数据
+ */
+ private String getLabelDataValidity(Element textElement) {
+ return textElement.attributeValue("name");
+ }
+
+ /**
+ * 用于获取写在外部文件中的数据有效性
+ * @param textElement 数据标签
+ * @return 从外部文件中读取到的数据
+ */
+ private ArrayList getFileDataValidity(Element textElement) {
+ ArrayList dataList = new ArrayList<>();
+ try {
+ //读取数据有效性文件内容
+ File dataFile = new File(textElement.attributeValue("path"));
+ String sheet = textElement.attributeValue("regex");
+ ListFileRead lfr = new ListFileRead(dataFile, sheet);
+
+ //存储需要读取的列和行信息
+ int columnIndex = Integer.valueOf(textElement.attributeValue("column"));
+ int startRowIndex = Integer.valueOf(textElement.attributeValue("start_row"));
+ int endRowIndex = Integer.valueOf(textElement.attributeValue("end_row"));
+ //获取数据信息
+ dataList.addAll(lfr.getColumn(columnIndex, startRowIndex, endRowIndex));
+ } catch (Exception e) {
+ //若抛出任何异常,则说明xml配置不正确,故不进行操作
+ }
+
+ return dataList;
+ }
+
/**
* 用于对需要进行替换的特殊词语进行替换
* @param contents 文本内容
@@ -1154,6 +1195,9 @@ public class TestCaseWrite {
/**
* 用于创建表格的数据有效性,若当前字段无数据有效性或文件中无数据有效性 相应的内容时,则不创建数据有效性
+ * @param caseSheet 用例所在sheet
+ * @param startRowIndex 起始行下标
+ * @param endRowIndex 结束行下标
*/
public void addDataValidation(XSSFSheet caseSheet, int startRowIndex, int endRowIndex) {
// 判断当前是否存在数据有效性,不存在,则结束
diff --git a/src/test/java/pres/auxiliary/tool/readfile/ListFileReadTest.java b/src/test/java/pres/auxiliary/tool/readfile/ListFileReadTest.java
index b8207d1..c8b8474 100644
--- a/src/test/java/pres/auxiliary/tool/readfile/ListFileReadTest.java
+++ b/src/test/java/pres/auxiliary/tool/readfile/ListFileReadTest.java
@@ -2,6 +2,7 @@ package pres.auxiliary.tool.readfile;
import java.io.File;
import java.io.IOException;
+import java.util.concurrent.atomic.AtomicInteger;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeTest;
@@ -10,10 +11,10 @@ import org.testng.annotations.Test;
public class ListFileReadTest {
ListFileRead lfr;
-// @BeforeTest
-// public void start() throws IOException {
-// lfr = new ListFileRead(new File("src/test/java/pres/auxiliary/tool/readfile/模块信息.csv"));
-// }
+ @BeforeTest
+ public void start() throws IOException {
+ lfr = new ListFileRead(new File("Test/ListDataFile/模块信息.txt"), "\\t");
+ }
@AfterMethod
public void showColumn() {
@@ -27,7 +28,7 @@ public class ListFileReadTest {
*/
@Test
public void listFileReadTest_Csv() throws IOException {
- lfr = new ListFileRead(new File("src/test/java/pres/auxiliary/tool/readfile/模块信息.csv"));
+ lfr = new ListFileRead(new File("Test/ListDataFile/模块信息.csv"));
lfr.getColumn(4).forEach(System.out :: println);
System.out.println("------------------------------------");
}
@@ -38,7 +39,7 @@ public class ListFileReadTest {
*/
@Test
public void listFileReadTest_Xls() throws IOException {
- lfr = new ListFileRead(new File("src/test/java/pres/auxiliary/tool/readfile/模块信息.xls"));
+ lfr = new ListFileRead(new File("Test/ListDataFile/模块信息.xls"));
lfr.getColumn(4).forEach(System.out :: println);
System.out.println("------------------------------------");
}
@@ -49,7 +50,7 @@ public class ListFileReadTest {
*/
@Test
public void listFileReadTest_Xls_String() throws IOException {
- lfr = new ListFileRead(new File("src/test/java/pres/auxiliary/tool/readfile/模块信息.xls"), "Sheet2");
+ lfr = new ListFileRead(new File("Test/ListDataFile/模块信息.xls"), "Sheet2");
}
/**
@@ -58,7 +59,7 @@ public class ListFileReadTest {
*/
@Test
public void listFileReadTest_Xlsx() throws IOException {
- lfr = new ListFileRead(new File("src/test/java/pres/auxiliary/tool/readfile/模块信息.xlsx"));
+ lfr = new ListFileRead(new File("Test/ListDataFile/模块信息.xlsx"));
lfr.getColumn(4).forEach(System.out :: println);
System.out.println("------------------------------------");
}
@@ -69,7 +70,7 @@ public class ListFileReadTest {
*/
@Test
public void listFileReadTest_Xlsx_String() throws IOException {
- lfr = new ListFileRead(new File("src/test/java/pres/auxiliary/tool/readfile/模块信息.xlsx"), "Sheet2");
+ lfr = new ListFileRead(new File("Test/ListDataFile/模块信息.xlsx"), "Sheet2");
}
/**
@@ -78,7 +79,7 @@ public class ListFileReadTest {
*/
@Test
public void listFileReadTest_Txt() throws IOException {
- lfr = new ListFileRead(new File("src/test/java/pres/auxiliary/tool/readfile/模块信息.txt"));
+ lfr = new ListFileRead(new File("Test/ListDataFile/模块信息.txt"));
}
/**
@@ -87,7 +88,7 @@ public class ListFileReadTest {
*/
@Test
public void listFileReadTest_Txt_String() throws IOException {
- lfr = new ListFileRead(new File("src/test/java/pres/auxiliary/tool/readfile/模块信息.txt"), "\\t");
+ lfr = new ListFileRead(new File("Test/ListDataFile/模块信息.txt"), "\\t");
}
/**
@@ -96,7 +97,7 @@ public class ListFileReadTest {
*/
@Test
public void listFileReadTest_Doc() throws IOException {
- lfr = new ListFileRead(new File("src/test/java/pres/auxiliary/tool/readfile/模块信息.doc"));
+ lfr = new ListFileRead(new File("Test/ListDataFile/模块信息.doc"));
}
/**
@@ -105,7 +106,7 @@ public class ListFileReadTest {
*/
@Test
public void listFileReadTest_Doc_String() throws IOException {
- lfr = new ListFileRead(new File("src/test/java/pres/auxiliary/tool/readfile/模块信息.doc"), "\\t");
+ lfr = new ListFileRead(new File("Test/ListDataFile/模块信息.doc"), "\\t");
}
/**
@@ -114,7 +115,7 @@ public class ListFileReadTest {
*/
@Test
public void listFileReadTest_docx() throws IOException {
- lfr = new ListFileRead(new File("src/test/java/pres/auxiliary/tool/readfile/模块信息.docx"));
+ lfr = new ListFileRead(new File("Test/ListDataFile/模块信息.docx"));
}
/**
@@ -123,7 +124,66 @@ public class ListFileReadTest {
*/
@Test
public void listFileReadTest_docx_String() throws IOException {
- lfr = new ListFileRead(new File("src/test/java/pres/auxiliary/tool/readfile/模块信息.docx"), "\\t");
+ lfr = new ListFileRead(new File("Test/ListDataFile/模块信息.docx"), "\\t");
+ }
+
+ /**
+ * 测试{@link ListFileRead#getColumn(int, int, int)}
+ */
+ @Test
+ public void getColumnTest() {
+ lfr.getColumn(2, 3, 6).forEach(System.out :: println);
+ System.out.println("------------------------------------");
+ lfr.getColumn(2, 4, 0).forEach(System.out :: println);
+ System.out.println("------------------------------------");
+ lfr.getColumn(2, 3, 3).forEach(System.out :: println);
+ System.out.println("------------------------------------");
+ lfr.getColumn(99, 99, 99).forEach(System.out :: println);
+ System.out.println("------------------------------------");
+ }
+
+ /**
+ * 测试{@link ListFileRead#getTable()}
+ */
+ @Test
+ public void getTableTest() {
+ AtomicInteger commitCount = new AtomicInteger(1);
+ lfr.getTable().forEach(textList -> {
+ System.out.println("第" + commitCount.getAndIncrement() + "列:");
+ textList.forEach(System.out :: println);
+ });
+ System.out.println("------------------------------------");
+ }
+
+ /**
+ * 测试{@link ListFileRead#getTable(int, int, int, int)}
+ */
+ @Test
+ public void getTableTest_IntIntIntInt() {
+ AtomicInteger commitCount = new AtomicInteger(1);
+ lfr.getTable(0, 2, 3, 6).forEach(textList -> {
+ System.out.println("第" + commitCount.getAndIncrement() + "列:");
+ textList.forEach(System.out :: println);
+ });
+ System.out.println("------------------------------------");
+ commitCount.set(1);
+ lfr.getTable(2, 0, 4, 0).forEach(textList -> {
+ System.out.println("第" + commitCount.getAndIncrement() + "列:");
+ textList.forEach(System.out :: println);
+ });
+ System.out.println("------------------------------------");
+ commitCount.set(1);
+ lfr.getTable(2, 2, 4, 4).forEach(textList -> {
+ System.out.println("第" + commitCount.getAndIncrement() + "列:");
+ textList.forEach(System.out :: println);
+ });
+ System.out.println("------------------------------------");
+ commitCount.set(1);
+ lfr.getTable(99, 99, 99, 99).forEach(textList -> {
+ System.out.println("第" + commitCount.getAndIncrement() + "列:");
+ textList.forEach(System.out :: println);
+ });
+ System.out.println("------------------------------------");
}
@Test
diff --git a/src/test/java/pres/auxiliary/tool/readfile/模块信息.csv b/src/test/java/pres/auxiliary/tool/readfile/模块信息.csv
deleted file mode 100644
index 2a6c516..0000000
--- a/src/test/java/pres/auxiliary/tool/readfile/模块信息.csv
+++ /dev/null
@@ -1,17 +0,0 @@
-第1模块,呵呵,嘻嘻,第34模块,第50模块,
-第2模块,第14模块,第24模块,第35模块,第51模块,第63模块
-第3模块,第15模块,第25模块,第36模块,第52模块,第64模块
-第4模块,第16模块,第26模块,第37模块,第53模块,第65模块
-第5模块,第17模块,第27模块,第38模块,第54模块,第66模块
-第6模块,第18模块,第28模块,第39模块,第55模块,第67模块
-第7模块,第19模块,第29模块,第40模块,第56模块,第68模块
-第8模块,第20模块,第30模块,第41模块,第57模块,第69模块
-第9模块,第21模块,第31模块,第42模块,第58模块,第70模块
-第10模块,第22模块,第32模块,第43模块,第59模块,第71模块
-第11模块,第23模块,第33模块,第44模块,,第72模块
-第12模块,,哈哈,第45模块,,第73模块
-第13模块,,,第46模块,,第74模块
-,,,第47模块,,第75模块
-,,,第48模块,第60模块,第76模块
-,,,第49模块,第61模块,第77模块
-,,,咯咯,第62模块,
diff --git a/src/test/java/pres/auxiliary/tool/readfile/模块信息.txt b/src/test/java/pres/auxiliary/tool/readfile/模块信息.txt
deleted file mode 100644
index 1903a49..0000000
--- a/src/test/java/pres/auxiliary/tool/readfile/模块信息.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-第1.0模块 第2.0模块
-第1.1模块 第2.1模块
-第1.2模块 第2.2模块
-第1.3模块 第2.3模块
-第1.4模块 第2.4模块
diff --git a/src/test/java/pres/auxiliary/tool/readfile/模块信息.xlsx b/src/test/java/pres/auxiliary/tool/readfile/模块信息.xlsx
deleted file mode 100644
index 4d1ca9f..0000000
Binary files a/src/test/java/pres/auxiliary/tool/readfile/模块信息.xlsx and /dev/null differ
diff --git a/src/test/java/pres/auxiliary/work/testcase/jira测试用例导入模板.xml b/src/test/java/pres/auxiliary/work/testcase/jira测试用例导入模板.xml
index 4e4e9c3..19d0803 100644
--- a/src/test/java/pres/auxiliary/work/testcase/jira测试用例导入模板.xml
+++ b/src/test/java/pres/auxiliary/work/testcase/jira测试用例导入模板.xml
@@ -24,6 +24,10 @@
+
+
+
+
diff --git a/设计图/文件读取工具.xmind b/设计图/文件读取工具.xmind
index 6a71d15..5a2c6aa 100644
Binary files a/设计图/文件读取工具.xmind and b/设计图/文件读取工具.xmind differ