Groovy and SoapUI
Groovy
Groovy JDK,Process Management,Regular Expressions, Getting Started Guide
Date
String VS Array
Map
Find last modified file(a unix/linux way, it is not compatible with windows)
Java
Java API
String
SoapUI
SoapUI API
TestCase,TestRunner
Groovy JDK,Process Management,Regular Expressions, Getting Started Guide
Date
String VS Array
#!/usr/bin/groovy
str = "str1,str2, S333, S566, S88A88G"
def strArray = str.split('[ \t]*,[ \t]*')
println strArray
println strArray.join("-")
Map
def items = [:]
items["key1"] = "4.00"
items["key2"] = "4.02"
println items
items = items.minus(["key2":"4.02"])
// after v1.8.7 items = items.dropWhile {it.key == "key2"}
println items
Find last modified file(a unix/linux way, it is not compatible with windows)
import java.util.regex.Pattern
def lsDateFormat = "%Y-%m-%d_%H:%M:%S" // for ls command
def dateFormat = "yyyy-MM-dd_HH:mm:ss" // for Date
def lscmd = """ls -lt --time-style=""" + "\"+${lsDateFormat}\" "
lscmd += """/home/Prime/cycles/ | grep .*.csv\$ -m 1 | cut -d ' ' -f 6-7"""
def f = File.createTempFile('bash', '.sh')
f.write("#!/bin/bash\n")
f.append(lscmd)
f.append("\n")
def fpath = f.getAbsolutePath()
"chmod +x ${fpath}".execute()
def cmd = fpath
log.info(cmd)
def proc1 = cmd.execute()
proc1.waitFor()
if ( 0 != proc1.exitValue() ) {
throw new Exception("Execute ${cmd} failed.")
}
def str = proc1.in.text
f.delete()
def pattern = Pattern.compile('([^ ]{1,}) (.*)')
def matcher = pattern.matcher(str)
def dStr = (new Date()).format(dateFormat)
if (matcher.find()) {
//count = Integer.valueOf(matcher.group(1));
dStr = matcher.group(1)
fileName = matcher.group(2)
def d = Date.parse(dateFormat, dStr)
log.info(dStr)
log.info("Last modified file: ${fileName}. Modified date: ${d}" )
} else {
log.error("Non file found.")
}
Java
Java API
String
SoapUI
SoapUI API
TestCase,TestRunner
相關文章
- SoapUI入門例項UI
- 使用soapui檢視wsdlUI
- groovy
- [原創]SOAPUI工具介紹UI
- 提高Groovy品質 Groovy 1.5.2釋出
- soapui icon以及resource的理解UI
- Groovy 2.0.6和Groovy 2.1 beta版本釋出
- [Groovy]Groovy指令碼的5種執行方式指令碼
- groovy安裝
- API測試工具SoapUI & Postman對比分析APIUIPostman
- 關於soapUi工具的安裝使用教程UI
- Groovy初學者指南
- Groovy閉包理解
- Groovy動態解析
- Parse CSV file with Groovy
- groovy : 隨機數隨機
- Groovy 2.0釋出
- Groovy 2.0.4 釋出
- Groovy探索 使用集合方法,寫出更加Groovy風格的程式碼
- Java和groovy相互呼叫Java
- groovy之範圍特性
- groovy與javah互相呼叫Java
- Groovy探索 Visitor模式模式
- Groovy 簡單入門
- 用Groovy思考第一章用Groovy簡化Java程式碼Java
- SoapUI壓力測試的指標項說明UI指標
- Groovy探索之Gpath和List的結合 更加Groovy風格的程式碼
- groovy-gradle-task(二)Gradle
- Groovy 語言快速入門
- Groovy-mac環境搭建Mac
- java中呼叫groovy指令碼Java指令碼
- Groovy簡單公式計算公式
- Groovy入門視訊教程
- Groovy基礎語法-list
- 使用soapUI消費SAP Cloud for Customer的web serviceUICloudWeb
- Gradle系列(一) Groovy 基礎Gradle
- 配置Groovy開發環境(Windows)開發環境Windows
- Eclipse 安裝Groovy外掛Eclipse