本文整理汇总了Java中com.qmetry.qaf.automation.util.StringUtil类的典型用法代码示例。如果您正苦于以下问题:Java StringUtil类的具体用法?Java StringUtil怎么用?Java StringUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StringUtil类属于com.qmetry.qaf.automation.util包,在下文中一共展示了StringUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getDataProvider
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
public static final String getDataProvider(Map<String, String> map) {
if ((null == map) || map.isEmpty()) {
return "";
}
if(map.containsKey(params.JSON_DATA_TABLE.name())){
return dataproviders.isfw_json.name();
}
String f = map.get(params.DATAFILE.name());
if (StringUtil.isNotBlank(f)) {
if (f.endsWith(".xls")) {
return StringUtil.isNotBlank(map.get(params.KEY.name())) ? dataproviders.isfw_excel_table.name()
: dataproviders.isfw_excel.name();
} else if (f.endsWith(".json")) {
return dataproviders.isfw_json.name();
} else {
return dataproviders.isfw_csv.name();
}
}
return StringUtil.isNotBlank(map.get(params.SQLQUERY.name())) ? dataproviders.isfw_database.name()
: StringUtil.isNotBlank(map.get(params.KEY.name())) ? dataproviders.isfw_property.name() : "";
}
开发者ID:qmetry,项目名称:qaf,代码行数:23,代码来源:DataProviderFactory.java
示例2: getOptionElement
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
private QAFExtendedWebElement getOptionElement(String loc, String val,
Class<? extends QAFExtendedWebElement> eleClass) {
String optLoc;
if (!val.contains("=")) {
if (StringUtil.isNumeric(val)) {
optLoc = String.format(
".//option[@value='%s' or @lineNo=%s or @id='%s' or contains(.,'%s') ]",
val, val, val, val);
} else {
optLoc = String.format(
".//option[translate(.,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')='%s' or translate(@value,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')='%s' or translate(@id,'abcdefghijklmnopqrstuvwxyz','ABCDEFGHIJKLMNOPQRSTUVWXYZ')='%s']",
val.toUpperCase(), val.toUpperCase(), val.toUpperCase());
}
} else {
String[] parts = val.split("=", 2);
if (parts[0].equalsIgnoreCase("label") || parts[0].equalsIgnoreCase("text")) {
optLoc = String.format(".//option[contains(.,'%s')]", parts[1]);
} else if (parts[0].equalsIgnoreCase("lineNo")) {
optLoc = String.format(".//option[%d]", Integer.parseInt(parts[1]) + 1);
} else {
optLoc = String.format(".//option[@%s='%s']", parts[0], parts[1]);
}
}
return new QAFExtendedWebElement(getElement(loc, eleClass), By.xpath(optLoc));
}
开发者ID:qmetry,项目名称:qaf,代码行数:27,代码来源:ElementInteractor.java
示例3: verifyUiElements
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
final public boolean verifyUiElements(String... fieldmapnames) {
Field[] flds = this.getClass().getDeclaredFields();
List<String> includeLst = null;
boolean outcome = true;
if ((fieldmapnames != null) && (fieldmapnames.length > 0)) {
includeLst = Arrays.asList(fieldmapnames);
}
for (Field fld : flds) {
fld.setAccessible(true);
if (fld.isAnnotationPresent(UiElement.class)) {
UiElement map = fld.getAnnotation(UiElement.class);
String mapName = StringUtil.isNotBlank(map.viewLoc()) ? map.viewLoc() : fld.getName();
if ((includeLst == null) || includeLst.contains(mapName)) {
outcome = outcome && verifyUiData(fld);
}
}
}
return outcome;
}
开发者ID:qmetry,项目名称:qaf,代码行数:20,代码来源:BaseFormDataBean.java
示例4: verifyUiVaules
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
final public boolean verifyUiVaules(String... fieldmapnames) {
Field[] flds = this.getClass().getDeclaredFields();
List<String> includeLst = null;
boolean outcome = true;
if ((fieldmapnames != null) && (fieldmapnames.length > 0)) {
includeLst = Arrays.asList(fieldmapnames);
}
for (Field fld : flds) {
fld.setAccessible(true);
if (fld.isAnnotationPresent(UiElement.class)) {
UiElement map = fld.getAnnotation(UiElement.class);
String mapName = StringUtil.isNotBlank(map.viewLoc()) ? map.viewLoc() : fld.getName();
if ((includeLst == null) || includeLst.contains(mapName)) {
outcome = outcome && verifyUiData(fld);
}
}
}
return outcome;
}
开发者ID:qmetry,项目名称:qaf,代码行数:20,代码来源:BaseFormDataBean.java
示例5: fetchUiData
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
private Object fetchUiData(Field field) {
try {
Method m = this.getClass().getDeclaredMethod("fetch" + StringUtil.getTitleCase(field.getName()));
m.setAccessible(true);
logger.debug("invoking custom fetch method for field " + field.getName());
return m.invoke(this);
} catch (Exception e) {
}
UiElement map = field.getAnnotation(UiElement.class);
if ((null == map)) {
return null;
}
Type type = map.fieldType();
String loc = map.fieldLoc();
Class<? extends QAFExtendedWebElement> eleClass = map.elementClass();
return interactor.fetchValue(loc, type,eleClass);
}
开发者ID:qmetry,项目名称:qaf,代码行数:20,代码来源:BaseFormDataBean.java
示例6: verifyUiData
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
private boolean verifyUiData(Field fld) {
UiElement map = fld.getAnnotation(UiElement.class);
Type type = map.fieldType();
String loc = map.fieldLoc();
String depends = map.dependsOnField();
String depVal = map.dependingValue();
Class<? extends QAFExtendedWebElement> eleClass = map.elementClass();
try {
if (StringUtil.isBlank(depends) || checkParent(depends, depVal)) {
return interactor.verifyValue(loc, String.valueOf(getBeanData(loc)), type,eleClass);
}
} catch (Exception e1) {
e1.printStackTrace();
return false;
}
// Skipped so just return success
return true;
}
开发者ID:qmetry,项目名称:qaf,代码行数:21,代码来源:BaseFormDataBean.java
示例7: absractArgsAandSetDesciption
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
private void absractArgsAandSetDesciption() {
String prefix = BDDKeyword.getKeywordFrom(name);
if (actualArgs == null || actualArgs.length == 0) {
final String REGEX = ParamType.getParamValueRegx();
List<String> arguments = new ArrayList<String>();
description = removePrefix(prefix, name);
Pattern p = Pattern.compile(REGEX);
Matcher m = p.matcher(description); // get a matcher object
int count = 0;
while (m.find()) {
String arg = description.substring(m.start(), m.end());
arguments.add(arg);
count++;
}
for (int i = 0; i < count; i++) {
description = description.replaceFirst(Pattern.quote(arguments.get(i)),
Matcher.quoteReplacement("{" + i + "}"));
}
actualArgs = arguments.toArray(new String[]{});
}
name = StringUtil
.toCamelCaseIdentifier(description.length() > 0 ? description : name);
}
开发者ID:qmetry,项目名称:qaf,代码行数:27,代码来源:StringTestStep.java
示例8: quoteParams
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
public static String quoteParams(String call) {
String exp = "(\\s|^)\\$\\{[\\w\\.]*}(\\s|$)";
Pattern p = Pattern.compile(exp);
Matcher matcher = p.matcher(call);
String resultString = new String(call);
while (matcher.find()) {
for (int i = 0; i <= matcher.groupCount(); i++) {
String unQuatedparam = (matcher.group(i));
if (StringUtil.isNotBlank(unQuatedparam)) {
String quatedparam =
unQuatedparam.replace("${", "'${").replace("}", "}'");
resultString = new String(StringUtil.replace(new String(resultString),
unQuatedparam, quatedparam));
}
}
}
return resultString;
}
开发者ID:qmetry,项目名称:qaf,代码行数:19,代码来源:BDDDefinitionHelper.java
示例9: getTestsFromFile
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
@Factory
public Object[] getTestsFromFile(ITestContext context) {
if (null != context) {
includeGroups = Arrays.asList(context.getIncludedGroups());
excludeGroups = Arrays.asList(context.getExcludedGroups());
}
String sanariosloc = MetaDataScanner.getParameter(context, "scenario.file.loc");
if (StringUtil.isNotBlank(sanariosloc)) {
ConfigurationManager.getBundle().setProperty("scenario.file.loc", sanariosloc);
}
System.out.printf("include groups %s\n exclude groups: %s Scanarios location: %s \n", includeGroups,
excludeGroups, sanariosloc);
logger.info("scenario.file.loc"
+ ConfigurationManager.getBundle().getStringArray("scenario.file.loc", "./scenarios"));
for (String fileName : ConfigurationManager.getBundle().getStringArray("scenario.file.loc", "./scenarios")) {
process(fileName);
}
logger.info("total test found: " + scenarios.size());
return scenarios.toArray(new Object[scenarios.size()]);
}
开发者ID:qmetry,项目名称:qaf,代码行数:26,代码来源:ScenarioFactory.java
示例10: parseStepCall
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
protected TestStep parseStepCall(Object[] statement, String referece, int lineNo) {
String currStepName = (String) statement[0];
Object[] currStepArgs = null;
try {
currStepArgs = (StringUtil.isNotBlank((String) statement[1]))
? gson.fromJson((String) statement[1], Object[].class) : null;
} catch (JsonSyntaxException jse) {
logger.error(jse.getMessage() + statement[1], jse);
}
String currStepRes = statement.length > 2 ? (String) statement[2] : "";
StringTestStep step = new StringTestStep(currStepName, currStepArgs);
step.setResultParamName(currStepRes);
step.setFileName(referece);
step.setLineNumber(lineNo);
return step;
}
开发者ID:qmetry,项目名称:qaf,代码行数:21,代码来源:AbstractScenarioFileParser.java
示例11: addAssertionLog
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
public void addAssertionLog(String msg, MessageTypes type) {
CheckpointResultBean bean = new CheckpointResultBean();
bean.setMessage(msg);
bean.setType(type);
boolean added = addCheckpoint(bean);
if (added && StringUtil.isBlank(getLastCapturedScreenShot())
&& ((ApplicationProperties.FAILURE_SCREENSHOT.getBoolenVal(true) && (type == MessageTypes.Fail))
|| ((type != MessageTypes.Info)
&& ApplicationProperties.SUCEESS_SCREENSHOT.getBoolenVal(false)))) {
takeScreenShot();
}
bean.setScreenshot(getLastCapturedScreenShot());
setLastCapturedScreenShot("");
if (type == MessageTypes.Fail) {
verificationErrors.append(msg);
}
}
开发者ID:qmetry,项目名称:qaf,代码行数:22,代码来源:AssertionService.java
示例12: captureScreenShot
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
private String captureScreenShot() {
String filename = StringUtil.createRandomString(getTestCaseName()) + ".png";
try {
selenium.captureEntirePageScreenshot(getScreenShotDir() + filename, "");
} catch (Exception e) {
try {
selenium.windowFocus();
} catch (Throwable t) {
logger.error(t);
}
selenium.captureScreenshot(getScreenShotDir() + filename);
}
lastCapturedScreenShot = filename;
logger.info("Captured screen shot: " + lastCapturedScreenShot);
return filename;
}
开发者ID:qmetry,项目名称:qaf,代码行数:17,代码来源:AssertionService.java
示例13: getResults
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
@Override
public String getResults(Collection<CheckpointResultBean> bean) {
StringBuilder sb = new StringBuilder(SEC_Header);
for (CheckpointResultBean checkpointResultBean : bean) {
String msg = checkpointResultBean.getMessage();
if (StringUtil.isNotBlank(checkpointResultBean.getScreenshot())) {
msg = msg + formatScreenshot(checkpointResultBean.getScreenshot());
}
sb.append(MessageTypes.valueOf(checkpointResultBean.getType()).formatMessage(msg));
if (!checkpointResultBean.getSubCheckPoints().isEmpty()) {
sb.append(getResults(checkpointResultBean.getSubCheckPoints()));
}
}
sb.append(SEC_Footer);
return sb.toString();
}
开发者ID:qmetry,项目名称:qaf,代码行数:17,代码来源:HtmlCheckpointResultFormatter.java
示例14: addAssertionLog
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
public void addAssertionLog(String msg, MessageTypes type) {
logger.debug(type.formatText(msg));
CheckpointResultBean bean = new CheckpointResultBean();
bean.setMessage(msg);
bean.setType(type);
boolean added = addCheckpoint(bean);
if (added && StringUtil.isBlank(getLastCapturedScreenShot())
&& ((ApplicationProperties.FAILURE_SCREENSHOT.getBoolenVal(true) && (type.isFailure()))
|| ((type != MessageTypes.Info)
&& ApplicationProperties.SUCEESS_SCREENSHOT.getBoolenVal(false)))) {
takeScreenShot();
}
bean.setScreenshot(getLastCapturedScreenShot());
setLastCapturedScreenShot("");
if (type == MessageTypes.Fail) {
int verificationErrors = getVerificationErrors() +1;
getContext().setProperty(VERIFICATION_ERRORS, verificationErrors);
}
}
开发者ID:qmetry,项目名称:qaf,代码行数:24,代码来源:QAFTestBase.java
示例15: beforeInitialize
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
@Override
public void beforeInitialize(Capabilities desiredCapabilities) {
if (ConfigurationUtils.getBaseBundle().getString("remote.server", "").contains("perfecto")) {
String eclipseExecutionId = ConfigurationUtils.getExecutionIdCapability();
if (StringUtil.isNotBlank(eclipseExecutionId)) {
((DesiredCapabilities) desiredCapabilities)
.setCapability("eclipseExecutionId", eclipseExecutionId);
}
}
}
开发者ID:Project-Quantum,项目名称:Quantum,代码行数:12,代码来源:PerfectoDriverListener.java
示例16: setSeleniumLog
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
public static void setSeleniumLog(ITestResult tr, String log) {
String id = StringUtil.createRandomString("sLog");
Reporter.log("<a href=\"javascript:toggleElement('" + id + "', 'block')\">View SeleniumLog</a>" + "\n");
Reporter.log("<div id=\"" + id
+ "\" style=\"display:none;position:absolute;overflow: auto; opacity: 0.95;filter:alpha(opacity=95);background-color:#eeeeee;height:300px;z-lineNo: 9002;border:1px outset;\">"
+ log + "</div><br>");
}
开发者ID:qmetry,项目名称:qaf,代码行数:8,代码来源:HtmlReportService.java
示例17: getFailureMessage
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
private String getFailureMessage(Throwable t) {
if (null == t)
return "";
String msg = t.getMessage();
if (StringUtil.isNotBlank(msg))
return msg;
return t.toString();
}
开发者ID:qmetry,项目名称:qaf,代码行数:9,代码来源:QAFTestNGListener.java
示例18: deployResult
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
private void deployResult(ITestResult tr, ITestContext context) {
QAFTestBase stb = TestBaseProvider.instance().get();
try {
if ((tr.getMethod() instanceof TestNGScenario) && ((tr.getStatus() == ITestResult.FAILURE)
|| (tr.getStatus() == ITestResult.SUCCESS || tr.getStatus() == ITestResult.SKIP))) {
ConstructorOrMethod testCase = tr.getMethod().getConstructorOrMethod();
testCase.getMethod().getAnnotation(Test.class);
TestCaseRunResult result = tr.getStatus() == ITestResult.SUCCESS ? TestCaseRunResult.PASS
: tr.getStatus() == ITestResult.FAILURE ? TestCaseRunResult.FAIL : TestCaseRunResult.SKIPPED;
// String method = testCase.getName();
String updator = getBundle().getString("result.updator");
if (StringUtil.isNotBlank(updator)) {
Class<?> updatorCls = Class.forName(updator);
TestCaseResultUpdator updatorObj = (TestCaseResultUpdator) updatorCls.newInstance();
TestNGScenario scenario = (TestNGScenario) tr.getMethod();
Map<String, Object> params = new HashMap<String, Object>(scenario.getMetaData());
params.put("duration", tr.getEndMillis() - tr.getStartMillis());
ResultUpdator.updateResult(result, stb.getHTMLFormattedLog() + stb.getAssertionsLog(), updatorObj,
params);
}
}
} catch (Exception e) {
logger.warn("Unable to deploy result", e);
}
}
开发者ID:qmetry,项目名称:qaf,代码行数:36,代码来源:QAFTestNGListener2.java
示例19: createMethodResult
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
/**
* should be called on test method completion
*
* @param context
* @param result
*/
public static void createMethodResult(ITestContext context, ITestResult result,
List<LoggingBean> logs, List<CheckpointResultBean> checkpoints) {
try {
String dir = getClassDir(context, result);
MethodResult methodResult = new MethodResult();
methodResult.setSeleniumLog(logs);
methodResult.setCheckPoints(checkpoints);
methodResult.setThrowable(result.getThrowable());
updateOverview(context, result);
String fileName = StringUtil.toTitleCaseIdentifier(getMethodName(result));
String methodResultFile = dir + "/" + fileName;
File f = new File(methodResultFile + ".json");
if (f.exists()) {
// if file already exists then it will append some random
// character as suffix
fileName += StringUtil.getRandomString("aaaaaaaaaa");
// add updated file name as 'resultFileName' key in metaData
methodResultFile = dir + "/" + fileName;
updateClassMetaInfo(context, result, fileName);
} else {
updateClassMetaInfo(context, result, fileName);
}
writeJsonObjectToFile(methodResultFile + ".json", methodResult);
} catch (Exception e) {
logger.warn(e.getMessage(), e);
}
}
开发者ID:qmetry,项目名称:qaf,代码行数:42,代码来源:ReporterUtil.java
示例20: verifyValue
import com.qmetry.qaf.automation.util.StringUtil; //导入依赖的package包/类
public boolean verifyValue(final String loc, final String val, final Type type,
Class<? extends QAFExtendedWebElement> eleClass) {
Object actualVal = null;
try {
actualVal = fetchValue(loc, type, eleClass);
boolean result = StringUtil.seleniumEquals(String.valueOf(actualVal), val);
report("value", result, val, actualVal);
return result;
} catch (Exception e) {
report("value", false, val, actualVal);
return false;
}
}
开发者ID:qmetry,项目名称:qaf,代码行数:14,代码来源:ElementInteractor.java
注:本文中的com.qmetry.qaf.automation.util.StringUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论