#第一種寫法:土法煉鋼 *** Test Cases *** ${SQL}= Set Variable select Top 3 hospital_code, nhi_code, hospital_name, addr, phone, email, is_chk_hosp from Basic_Hospital where active_flag = '1' ORDER BY hospital_name ASC ${DB_List} Create List ${queryResults}= Query ${SQL} : FOR ${COLUMN} IN RANGE 0 6 \ ${Verify_List} Convert To String ${queryResults[0][${COLUMN}]} \ Append To List ${DB_List} ${Verify_List} : FOR ${COLUMN} IN RANGE 0 6 \ ${Verify_List} Convert To String ${queryResults[1][${COLUMN}]} \ Append To List ${DB_List} ${Verify_List} : FOR ${COLUMN} IN RANGE 0 6 \ ${Verify_List} Convert To String ${queryResults[2][${COLUMN}]} \ Append To List ${DB_List} ${Verify_List} #第二種寫法:搭配*** Keywords ***完成2維陣列 *** Test Cases *** Connect Database ${SQL}= Set Variable select Top 3 hospital_code, nhi_code, hospital_name, addr, phone, email, is_chk_hosp from Basic_Hospital where active_flag = '1' ORDER BY hospital_name ASC ${Query_SQL}= Query ${SQL} ${RowCount} Row Count ${SQL} : FOR ${x} IN RANGE 0 ${RowCount} \ Keyword with for loop ${x} ${Query_SQL} *** Keywords *** Keyword with for loop [Arguments] ${x} ${Query_SQL} : FOR ${y} IN RANGE 0 6 \ Log ${Query_SQL[${x}][${y}]} #第三種寫法:再智慧一點,動態取得DB欄位數 *** Test Cases Connect Database ${DB_List} Create List ${SQL}= Set Variable select Top 3 hospital_code, nhi_code, hospital_name, addr, phone, email, is_chk_hosp from Basic_Hospital where active_flag = '1' ORDER BY hospital_name ASC ${Query_SQL}= Query ${SQL} ${RowCount} Row Count ${SQL} : FOR ${x} IN RANGE 0 ${RowCount} \ ${DB_List}= Keyword with for loop ${x} ${Query_SQL} ${DB_List} *** Keywords *** Keyword with for loop [Arguments] ${x} ${Query_SQL} ${DB_List} ${Find_DB_Column_Num} Convert To String ${Query_SQL[0]} #只取一列資料當代表 #用逗號分開字串(註解不要寫在有=的句子後面) ${DB_Column_Num}= Split String ${Find_DB_Column_Num} , ${Column_Num} Get Length ${DB_Column_Num} #可以取得長度=欄位數 : FOR ${y} IN RANGE 0 ${Column_Num} \ ${Column_String} Convert To String ${Query_SQL[${x}][${y}]} \ Append To List ${DB_List} ${Column_String} [Return] ${DB_List}
總網頁瀏覽量
基礎Note
☪About Me
(1)
免費軟體
(2)
教學
(4)
教學文件
(42)
會計軟體
(1)
電腦系統
(1)
Adapter
(8)
Adobe Premiere
(1)
AlertDialog
(7)
Android App 介紹
(1)
Animation
(1)
API
(2)
APP範例
(1)
Array
(1)
AsyncTask
(1)
Auto Test Case
(32)
AutoCompleteTextView
(1)
Bitmap Drawable
(3)
BroadcastReceiver
(4)
Button
(1)
Codility
(2)
Contact
(4)
DB
(1)
Dialog
(2)
Documents
(1)
Eclipse
(3)
Ellipsize
(1)
File
(4)
Focus
(2)
Fragment
(4)
Gallery
(2)
GIT
(4)
GitHub
(1)
GridView
(8)
HashMap
(1)
HorizontalScrollView
(6)
IIS
(1)
Intent
(3)
IntentService
(1)
Internet
(2)
KeyEvent
(1)
Layout
(1)
ListView
(11)
Log
(1)
Mac / iOS
(11)
Manifest
(1)
Marquee
(2)
Math
(1)
MediaPlayer
(5)
MediaRecorder
(5)
MSMQ
(1)
onClick
(1)
PackageManager
(6)
PHP
(1)
PIS
(3)
PowerManager
(1)
Progress
(2)
SCREEN
(1)
Search
(6)
Service
(1)
SharedPreferences
(3)
SimpleDateFormat
(1)
SonarQube
(1)
Sound Recorder
(1)
Spinner
(2)
SQL server Management
(16)
SQLite
(13)
String
(1)
STS
(5)
SVN
(1)
Thread
(1)
Toast
(3)
Typeface
(1)
Uri
(2)
VB.NET
(17)
VMware
(1)
關於我自己
2016年8月15日 星期一
【Auto Test Case】【RIDE】從DB逐一擷取欄位值搭配迴圈的技巧
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言