优化步骤动作中的#分隔符判断

This commit is contained in:
seagull 2019-12-06 14:55:24 +08:00
parent d84eb4f2f1
commit 8a7d971b0e
1 changed files with 8 additions and 5 deletions

View File

@ -1,7 +1,6 @@
package luckyclient.execution.dispose; package luckyclient.execution.dispose;
import org.apache.commons.lang.StringUtils; import cn.hutool.core.util.StrUtil;
import luckyclient.utils.Constants; import luckyclient.utils.Constants;
import luckyclient.utils.LogUtil; import luckyclient.utils.LogUtil;
@ -66,10 +65,14 @@ public class ActionManageForSteps {
*/ */
private static String actionExecute(String actionKeyWord,String testResult){ private static String actionExecute(String actionKeyWord,String testResult){
try{ try{
String keyWord = "";
String actionParams = "";
if(actionKeyWord.contains("#")){
keyWord = actionKeyWord.substring(actionKeyWord.lastIndexOf("#")+1, actionKeyWord.length());
actionParams = actionKeyWord.substring(0, actionKeyWord.lastIndexOf("#"));
}
String keyWord = actionKeyWord.substring(actionKeyWord.lastIndexOf("#")+1, actionKeyWord.length()); if(StrUtil.isNotEmpty(keyWord)&& keyWord.length()>0){
String actionParams = actionKeyWord.substring(0, actionKeyWord.lastIndexOf("#"));
if(StringUtils.isNotEmpty(keyWord)&& keyWord.length()>0){
ActionContext actionContext = new ActionContext(keyWord.toLowerCase()); ActionContext actionContext = new ActionContext(keyWord.toLowerCase());
testResult = actionContext.parse(actionParams, testResult, actionKeyWord); testResult = actionContext.parse(actionParams, testResult, actionKeyWord);
}else { }else {