Post Views: 2,194
วันนี้เรามาดูตัวแปร ใน Robot Framework กันดีกว่า ดู ๆ ไปตัวแปรมันก็แปลกดีนะ มาดูกันว่าเป็นไงบ้าง
- Case Insensitive –> ตัวพิมพ์เล็ก – พิมพ์ใหญ่เป็นตัวเดียวกัน
- Ignore space –> ไม่สนใจช่องว่าง
- Ignore underscore –> ไม่แคร์ Underscore 555
มาดูประเภทของตัวแปรกัน ดังรูปจ้า
- ค่าคงที่
- List
- Dictionary หรือ Json

ตามตัวอย่าง มารันดูข้อมูลกันจะเห็นได้ว่ามันจะรันตามลำดับ ที่เราแสดง Log to console

ลองดูว่าถ้าเราจะให้แสดง List เฉพาะคำว่า Chotkaew จะทำยังไง ให้มองว่า Thichaluk เป็น index ที่ 0 และ Chotkaew เป็น index ที่ 1

รันดูผลลัพธ์กัน

มาลองดูของ dictionary กันบ้าง ให้แสดงค่าของ Thichaluk

รันดูผลลัพธ์

ทุกคนคงจะมองเห็นการเข้าถึงข้อมูลแต่ละประเภทกันแล้วใช่มั๊ยค่ะ
ต่อไปมาลองสร้าง List กับ Dictionary อย่างง่าย ๆ กัน รูปแบบคำสั่งก็ไปหาดูได้ที่ https://robotframework.org ที่ Libraries –> Builtin ที่ Builtin คลิก View หา Create List กับ Create Dictionary

รันดูผลลัพธ์
