diff --git a/.gitignore b/.gitignore index 5e0ec5bbdd85c5cba7e893c60b8c256633493a6b..0e6f9483e24527880fa13e3866795df95eef25c3 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ hs_err_pid* *.iml */target/* */allure-report/* +/target/* diff --git a/automation-agent/pom.xml b/automation-agent/pom.xml index 95e4c9c971ee69abf24704a9d39d1b88ff441137..725428c686994fdc0feebc7b8fde43f3e403ec0f 100644 --- a/automation-agent/pom.xml +++ b/automation-agent/pom.xml @@ -5,20 +5,19 @@ cn.testnewbie.automation automation-parent - 1.0.0 + 1.3.1 4.0.0 - cn.testnewbie.automation automation-agent - 1.0.0 + 1.3.1 jar cn.testnewbie.automation automation-core - 1.1.13-SNAPSHOT + 1.3.1 org.javassist diff --git a/automation-core/pom.xml b/automation-core/pom.xml index 6f0c516d7ed21c546460d9675afb997c018b8095..e13a5879c5240a05d2dad61397eb78ddce3382f1 100644 --- a/automation-core/pom.xml +++ b/automation-core/pom.xml @@ -5,13 +5,12 @@ cn.testnewbie.automation automation-parent - 1.0.0 + 1.3.1 4.0.0 - cn.testnewbie.automation automation-core - 1.1.13-SNAPSHOT + 1.3.1 jar diff --git a/automation-core/src/main/java/cn/testnewbie/automation/core/DataBaseStep.java b/automation-core/src/main/java/cn/testnewbie/automation/core/DataBaseStep.java index 645007abe68c047128dd328e8f597c55d21d6211..ec2ee9688b91835903dc8f117096fbbf48c995ee 100644 --- a/automation-core/src/main/java/cn/testnewbie/automation/core/DataBaseStep.java +++ b/automation-core/src/main/java/cn/testnewbie/automation/core/DataBaseStep.java @@ -24,8 +24,6 @@ public class DataBaseStep { /** * 执行测试类目录下的跟测试类同名的sql文件 - * - * @throws Exception */ @Step("运行sql文件") public void execSqlFile() { @@ -47,8 +45,7 @@ public class DataBaseStep { /** * 执行一个普通sql * - * @param sql - * @throws Exception + * @param sql sql语句 */ @Step("执行sql:'{sql}' ") public void execSql(String sql) { @@ -81,7 +78,6 @@ public class DataBaseStep { * * @param sql 查询sql * @param checkData 查询结果集合 - * @throws Exception */ @Step("检查数据库:'{sql}' '{checkData}'") public void checkDataBase(String sql, List checkData) { diff --git a/automation-core/src/main/java/cn/testnewbie/automation/core/annotation/CsvBeanSource.java b/automation-core/src/main/java/cn/testnewbie/automation/core/annotation/CsvBeanSource.java index ed7c65e7d2a0770b96fb4995b8179a25ed06c2bd..82bacb80bfeb38fb2f882205c61974de9b53670f 100644 --- a/automation-core/src/main/java/cn/testnewbie/automation/core/annotation/CsvBeanSource.java +++ b/automation-core/src/main/java/cn/testnewbie/automation/core/annotation/CsvBeanSource.java @@ -35,11 +35,7 @@ public @interface CsvBeanSource { /** * map形式的参数,不能为空,举例: - * - * @CsvBeanSource( {"customerNo=0001, account=apitest1, password=123456, except=token", - * "customerNo=0001, account=apitest2, password=123456, except=\"status\":true", - * "customerNo=0002, account=apitest3, password=123456, except=账户已被禁用,请联系管理员", - * "customerNo=0002, account=apitest4, password=123456, except=\"status\":false"}) + * LoginTestUseCsvBeanSource */ String[] value(); @@ -52,9 +48,8 @@ public @interface CsvBeanSource { /** * 将指定的值转为null,如: - * "N/A" -> null - * "NIL" -> null - * + * "N/A" 转为 null + * "NIL" 转为 null */ String[] nullValues() default {}; diff --git a/automation-core/src/main/java/cn/testnewbie/automation/core/cache/HttpCacheManage.java b/automation-core/src/main/java/cn/testnewbie/automation/core/cache/HttpCacheManage.java index 294141b25696e38150a711188df2907f85fa147b..37514a8b2a8a392ea203208988ba182e51f0e694 100644 --- a/automation-core/src/main/java/cn/testnewbie/automation/core/cache/HttpCacheManage.java +++ b/automation-core/src/main/java/cn/testnewbie/automation/core/cache/HttpCacheManage.java @@ -22,9 +22,9 @@ import static org.apiguardian.api.API.Status.MAINTAINED; /** * http接口测试过程中的缓存管理 * 以map方式保存,执行case前,将map注入测试实例的 - * `public HashMap headerMap = new HashMap<>();` 属性中(如 automation-interface 包下的 HttpStep) + * "public HashMap<String, String> headerMap = new HashMap<>();" 属性中(如 automation-interface 包下的 HttpStep) *

- * 如果不满足测试需要,可以自己copy一份,然后让注解 `T` 关联的实现类(如 example 包下的 LoginWithExtension)继承 + * 如果不满足测试需要,可以自己copy一份,然后让注解 "T" 关联的实现类(如 example 包下的 LoginWithExtension)继承 * * @author zhanglx */ @@ -133,7 +133,7 @@ public abstract class HttpCacheManage implements ICacheMan /** * 保存或者获取缓存的登录信息时,使用的key - * 如业务系统唯一的`手机号`、`客户号+帐号`等等 + * 如业务系统唯一的"手机号"、"客户号+帐号"等等 * * @param loginInfo 注解里面的信息 * @return 每个帐号密码的唯一标识 @@ -161,12 +161,12 @@ public abstract class HttpCacheManage implements ICacheMan /** - * 将登录信息以HashMap形式,注入到测试实例中 + * 将登录信息以HashMap<String, String>形式,注入到测试实例中 * 对于 HttpStep 来说,信息头就是一个map * * @param extensionContext the current extension context; * @param annotation 登录信息 - * @throws NoSuchFieldException `测试类`或者`测试类的父类`,没有`public HashMap headerMap = new HashMap<>();` + * @throws NoSuchFieldException "测试类"或者"测试类的父类",没有"public HashMap<String, String> headerMap = new HashMap<>();" * @throws IllegalAccessException 上面的headerMap,没有以public修饰 */ @TimeCost diff --git a/automation-core/src/main/java/cn/testnewbie/automation/core/common/TNConstants.java b/automation-core/src/main/java/cn/testnewbie/automation/core/common/TNConstants.java index 2712c9850f8827fcec8a1736c9fde239490544a1..0f8c5f7aab6ecc7fa7710caa8185e3af3dee14dd 100644 --- a/automation-core/src/main/java/cn/testnewbie/automation/core/common/TNConstants.java +++ b/automation-core/src/main/java/cn/testnewbie/automation/core/common/TNConstants.java @@ -12,6 +12,7 @@ public class TNConstants { /*** 通用常量 ***/ public static final String DOT = "."; + public static final String PERCENT = "%"; /*** 数据库常量 ***/ public static final String NAME = "name"; diff --git a/automation-core/src/main/java/cn/testnewbie/automation/core/db/ResultSetUtil.java b/automation-core/src/main/java/cn/testnewbie/automation/core/db/ResultSetUtil.java index b53d984e0b5f73eb97251b69a4bb6ec1303dd6df..7761ee9ec8cbe22e58e6cc2c0ee0acdfad526bc9 100644 --- a/automation-core/src/main/java/cn/testnewbie/automation/core/db/ResultSetUtil.java +++ b/automation-core/src/main/java/cn/testnewbie/automation/core/db/ResultSetUtil.java @@ -24,8 +24,8 @@ public class ResultSetUtil { * 通用取结果方案,返回list * * @param rs - * @return - * @throws SQLException + * @return 数据行list + * @throws SQLException sql异常 */ public static List convertList(ResultSet rs) throws SQLException { ResultSetMetaData metaData = rs.getMetaData(); @@ -45,8 +45,8 @@ public class ResultSetUtil { * 通用取结果方案,返回JSONArray * * @param rs - * @return - * @throws SQLException + * @return 返回JSONArray + * @throws SQLException sql异常 */ public JSONArray convertJSONArray(ResultSet rs) throws SQLException { ResultSetMetaData metaData = rs.getMetaData(); diff --git a/automation-core/src/main/java/cn/testnewbie/automation/core/db/SqlFileTools.java b/automation-core/src/main/java/cn/testnewbie/automation/core/db/SqlFileTools.java index 19dba4152c20f45b220133165a1af8a0b01676fe..a221e00e59e3eefa8ecae63aafa7b62273aab2d0 100644 --- a/automation-core/src/main/java/cn/testnewbie/automation/core/db/SqlFileTools.java +++ b/automation-core/src/main/java/cn/testnewbie/automation/core/db/SqlFileTools.java @@ -28,8 +28,8 @@ public class SqlFileTools { * 加载解析sql 读取方式字符流 行读取 * * @param file - * @return - * @throws Exception + * @return sql文件 + * @throws Exception 异常 */ public static List loadSql(File file) throws Exception { if (!file.exists()) { diff --git a/automation-core/src/main/java/cn/testnewbie/automation/core/util/InputStreamToBytes.java b/automation-core/src/main/java/cn/testnewbie/automation/core/util/InputStreamToBytes.java index eac18d710fe3731c2ed9b1f706730be2f5caed95..30a9327e79fca6d40adf7559dd0f429a2d28fe93 100644 --- a/automation-core/src/main/java/cn/testnewbie/automation/core/util/InputStreamToBytes.java +++ b/automation-core/src/main/java/cn/testnewbie/automation/core/util/InputStreamToBytes.java @@ -24,8 +24,8 @@ public class InputStreamToBytes { * 将输入流转成bytes,方便allure添加到报告里面,如图片 * * @param inputStream - * @return - * @throws IOException + * @return 字节数组 + * @throws IOException IO异常 */ public static byte[] convert(InputStream inputStream) throws IOException { BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream); @@ -45,8 +45,8 @@ public class InputStreamToBytes { * 将输入流转成特定字符类型的字符串,再转成bytes,方便allure添加到报告里面,如中文文本 * * @param inputStream - * @return - * @throws IOException + * @return 字节数组 + * @throws IOException IO异常 */ public static byte[] convertToText(InputStream inputStream, Charset charset) throws IOException { BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream); @@ -65,9 +65,8 @@ public class InputStreamToBytes { /** * 截图,并返回bytes * - * @return - * @throws IOException - * @throws AWTException + * @return 字节数组 + * @throws Exception IO异常、AWT异常 */ public static byte[] screenshot() throws Exception { GuiCamera cam1 = new GuiCamera(null, "target/screenShot"); diff --git a/automation-dingding/pom.xml b/automation-dingding/pom.xml index 5a4896f0f0e829dce853fbe1ac6984ee6fadf782..9c66c095c2a9ad220ccd1e5ca94b79f73eef7383 100644 --- a/automation-dingding/pom.xml +++ b/automation-dingding/pom.xml @@ -5,13 +5,12 @@ cn.testnewbie.automation automation-parent - 1.0.0 + 1.3.1 4.0.0 - cn.testnewbie.automation automation-dingding - 1.0.0 + 1.3.1 jar @@ -23,7 +22,7 @@ cn.testnewbie.automation automation-core - 1.1.13-SNAPSHOT + 1.3.1 org.junit.platform diff --git a/automation-dingding/src/main/java/cn/testnewbie/automation/dingding/DingDingListener.java b/automation-dingding/src/main/java/cn/testnewbie/automation/dingding/DingDingListener.java index 70ca59bad05c98b2b1e548d6e3fa5e1f9629a305..563e21368e23d27797bb767d2d2e8411585cad2e 100644 --- a/automation-dingding/src/main/java/cn/testnewbie/automation/dingding/DingDingListener.java +++ b/automation-dingding/src/main/java/cn/testnewbie/automation/dingding/DingDingListener.java @@ -3,15 +3,13 @@ package cn.testnewbie.automation.dingding; import cn.hutool.log.Log; import cn.hutool.log.LogFactory; import cn.testnewbie.automation.core.annotation.TimeCost; -import cn.testnewbie.automation.core.common.TNConstants; import cn.testnewbie.automation.dingding.config.DingDingConfig; import cn.testnewbie.automation.dingding.config.DingDingHelper; import org.junit.platform.launcher.TestPlan; import org.junit.platform.launcher.listeners.SummaryGeneratingListener; import org.junit.platform.launcher.listeners.TestExecutionSummary; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; +import java.text.NumberFormat; import java.util.List; @@ -32,7 +30,16 @@ public class DingDingListener extends SummaryGeneratingListener { // 判断是否需要发送钉钉通知 if (DingDingConfig.isSendDingDing) { TestExecutionSummary summary = super.getSummary(); - long testsFailedCount = summary.getTestsFailedCount(); + // tests failed 加上失败的容器数,是为了在数量上和Allure报告的(failed+broken+unknown)保持一致 + long testsFailedCount = summary.getTestsFailedCount() + summary.getContainersFailedCount(); + long testsSucceededCount = summary.getTestsSucceededCount(); + + // 创建一个数值格式化对象 + NumberFormat numberFormat = NumberFormat.getInstance(); + // 设置精确到小数点后2位 + numberFormat.setMaximumFractionDigits(2); + //所占百分比 + String passPercent = numberFormat.format((float) testsSucceededCount / (testsFailedCount + testsSucceededCount) * 100); if (testsFailedCount > 0) { List mobiles = DingDingHelper.getMobiles(); @@ -40,9 +47,8 @@ public class DingDingListener extends SummaryGeneratingListener { for (String mob : mobiles) { atString.append("@").append(mob).append(" "); } - DingDingHelper.sendDingDing(String.format("请注意,有%s个用例失败 %s", - testsFailedCount, - atString.toString())); + String format = "请注意,有" + testsFailedCount + "个用例失败,通过率" + passPercent + "% " + atString.toString(); + DingDingHelper.sendDingDing(format); } else { log.info("用例失败数量为0,不发送钉钉通知"); } diff --git a/automation-email/pom.xml b/automation-email/pom.xml index 02fb207a0d0149c3b1ac179b31f0a0b9e8a34a34..e97956fa4301154e7bb0ef70631a6b92b5cfe7ac 100644 --- a/automation-email/pom.xml +++ b/automation-email/pom.xml @@ -7,12 +7,11 @@ cn.testnewbie.automation automation-parent - 1.0.0 + 1.3.1 - cn.testnewbie.automation automation-email - 1.0.0 + 1.3.1 jar @@ -24,7 +23,7 @@ cn.testnewbie.automation automation-core - 1.1.13-SNAPSHOT + 1.3.1 org.junit.platform diff --git a/automation-email/src/main/java/cn/testnewbie/automation/mail/EmailListener.java b/automation-email/src/main/java/cn/testnewbie/automation/mail/EmailListener.java index c7f3aaed181de49d7522edc982682091f3f4e856..1bec14ae187fb1dcef6b15425cb984df83c38e71 100644 --- a/automation-email/src/main/java/cn/testnewbie/automation/mail/EmailListener.java +++ b/automation-email/src/main/java/cn/testnewbie/automation/mail/EmailListener.java @@ -4,7 +4,6 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.log.Log; import cn.hutool.log.LogFactory; import cn.testnewbie.automation.core.annotation.TimeCost; -import cn.testnewbie.automation.core.common.TNConstants; import cn.testnewbie.automation.mail.config.MailConfig; import cn.testnewbie.automation.mail.config.MailHelper; import org.junit.platform.launcher.TestPlan; @@ -13,8 +12,6 @@ import org.junit.platform.launcher.listeners.TestExecutionSummary; import javax.mail.MessagingException; import java.io.UnsupportedEncodingException; import java.text.NumberFormat; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.List; @@ -151,14 +148,15 @@ public class EmailListener extends MailSummaryGeneratingListener { long testsStartedCount = summary.getTestsStartedCount(); long testsAbortedCount = summary.getTestsAbortedCount(); long testsSucceededCount = summary.getTestsSucceededCount(); - long testsFailedCount = summary.getTestsFailedCount(); + // tests failed 加上失败的容器数,是为了在数量上和Allure报告的(failed+broken+unknown)保持一致 + long testsFailedCount = summary.getTestsFailedCount() + summary.getContainersFailedCount(); // 创建一个数值格式化对象 NumberFormat numberFormat = NumberFormat.getInstance(); // 设置精确到小数点后2位 numberFormat.setMaximumFractionDigits(2); //所占百分比 - String passPercent = numberFormat.format((float) testsSucceededCount / testsStartedCount * 100); + String passPercent = numberFormat.format((float) testsSucceededCount / (testsFailedCount + testsSucceededCount) * 100); String failCase = getFailCase(summary); diff --git a/automation-email/src/main/java/cn/testnewbie/automation/mail/MailSummaryGeneratingListener.java b/automation-email/src/main/java/cn/testnewbie/automation/mail/MailSummaryGeneratingListener.java index c7440456d4424e16f3ae49edc19302fe6fc55097..068ff20056c244790584c5642331c14ad8534b01 100644 --- a/automation-email/src/main/java/cn/testnewbie/automation/mail/MailSummaryGeneratingListener.java +++ b/automation-email/src/main/java/cn/testnewbie/automation/mail/MailSummaryGeneratingListener.java @@ -10,6 +10,8 @@ package cn.testnewbie.automation.mail; +import cn.hutool.log.Log; +import cn.hutool.log.LogFactory; import org.junit.platform.commons.PreconditionViolationException; import org.junit.platform.engine.TestExecutionResult; import org.junit.platform.launcher.TestExecutionListener; @@ -29,6 +31,7 @@ import static java.util.stream.Stream.concat; * @see SummaryGeneratingListener */ public class MailSummaryGeneratingListener implements TestExecutionListener { + private static final Log log = LogFactory.get(); private TestPlan testPlan; private MailTestExecutionSummary summary; @@ -90,6 +93,7 @@ public class MailSummaryGeneratingListener implements TestExecutionListener { case SUCCESSFUL: { if (testIdentifier.isContainer()) { this.summary.containersSucceeded.incrementAndGet(); + log.debug("Container SUCCESSFUL : " + testIdentifier.toString()); } if (testIdentifier.isTest()) { this.summary.testsSucceeded.incrementAndGet(); @@ -109,7 +113,10 @@ public class MailSummaryGeneratingListener implements TestExecutionListener { case FAILED: { if (testIdentifier.isContainer()) { - this.summary.containersFailed.incrementAndGet(); + if (testIdentifier.getParentId() != null) { + this.summary.containersFailed.incrementAndGet(); + } + log.debug("Container FAILED : " + testIdentifier.toString()); } if (testIdentifier.isTest()) { this.summary.testsFailed.incrementAndGet(); diff --git a/automation-email/src/main/java/cn/testnewbie/automation/mail/MailTestExecutionSummary.java b/automation-email/src/main/java/cn/testnewbie/automation/mail/MailTestExecutionSummary.java index 5de47609a591d6324ac882985b6c4dc9d36cdf5d..a573dbfeadfdc8bdc5b4cee3d8acbd7f0eb00003 100644 --- a/automation-email/src/main/java/cn/testnewbie/automation/mail/MailTestExecutionSummary.java +++ b/automation-email/src/main/java/cn/testnewbie/automation/mail/MailTestExecutionSummary.java @@ -69,6 +69,13 @@ public class MailTestExecutionSummary implements TestExecutionSummary { this.containersFound.set(testPlan.countTestIdentifiers(TestIdentifier::isContainer)); this.testsFound.set(testPlan.countTestIdentifiers(TestIdentifier::isTest)); this.timeStarted = System.currentTimeMillis(); + + Set roots = testPlan.getRoots(); + if (roots.size() != 1) { + log.warn("发现一个testPlan,roots != 1: " + roots.toString()); + log.warn("testPlan = " + testPlan.toString()); + log.warn("roots = " + roots.toString()); + } } void addFailure(TestIdentifier testIdentifier, Throwable throwable) { @@ -197,14 +204,6 @@ public class MailTestExecutionSummary implements TestExecutionSummary { + "---------------------------------\n" + "Test run finished after {} ms\n" + "---------------------------------\n" - - + "|containers found {}\n" - + "|containers skipped {}\n" - + "|containers started {}\n" - + "|containers aborted {}\n" - + "|containers successful {}\n" - + "|containers failed {}\n" - + "|tests found {}\n" + "|tests skipped {}\n" + "|tests started {}\n" @@ -214,19 +213,26 @@ public class MailTestExecutionSummary implements TestExecutionSummary { (this.timeFinished - this.timeStarted), - getContainersFoundCount(), - getContainersSkippedCount(), - getContainersStartedCount(), - getContainersAbortedCount(), - getContainersSucceededCount(), - getContainersFailedCount(), - getTestsFoundCount(), getTestsSkippedCount(), getTestsStartedCount(), getTestsAbortedCount(), getTestsSucceededCount(), - getTestsFailedCount() + // tests failed 加上失败的容器数,是为了在数量上和Allure报告的(failed+broken+unknown)保持一致 + getTestsFailedCount() + getContainersFailedCount() + ); + log.debug("\n|containers found {}\n" + + "|containers skipped {}\n" + + "|containers started {}\n" + + "|containers aborted {}\n" + + "|containers successful {}\n" + + "|containers failed {}\n", + getContainersFoundCount(), + getContainersSkippedCount(), + getContainersStartedCount(), + getContainersAbortedCount(), + getContainersSucceededCount(), + getContainersFailedCount() ); } diff --git a/automation-email/src/main/java/cn/testnewbie/automation/mail/config/MailHelper.java b/automation-email/src/main/java/cn/testnewbie/automation/mail/config/MailHelper.java index 9b009f180a9c95ade4a4d7b7eaf14c57f3312f9d..d5986c02cbdbf4142563f6767ad65e16774b7267 100644 --- a/automation-email/src/main/java/cn/testnewbie/automation/mail/config/MailHelper.java +++ b/automation-email/src/main/java/cn/testnewbie/automation/mail/config/MailHelper.java @@ -42,7 +42,7 @@ public class MailHelper { account.setCharset(CharsetUtil.CHARSET_UTF_8); account.setTimeout(Integer.parseInt(TIMEOUT)); account.setAuth(true); - account.setDebug(true); + account.setDebug(false); return account; } diff --git a/automation-interface/pom.xml b/automation-interface/pom.xml index bf3367ae892ff448d015ed96957a9fca335b9420..b2a7f92924b4156fd2888b98fcb0ba2649940607 100644 --- a/automation-interface/pom.xml +++ b/automation-interface/pom.xml @@ -7,12 +7,11 @@ cn.testnewbie.automation automation-parent - 1.0.0 + 1.3.1 - cn.testnewbie.automation automation-interface - 1.2.11-SNAPSHOT + 1.3.1 UTF-8 @@ -24,7 +23,7 @@ cn.testnewbie.automation automation-core - 1.1.13-SNAPSHOT + 1.3.1 org.junit.jupiter diff --git a/automation-interface/src/main/java/cn/testnewbie/automation/interfacetest/junit5/DBExtension.java b/automation-interface/src/main/java/cn/testnewbie/automation/interfacetest/junit5/DBExtension.java index 1d36f882624ecfbcc0c46acb4e0aec43436cf1ae..12ec14d170aca5d9bdcca665a631434484ea04b7 100644 --- a/automation-interface/src/main/java/cn/testnewbie/automation/interfacetest/junit5/DBExtension.java +++ b/automation-interface/src/main/java/cn/testnewbie/automation/interfacetest/junit5/DBExtension.java @@ -34,9 +34,9 @@ public class DBExtension implements } /** - * TestInstancePostProcessor定义了用于发布流程测试实例的`Extensions`的API。 + * TestInstancePostProcessor定义了用于发布流程测试实例的"Extensions"的API。 * 常见的用例包括将依赖注入到测试实例中,在测试实例上调用自定义的初始化方法等等。 - * 对于具体的例子,请参考[`MockitoExtension`]和[`SpringExtension`]的源代码。 + * 对于具体的例子,请参考["MockitoExtension"]和["SpringExtension"]的源代码。 * @param testInstance * @param context * @throws Exception diff --git a/automation-interface/src/main/java/cn/testnewbie/automation/interfacetest/step/HttpStep.java b/automation-interface/src/main/java/cn/testnewbie/automation/interfacetest/step/HttpStep.java index 147df92066dc8532d703feb68403d20fc06e985f..dc998ee8d1c50e5fac772755b4f60858bc6d01ff 100644 --- a/automation-interface/src/main/java/cn/testnewbie/automation/interfacetest/step/HttpStep.java +++ b/automation-interface/src/main/java/cn/testnewbie/automation/interfacetest/step/HttpStep.java @@ -31,8 +31,7 @@ public class HttpStep { * * @param url 接口地址 * @param params 表单内容 - * @return - * @throws Exception + * @return http返回值 */ @Step("发送http get请求:'{url}' '{params}'") public String get(String url, HashMap params) { @@ -50,7 +49,7 @@ public class HttpStep { * * @param url 接口地址 * @param body body内容,需要传入一个JSON或者XML字符串,Hutool会自动绑定其对应的Content-Type - * @return + * @return http返回值 */ @Step("发送http post请求") public String post(String url, String body) { @@ -71,8 +70,7 @@ public class HttpStep { * * @param url 接口地址 * @param params 表单内容 - * @return - * @throws Exception + * @return http返回值 */ @Step("发送http post请求:'{url}' '{params}'") public String post(String url, HashMap params) { @@ -88,8 +86,8 @@ public class HttpStep { /** * 验证http接口返回的内容 * - * @param except - * @param httpResponse + * @param except 期望值 + * @param httpResponse http返回值 */ @Step("检验返回值是否含有:'{except}'") public void checkHttpResponse(String except, String httpResponse) { diff --git a/automation-ui/pom.xml b/automation-ui/pom.xml index ba80e945d90ec539e22e585b93da65d27648d2fe..65d69500a5db7f6904db281cd61cadad83b7e353 100644 --- a/automation-ui/pom.xml +++ b/automation-ui/pom.xml @@ -7,10 +7,9 @@ cn.testnewbie.automation automation-parent - 1.0.0 + 1.3.1 - cn.testnewbie.automation automation-ui 1.0.2-SNAPSHOT @@ -18,7 +17,7 @@ cn.testnewbie.automation automation-core - 1.1.13-SNAPSHOT + 1.3.1 org.junit.jupiter diff --git a/example/pom.xml b/example/pom.xml index 0c78cde5c7b0cd0ee6b9bb4585bed649e3350d69..f62141a3c2e5401bcbab10b2be796f3773b24e38 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -23,17 +23,17 @@ cn.testnewbie.automation automation-interface - 1.2.11-SNAPSHOT + 1.3.1 cn.testnewbie.automation automation-email - 1.0.0 + 1.3.1 cn.testnewbie.automation automation-dingding - 1.0.0 + 1.3.1 mysql diff --git a/example/src/main/java/com/testexample/annotation/LoginWithExtension.java b/example/src/main/java/com/testexample/annotation/LoginWithExtension.java index 43bfbf75f8d816b006bd9a9a2c7e4cbd6e22fb5f..52c4f3629075ad75fb471e4386accbe3ae34b52b 100644 --- a/example/src/main/java/com/testexample/annotation/LoginWithExtension.java +++ b/example/src/main/java/com/testexample/annotation/LoginWithExtension.java @@ -19,9 +19,9 @@ import java.util.concurrent.Callable; /** * 该类是一个模版类,需要使用者修改成自己的登录逻辑。 *

- * 功能:扫描`测试类`或者`测试方法`上的 LoginWith 注解,使用注解里面的信息,处理登录逻辑。 + * 功能:扫描"测试类"或者"测试方法"上的 LoginWith 注解,使用注解里面的信息,处理登录逻辑。 * 本例中,登录后获取到的是token,其他接口需要将该token放到请求头里面,作为登录者的标识 - * `测试类`或者`测试类的父类`,必须要有`public HashMap headerMap = new HashMap<>();` + * "测试类"或者"测试类的父类",必须要有"public HashMap<String, String> headerMap = new HashMap<>();" * 调用接口时,headerMap合并其他请求头一起发送到服务器。 * * @author zhanglx @@ -32,7 +32,7 @@ public class LoginWithExtension extends HttpCacheManage { /** * 保存或者获取缓存的登录信息时,使用的key - * 如业务系统唯一的`手机号`、`客户号+帐号`等等 + * 如业务系统唯一的"手机号"、"客户号+帐号"等等 * * @param loginInfo 注解里面的信息 * @return 每个帐号密码的唯一标识 diff --git a/example/src/test/java/com/testexample/interfacetest/LoginWithSimpleTest.java b/example/src/test/java/com/testexample/interfacetest/LoginWithSimpleTest.java index 24ab7a83d6fefbb60521d964016705b6ccd36bb0..148f6ea1ca3aa93c515c89fca4f74fbd38798a05 100644 --- a/example/src/test/java/com/testexample/interfacetest/LoginWithSimpleTest.java +++ b/example/src/test/java/com/testexample/interfacetest/LoginWithSimpleTest.java @@ -19,7 +19,7 @@ public class LoginWithSimpleTest { System.out.println("本测试类 LoginWithSimpleTest ,需要开启`project-demo`服务才能正常执行通过..."); } - + // @LoginWith的例子程序,测试类的父类或者自身必须带有下面这个属性 public HashMap headerMap = new HashMap<>(); @ParameterizedTest(name = "[{argumentsWithNames}]") diff --git a/maven-deploy.bat b/maven-deploy.bat new file mode 100644 index 0000000000000000000000000000000000000000..3beaa38958951d9db7eaa6e209cc94af6073f900 --- /dev/null +++ b/maven-deploy.bat @@ -0,0 +1,7 @@ + +mvn clean deploy -pl ^ +automation-core,^ +automation-interface,^ +automation-ui,^ +automation-email,^ +automation-dingding -am diff --git a/pom.xml b/pom.xml index c87139bed7ddc84d43d38678a32fad1c8f91d602..e0b892702ceaf59516b79cc00a44fab5c9ed0e08 100644 --- a/pom.xml +++ b/pom.xml @@ -6,8 +6,28 @@ 4.0.0 cn.testnewbie.automation automation-parent - 1.0.0 + 1.3.1 pom + testnewbie parent pom + testnewbie-automation parent pom + https://gitee.com/testnewbie-projects/testnewbie-automation + + https://gitee.com/testnewbie-projects/testnewbie-automation.git + + + + Eclipse Public License v2.0 + https://www.eclipse.org/legal/epl-v20.html + + + + + zlx.pvp + lixing zhang + zlx.pvp@163.com + + + automation-core automation-interface @@ -89,7 +109,80 @@ 1.8 + + org.apache.maven.plugins + maven-source-plugin + 2.2.1 + + + attach-sources + + jar-no-fork + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.2.0 + + + attach-javadocs + + jar + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.7 + true + + ossrh + https://s01.oss.sonatype.org/ + true + + + + org.apache.maven.plugins + maven-gpg-plugin + 1.5 + + + sign-artifacts + verify + + sign + + + + + + org.apache.maven.plugins + maven-release-plugin + 2.5.3 + + true + false + release + deploy + + + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots/ + + + ossrh + https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/ + + +