<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Naphon W on Medium]]></title>
        <description><![CDATA[Stories by Naphon W on Medium]]></description>
        <link>https://medium.com/@Killfriend21?source=rss-a6204a8c4934------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*wHId8q9p0x1c0W3IgNZu9A.jpeg</url>
            <title>Stories by Naphon W on Medium</title>
            <link>https://medium.com/@Killfriend21?source=rss-a6204a8c4934------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 23:47:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@Killfriend21/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[เปลี่ยน Raspberry pi ให้กลายเป็นเครื่องเล่นเกมส์[Retro Pie]]]></title>
            <link>https://medium.com/@Killfriend21/%E0%B9%80%E0%B8%9B%E0%B8%A5%E0%B8%B5%E0%B9%88%E0%B8%A2%E0%B8%99-raspberry-pi-%E0%B9%83%E0%B8%AB%E0%B9%89%E0%B8%81%E0%B8%A5%E0%B8%B2%E0%B8%A2%E0%B9%80%E0%B8%9B%E0%B9%87%E0%B8%99%E0%B9%80%E0%B8%84%E0%B8%A3%E0%B8%B7%E0%B9%88%E0%B8%AD%E0%B8%87%E0%B9%80%E0%B8%A5%E0%B9%88%E0%B8%99%E0%B9%80%E0%B8%81%E0%B8%A1%E0%B8%AA%E0%B9%8C-retro-pie-dc83f1e41a1f?source=rss-a6204a8c4934------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc83f1e41a1f</guid>
            <category><![CDATA[games]]></category>
            <category><![CDATA[retropi]]></category>
            <category><![CDATA[raspberry-pi]]></category>
            <dc:creator><![CDATA[Naphon W]]></dc:creator>
            <pubDate>Sun, 23 Feb 2020 09:52:34 GMT</pubDate>
            <atom:updated>2020-02-24T15:33:09.025Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yN577_lPwi6sd8Fv" /><figcaption>Photo by <a href="https://unsplash.com/@hbtography?utm_source=medium&amp;utm_medium=referral">Harrison Broadbent</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>หลังจากกระแส IOT ได้ซาไป พร้อมกับบอร์ด Raspberry pi ที่นอนแน่นิ่งอยู่ใน Case ที่จะเพียบพร้อมไปด้วย IO ต่างๆ ที่ต่ออยู่แบบพร้อมใช้งาน นานเท่าไหร่แล้วที่มันไม่กระแสไฟไหลผ่าน เพื่อปลุกให้มันตื่นมาทำงานอีกครั้ง เข้าเรื่องกันเลยดีกว่า</p><p>ช่วงนี้ผมซื้อของจาก AliExpress บ่อยๆ แล้วไปสะดุดเจอของอยู่ชิ้นนึง ที่จะเหมือนจะเป็นของที่ทำให้ Raspberry pi ของผมกับมามีชีวิตอีกครั้ง(ที่จริงมันก็ยังไม่ตายนะ) นั้นคือ Case Raspberry pi ที่หน้าตาเหมือนเครื่องเกมส์ตลับสมัยก่อน ตัดสินใจ order อย่างไม่ต้องคิดเลย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/841/1*6WNG4agZrVSZ5FVaPD5kMA.png" /><figcaption><a href="http://retroflag.com/SUPERPi-CASE-J.html">http://retroflag.com/SUPERPi-CASE-J.html</a></figcaption></figure><p>และบทความนี้ ผมจะพาทุกคนมาเปลี่ยน Raspberry pi ของเรา ให้เป็นเครื่องเล่นเกมส์ ด้วย Retro Pie</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/638/1*83XQSKbYpiT02Aw9ZdzQDA.png" /><figcaption><a href="https://retropie.org.uk/">https://retropie.org.uk</a></figcaption></figure><h3>Retro Pie</h3><p>Retro Pie ก็คือสิ่งที่จะเปลี่ยน Raspberry pi ของคุณให้กลายเป็นเครื่องเล่นเกมส์ยุค Retro นั้นเอง โดยสามารถไปศึกษารายละเอียดเพิ่มเติมได้ที่ <a href="https://retropie.org.uk/docs/">https://retropie.org.uk/docs/</a> ได้เลย</p><p><strong>สิ่งที่ต้องการ</strong></p><ol><li>Board Raspberry pi ของผมเป็น Raspberry pi 3 model B รุ่นปี 2015 ถ้าจะดีที่สุดเขาแนะนำให้ใช้ pi 3 model B+ใครอยากได้เล็กๆหน่อยก็ Raspberry Pi Zero W (ตอนนี้ Raspberry pi 4ยัง ไม่รองรับนะครับ)</li><li>Micro SD Card 8 GB หรือจะมากกว่านี้ก็ได้ ในที่นี้ผมใช้ Sandisk Ultra 32GB class 10</li><li>Card Reader ที่มีช่องเสียบ Micro SD Card เพราะเราต้องใช้ต่อกับ Computer เพื่อ install Retro Pie</li><li>สาย HDMI ไว้ต่อกับ TV</li><li>จอยเกมส์ หรือ คีย์บอร์ด</li><li>Wifi Dongle หรือ สาย Lan กรณีใช้งาน Raspberry pi 3 model B หรือรุ่นที่ต่ำว่านี้ ส่วน Model B+ มี Module Wifi ติดมากับตัว Board แล้ว</li><li>โปรแกรม <a href="https://etcher.io/">Etcher</a> เอาไว้ mount retro pi image ครับ</li><li>Retro Pie Image โหลดได้ที่ <a href="https://retropie.org.uk/download/">https://retropie.org.uk/download/</a> เลือก download ตาม Raspberry pi ที่ต้องการ</li><li>WinSCP สำหรับ Windows หรือ FileZilla สำหรับ Mac เอาไว้ วางไฟล์ Rom แบบ SFTP</li><li>ส่วนไฟล์เกมส์(Rom) หาตาม Internet เยอะมากครับ อันนี้ต้องไปหากันเองนะครับ</li></ol><h4>เมื่อของทุกอย่างพร้อมแล้ว มาติดตั้งกันเลยครับ</h4><ol><li>เปิดโปรแกรม Etcher เลยครับ(เสียบ Micro SD Card กับ Card Reader ให้เรียบร้อยนะ)</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*rO-58h1m2A1UVOZiHWjY6w.png" /></figure><p>2. เลือก Retro Pie Image ที่ดาวน์โหลดมา แล้วเลือกไปที่ Drive Micro SD Card ของเรา จากนั้นกดที่ Flash ได้เลยครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*YacYtjmgHybjlhL-SEeDgg.png" /></figure><p>3. รอให้ Flash เสร็จครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/796/1*JYDjbAriv9fNKiEizJMyFg.png" /></figure><p>4. เสร็จเรียบร้อย ใช้เวลาประมาณ 3 นาที</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/576/1*ttT8r6PAgey0TMMQ_SDTXw.png" /><figcaption>เสร็จแล้ว</figcaption></figure><p>5. นำ Micro SD Card ของเราที่ติดตั้ง Retro Pie เสร้จแล้ว ไปเสียบที่ Raspberry pi ได้เลยครับ</p><p>6. ต่อ Adaptor, Wifi Dongle และ Joy Stick หรือ Keyboard ให้เรียบร้อย ขั้นตอนต่อไป เราจะไปทำการ Configure เจ้า Retro Pie กัน</p><h3><strong>การตั้งค่า WiFi</strong></h3><p>โดยเข้าไปที่ Retropie menu จากนั้นเลือก Configure WIFI</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*OcoHTqLJpekCunfS.png" /><figcaption><a href="https://github.com/RetroPie/RetroPie-Setup/wiki/Wifi">https://github.com/RetroPie/RetroPie-Setup/wiki/Wifi</a></figcaption></figure><p>เลือก Connect to WiFi network</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/0*N0wrQSQc31DiR2a-.png" /><figcaption><a href="https://github.com/RetroPie/RetroPie-Setup/wiki/Wifi">https://github.com/RetroPie/RetroPie-Setup/wiki/Wifi</a></figcaption></figure><p>เลือก WiFi ที่เราต้องการเชื่อมต่อครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/0*99vMz54cF7k4JzBq.png" /><figcaption><a href="https://github.com/RetroPie/RetroPie-Setup/wiki/Wifi">https://github.com/RetroPie/RetroPie-Setup/wiki/Wifi</a></figcaption></figure><p>พิมพ์ Password WiFi จากนั้นเลือกที่ OK (ขั้นตอนนี้ต้องการ Keyboard)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/0*ru3XGXw0uu__-4GM.png" /></figure><p>ถ้าสำเร็จ จะเห็นชื่อ WiFi ที่ เราทำการ Connect แสดงที่หน้าจอครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/0*hZMUwafTU5hSPRHp.png" /></figure><p>หรือถ้าเราไม่มี Keyboard ก็สามารถ Configure WiFi ได้ครับ โดยจะต้องนำ Micro SD card ที่เราทำไว้ เสียบเข้ากับ computer จากนั้นเราไปที่ folder boot จากนั้นทำการสร้างไฟล์ wifikeyfile.txt ไว้ โดยให้ใส่ข้อมูล ชื่อ WiFi และ Password ลงไปในไฟล์ จากนั้น save</p><pre>ssid=&quot;NETWORK_NAME&quot;<br>psk=&quot;NETWORK_PASSWORD&quot;</pre><p>จากนั้นนำ Micro SD Card ของเราเสียบเข้า กับ raspberry pi จากนั้น เข้าไปที่ Retropie menu แล้วเลือก Configure WIFI จากนั้นเลือก Import wifi credential from /boot/wifikeyfile.txt แล้วกดปุ่ม OK</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/0*aUFlCiu-FDnoSMdS.png" /></figure><h3>วิธีการนำ Roms ใส่เข้าไปใน Retro Pie</h3><p>วิธีการนำ Roms ไปรันบน Retro Pie มี อยู่ 2 วิธีนะครับ</p><ol><li>ใช้ส่งไฟล์ผ่าน USB</li><li>ส่งผ่าน SFTP Server</li></ol><p>ซึ่งมาดูวิธีแรกกันก่อน สิ่งที่ต้องมีนั้นคือ USB Drive 1 อันครับ แล้วทำตามนี้</p><ol><li>Format USB Drive ให้เป็น FAT32 หรือ NTFS ใครเป็นแล้วไม่ต้อง Format ก็ได้ครับ</li><li>สร้าง Folder ชื่อว่า “retropie” บน USB Drive</li><li>จากนั้น นำ USB ไปต่อกับ Raspberry pi ให้สังเกตุไฟกระพริบนะครับ</li><li>เมื่อไฟหยุดกระพริบแล้ว ให้ถอด USB Drive ออกจาก Raspberry pi แล้วต่อเข้ากับ Computer</li><li>Copy ไฟล์ Roms ที่ต้องการไปวางไว้ที่ retropie/roms</li><li>เมื่อวางไฟล์เสร็จแล้ว ให้นำ USB Drive ไปเสียบกับ Raspberry pi ตัว Raspberry pi จะทำการ copy ไฟล์ Roms ของเราเข้าไปใช้งาน</li><li>เมื่อไฟหยุดกระพริบ ให้เราไป Restart Emulator โดย เลือก Restart EmulatorStation จาก Start Menu</li></ol><p>วิธีที่สองคือการส่งไฟล์ Roms ผ่าน SFTPอันนี้ต้องต่อ Raspberry pi ของเราต้องอยู่ในวง Lan เดียวกันกับ Computer เรานะครับ มาเริ่มกันเลย</p><ol><li>ไป Enable SSH ใน Retro Pie กันก่อนเลย</li><li>เข้าโปรแกรม WinSCP หรือ FileZilla บนเครื่องของเรา</li><li>จากนั้นให้ใส่ข้อมูลตามนี้นะครับ</li></ol><pre>Host Name: retropie <br>Username: pi <br>Password:raspberry <br>Port: 22</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*y8JtNbVj4rsnpv5GWj-Vlw.png" /><figcaption>กรณีใช้ FileZilla</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/1*hM_K2RLmyUG9PWswpOZSjg.png" /><figcaption>กรณีใช้WinSCP</figcaption></figure><p>4. เอาไฟล์ Roms ที่ต้องการไปวางไว้ที่ retropie/roms ได้เลยครับ</p><p>5. จากนั้นก็ Restart Emulator โดย เลือก Restart EmulatorStation จาก Start Menu เป็นอันเสร็จสิ้น</p><p>และแล้ว Raspberry Pi ที่ฝุ่นจับของเราก็มีประโยชน์ขึ้นมาบ้างแล้วครับ</p><p>ขอให้มีความสุขกับการเล่นเกมส์ ครับ</p><h3>อ้างอิง</h3><pre><a href="https://retropie.org.uk/">https://retropie.org.uk</a><br><a href="https://www.raspberrypi.org/">https://www.raspberrypi.org</a></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc83f1e41a1f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ทำ Automation Test บน Windows Form Application โดย WhiteLibrary Robot Framework [Chapter 2]]]></title>
            <link>https://medium.com/@Killfriend21/%E0%B8%97%E0%B8%B3-automation-test-%E0%B8%9A%E0%B8%99-windows-form-application-%E0%B9%82%E0%B8%94%E0%B8%A2-whitelibrary-robot-framework-chapter-2-a576f2eaaea5?source=rss-a6204a8c4934------2</link>
            <guid isPermaLink="false">https://medium.com/p/a576f2eaaea5</guid>
            <category><![CDATA[white-library]]></category>
            <category><![CDATA[window-form-application]]></category>
            <category><![CDATA[robot-framworks]]></category>
            <category><![CDATA[automatetest]]></category>
            <category><![CDATA[uitest]]></category>
            <dc:creator><![CDATA[Naphon W]]></dc:creator>
            <pubDate>Mon, 03 Feb 2020 11:10:21 GMT</pubDate>
            <atom:updated>2021-08-24T08:08:26.800Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/435/0*A3A_nSEUEDbKOj71.png" /><figcaption><a href="https://robotframework.org/">https://robotframework.org</a></figcaption></figure><p>หลังจากที่เราพอรู้จักและติดตั้งเจ้า Robot Framework และ พระเอกของเรานั้นคือ เจ้า White Library ไปเป็นที่เรียบร้อยแล้ว ส่วนใครยังไม่รู้จักว่า Robot Framework คืออะไร ผมแนะนำ Link ข้างล่างเลยครับ</p><p><a href="https://medium.com/@Killfriend21/%E0%B8%97%E0%B8%B3-automation-test-%E0%B8%9A%E0%B8%99-windows-form-application-%E0%B9%82%E0%B8%94%E0%B8%A2-whitelibrary-robot-framework-%E0%B8%89%E0%B8%9A%E0%B8%B1%E0%B8%9A%E0%B9%80%E0%B8%A3%E0%B8%B4%E0%B9%88%E0%B8%A1%E0%B8%95%E0%B9%89%E0%B8%99-35b3aaa48c6b">ทำ Automation Test บน Windows Form Application โดย WhiteLibrary Robot Framework ฉบับเริ่มต้น</a></p><p>ครั้งนี้ผมจะมาแนะนำให้รู้จักกับ Library ที่จะมาเป็นตัวเสริมพลังให้การเขียน UI Test ของเราให้มีประสิทธิภาพมากยิ่งขึ้น</p><p>มาเริ่มกันที่ตัวแรกกันเลยนั้นคือ</p><h3>BuildIn</h3><p>BuildIn เป็น Standard Library ของ Robot Framework ซึ่งตัวนี้จะถูก Import โดยอัตโนมัติอยู่แล้ว ซึ่งความสามารถ ของ Library ตัวนี้ คือเรา สามารถใช้ คำสั่งเช่น Log, Sleep, Should Be Equal, Should Contain, Should Be True และอีกมากมาย</p><p>รายละเอียดเพิ่มเติมจะอยู่ตรงนี้</p><p><a href="https://robotframework.org/robotframework/latest/libraries/BuiltIn.html#Keywords"><strong>BuildIn documentation</strong></a></p><h3><strong>OperatingSystem</strong></h3><p>Operating System เป็น Standard Library ของ Robot Framework นั้นหมายความว่า มันถูกติดตั้งมาพร้อมกับเจ้า Robot Framework ตั้งแต่ต้นแล้ว เราไม่ต้องติดตั้งเพิ่มเหมือน White Library</p><p>ความสามารถของ OperatingSystem Library คือ เราสามารถรัน command ได้เหมือน Powershell หรือ Bash ได้เลย อีกทั้งยังสามารถ Create, Move, Copy File หรือ Directory หรือทำได้แม้กระทั้ง ดูว่า Directory ที่เราสนใจนั้น มีไฟล์อะไรบ้าง มีกี่ไฟล์ หรือ จะ Set Enviroment Variable ก็สามารถทำได้</p><p>รายละเอียดเพิ่มเติม ว่ามีคำสั่งอะไรให้ใช้บ้าง</p><p><a href="https://robotframework.org/robotframework/latest/libraries/OperatingSystem.html"><strong>Keyword documentation</strong></a></p><h3>การใช้งาน</h3><p>เพิ่ม Library OperatingSystem เข้าไปใน Setting ได้เลย ตัวอย่างการใช้งานก็จะตามนี้ครับ</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5e30c703ead13c4b2d98948f41ce40d7/href">https://medium.com/media/5e30c703ead13c4b2d98948f41ce40d7/href</a></iframe><p>จากนั้น Run ใน cmd ได้เลยครับ</p><pre>robot --outputdir output sample.robot</pre><p>ผลใส่ option --outputdir output ไปด้วย เนื่องจากอยากเก็บ Tested Result ไว้ใน Folder output แทนที่จะให้อยู่รวมกับไฟล์ sample.robot</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/290/1*a4ki2BOxsPPYTSuI1dZO2w.png" /><figcaption>โครงสร้าง ของ Folder</figcaption></figure><h3>DatabaseLibrary</h3><p>ตัวนี้ถือเป็น Library ที่สำคัญอีกตัวหนึ่ง ซึ่งเป็น Library ที่ทำให้เรา Access เข้าไปใน Database ได้ การใช้งานก็ไม่ยาก มาเริ่มกันเลยครับ</p><p>ขั้นแรกคือเราต้อง Install เจ้า DatabaseLibrary กันก่อนครับ โดยพิมพ์ คำสั่งตามนี้ ลงใน cmd</p><pre>pip install -U robotframework-databaselibrary</pre><p>ขั้นตอนต่อไปคือเราต้องดูว่าเราใช้ Database อะไรอยู่เช่น Excel, MsSQL, MySQL, SQLite ซึ่ง Database ที่ผมใช้คือ MySQL ดังนั้น ผมจำเป็นต้อง Install pymysql ด้วย</p><p>พิมพ์ตามนี้ ใน cmd แล้วกด Enter โลด</p><pre>python3 -m pip install PyMySQL</pre><p>ส่วนใครใช้อย่างอื่นนอกเหนือจาก MySQL ให้เข้าไปดูตัวอย่าง <a href="https://github.com/franz-see/Robotframework-Database-Library/tree/master/test">ที่นี่</a> ครับ</p><h3><strong>การใช้งาน</strong></h3><p>เพิ่ม Library DatabaseLibrary เข้าไปใน Setting ได้เลย การใช้งานเบื้องต้นก็จะประมาณนี้ครับ</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f4fb5c7c27366ea393cb4884e8e20e13/href">https://medium.com/media/f4fb5c7c27366ea393cb4884e8e20e13/href</a></iframe><p>จากนั้นก็ Run โดยพิมพ์ตามนี้ ใน cmd ครับ</p><pre>robot --outputdir output sample.robot</pre><h3>ArchiveLibrary</h3><p>เป็น Library สร้าง, เช็คไฟล์ และ Extract ไฟล์ที่เป็น .Zip หรือ .Tar ได้ Library ตัวนี้จำเป็นจะต้องติดตั้งเพิ่ม ซึ่งการติดตั้งก็ง่ายๆ เลยครับ</p><p>ให้พิมพ์ตามนี้ ลงใน cmd ได้เลย</p><pre>pip install robotframework-archivelibrary</pre><p>ส่วนคำสั่งที่สามารถใช้ได้ จะอยู่ในนี้นะครับ</p><h4><a href="http://bulkan.github.io/robotframework-archivelibrary/">Keyword Documentation</a></h4><h3>การใช้งาน</h3><p>เพิ่ม Library ArchiveLibrary เข้าไปใน Setting ได้เลย การใช้งานก็ง่ายๆ ครับ</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/850989d3d01b8b13bc94c654ad8c4f54/href">https://medium.com/media/850989d3d01b8b13bc94c654ad8c4f54/href</a></iframe><p>จบแล้วครับสำหรับ Chapter นี้ เป็นอย่างไรกันบ้าง รู้สึกเริ่มมันส์กับการเขียน Test กันหรือยังครับ ใครอยากศึกษาเพิ่มเติม ศึกษาได้ที่ Link ด้านล่างที่ผมแปะไว้ได้เลยครับ</p><h3><strong>แถม</strong></h3><p>การใช้ SEPARATOR กรณี ข้อมูลมีหลายบรรทัด</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fb7ae7ada610faa2dab77b15352b612b/href">https://medium.com/media/fb7ae7ada610faa2dab77b15352b612b/href</a></iframe><h3>Link ที่เกี่ยวข้อง</h3><pre><a href="https://robotframework.org/robotframework/">https://robotframework.org/robotframework/</a></pre><pre><a href="http://franz-see.github.io/Robotframework-Database-Library/">http://franz-see.github.io/Robotframework-Database-Library/</a></pre><pre><a href="http://bulkan.github.io/robotframework-archivelibrary/">http://bulkan.github.io/robotframework-archivelibrary/</a></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a576f2eaaea5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ทำ Automation Test บน Windows Form Application โดย WhiteLibrary Robot Framework ฉบับเริ่มต้น]]></title>
            <link>https://medium.com/@Killfriend21/%E0%B8%97%E0%B8%B3-automation-test-%E0%B8%9A%E0%B8%99-windows-form-application-%E0%B9%82%E0%B8%94%E0%B8%A2-whitelibrary-robot-framework-%E0%B8%89%E0%B8%9A%E0%B8%B1%E0%B8%9A%E0%B9%80%E0%B8%A3%E0%B8%B4%E0%B9%88%E0%B8%A1%E0%B8%95%E0%B9%89%E0%B8%99-35b3aaa48c6b?source=rss-a6204a8c4934------2</link>
            <guid isPermaLink="false">https://medium.com/p/35b3aaa48c6b</guid>
            <category><![CDATA[automated-ui-testing]]></category>
            <category><![CDATA[white-library]]></category>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[robot-framework]]></category>
            <category><![CDATA[windows-app-development]]></category>
            <dc:creator><![CDATA[Naphon W]]></dc:creator>
            <pubDate>Sat, 19 Oct 2019 00:45:25 GMT</pubDate>
            <atom:updated>2020-01-23T07:02:52.727Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*78ulWUH5cKXaEnZOloslqg.png" /><figcaption><a href="https://robotframework.org/">https://robotframework.org</a></figcaption></figure><p>คุณประสบปัญหานี้อยู่หรือไม่ ต้องมานั่งกด Test โปรแกรมทุกครั้ง ก่อนจะ Release ขึ้น Production คุณเบื่อที่จะต้องทำอะไรซ้ำเดิมๆ ใช่หรือไม่ วันนี้ปัญหาเหล่านั้นจะหมดไป</p><p>เมื่อคุณได้รู้จักกับ <strong>WhiteLibrary </strong>Robot Framework Library สำหรับ Test Window GUI, Win32, WPF Application ซึ่งวิธีการใช้งานนั้น Easy มากๆ</p><p>เริ่มต้นเรามาทำความรู้จักกับเจ้า Robot Framework กันก่อน</p><p><a href="https://robotframework.org/"><strong>Robot Framework</strong></a> คือ Open source Automation Framework สำหรับ acceptance testing, acceptance test driven development (ATDD) ซึ่งความสามารถของเจ้า robot Framework นี้มากมายมหาศาลทั้ง Test Web(SeleniumLibrary), Mobile Application, Windows GUI , etc ซึ่งหลังจาก Test เสร็จยังมี Report เป็นไฟล์ .html ให้เราอีก แล้ว ความดีงาม อีกอันคือการ Capture Screen แบบอัตโนมัติ แล้วเอาไปเก็บไว้ใน Report ของเราด้วย สุดยอดไปเลยใช่มั้ยละ ซึ่งเจ้า Robot Framework นี้จะใช้ Python ในการ Execute ดังนั้นใครยังไม่มี python ไม่เป็นไรเดี๋ยวเราจะมา install python พร้อมกัน ส่วนใครมีแล้วไปกันต่อเลย</p><p><a href="https://github.com/Omenia/robotframework-whitelibrary"><strong>WhiteLibrary</strong></a> คือ Library ที่จะทำให้ Robot Framework ของเราสามารถรัน Automate test บน Windows GUI ได้</p><h3><strong>การติดตั้ง</strong></h3><ol><li>ติดตั้ง python โดยให้ไป Download ที่ <a href="http://www.python.org/">www.python.org</a></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*rTlpczCRe0pk8P7c5mN3jw.png" /><figcaption>เช็ค “Add Python 3.7 to PATH” เพื่อให้สามารถพิมพ์ “python” บน cmd ได้</figcaption></figure><p>เมื่อติดตั้งเสร็จแล้วให้พิมพ์ใน cmd, bash, หรือ power shell ตามนี้</p><pre>python -V</pre><p>จะได้ผลลัพธ์หน้าตาแบบนี้</p><pre>$ python -V<br>Python 3.7.4</pre><p>2. ติดตั้ง Robot Framework โดยใช้ cmd, bash หรือ Power Shell</p><pre>pip install robotframework</pre><p>ถ้าติดตั้งเสร็จแล้ว ให้พิมพ์ robot ใน cmd จะได้ผลลัพธ์ตามนี้</p><pre>➜  ~ robot<br>[ ERROR ] Expected at least 1 argument, got 0.<br>Try --help for usage information.</pre><p>3. ติดตั้ง WhiteLibrary โดยพิมพ์ command ตามนี้ครับ</p><pre>pip install robotframework-whitelibrary</pre><p>4. สร้าง .robot file ซึ่งไฟล์นี้เราจะเขียน Test Step และ รันได้ใช้ไฟล์นี้ โดยผมจะตั้งชื่อว่า sample.robot (ใช้ Text Editor เป็น <a href="https://code.visualstudio.com/">VS Code</a>) แนะนำให้สร้างไปใน Folder Debug ของตัว Project เลย พอ Build เสร็จจะได้ Test ได้เลย</p><p>โดย format ของ .robot ไฟล์ จะมีหน้าตาประมาณนี้ (ถ้าสีไม่เหมือนผม ไม่เป็นไร เพราะผมลง Extension เพิ่ม ใน VS Code)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/251/1*4YMEP2sgOxnrzUlYVUPZ9Q.png" /></figure><p>รูปแบบการเขียนคำสั่งของ Robot Framework จะมีรูปแบบตามนี้</p><ul><li>คำสั่ง{4 space}locator{4space}Test Data</li></ul><p>เช่น ผมต้องการให้ กรอก “Hello Robot Framework” ลงไปใน textbox ที่ชื่อว่า tbMessage จะเขียนได้ตามนี้</p><pre>Input Text To Textbox    tbMessage    Hello Robot Framework</pre><p>ขั้นแรก import WhiteLibrary โดยพิมพ์ตามนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/251/1*kfvv8mtdVtTu22WLY5CjDA.png" /></figure><p>6. จากนั้นเขียน Test Case แนะนำให้เขียนเป็นภาษาไทย ตัวอย่างจะประมาณนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/285/1*uA9BaAhMKw3bLvFm5eqJrQ.png" /></figure><p>7. ต่อไปเราจะมาเปลี่ยน Test Case ของเรา เป็นโค้ดกัน โดยจะเขียนไว้ในส่วนของ Keywords ตัวอย่างจะประมาณนี้ครับ โดย Command ต่างๆ เราสามารถดูได้ ใน <a href="http://omenia.github.io/robotframework-whitelibrary/keywords.html">Link </a>นี้ ครับ ตัวอย่าง</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*BJplh2njeyLO4aXH8USneA.png" /></figure><p>สั่ง Robot Execute</p><pre>robot sample.robot</pre><p>9. ถ้าไม่มีอะไรผิดพลาด จะได้ output ตามนี้เลยครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*HGgEXGwLtJy3SihNaEnBrg.png" /></figure><p>10. ต่อไปเรามาลองเพิ่มข้อความลงใน textbox และ กดปุ่มโดยใช้ Robot Framework กัน โดยโปรแกรมที่ผมเขียนไว้ คือเมื่อกรอกข้อความลงใน tbMessageBox แล้วกดปุ่ม โปรแกรมจะแสดงข้อความที่ผมกรอกบน lbResult โดย สิ่งที่ผมสนใจก็คือ โค้ดของผมทำงานได้ถูกต้องหรือเปล่า มาลองเขียนกันเลย</p><p>Step การทำงานก็จะประมาณนี้</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/528/1*D3JRsX8Tt5KOrEIG96f_nQ.png" /></figure><p>สังเกตุในส่วนของ Variables ผมมีการสร้างตัวแปรที่ชื่อว่า path เพื่อเก็บชื่อ execution file และ มีการเพิ่ม คำสั่ง Suite Teardown ปิดโปแกรม โดย Suite Teardown จะรันเมื่อ รัน Test Case ทุกอันเสร็จสิ้น ซึ่งทุกคนสามารถไปดูที่ตัว <a href="https://github.com/robotframework/QuickStartGuide/blob/master/QuickStart.rst#data-driven-tests">Quick Start Guide</a> ของ Robot Framework ได้</p><p>ต่อไปมาเริ่มต้นเขียนคำสั่งกันดีกว่า</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*4Rmf3Yjg1QTuhRqtTK6EtQ.png" /></figure><p>11. สั่ง Execute Robot โดยพิมพ์</p><pre>robot sample.robot</pre><p>12. สั่ง Execute Robot แบบเก็บ Tested Result ไว้ใน Folder ที่ต้องการ</p><pre>robot --outputdir output sample.robot</pre><p>หลังจากรันเสร็จ เพื่อนๆจะสังเกตุเห็นว่า ในเจ้าตัว Robot Framework จะทำการสร้าง Report file ที่เป็น .html ให้เราด้วย ความเทพของมันคือ ถ้า case ให้ที่เรารันแล้ว Fail ตัว Robot Framework จะทำการ Capture Screen และเก็บไว้ใน Result file ด้วย เทพมั้ยละ ซึ่งเจ้า Result file นี้ ใช้ Google Chrome เปิดดูได้ด้วย โอ้แม่เจ้าาาาา</p><p>จบแล้วสำหรับ Robot Framework เบื้องต้น น่าจะเริ่มสนุกกับการเขียน UI Automate Test กันแล้ว</p><h3>Tips</h3><p>Robot Framework จำเป็นต้องเขียน Test Step บนไฟล์ .robot และ รันด้วย cmd, bash หรือ powershell ดังนั้น Text editor ที่เหมาะสมกับงานนี้ที่สุดก็จะเป็นใครที่ไหนไม่ได้ นั้นคือเจ้า VS Code ของเรานั้นเอง ที่มี ยิ่งถ้าลงตัว Extension ไปแล้วยิ่งเพิ่มความสนุกในการเขียน Test Case เป็นเท่าตัว</p><p>เครื่องมือที่จะเพิ่มความสะดวกในการ locator ของ control RobotFramework เขาแนะนำตัวนี้</p><p><a href="https://accessibilityinsights.io/docs/en/windows/overview">accessibility insights for windows</a></p><p>ขอให้สนุกกับการเขียน Test ครับ</p><h3><strong>Link ที่เกี่ยวข้อง</strong></h3><pre><a href="https://robotframework.org/#documentation">https://robotframework.org/</a><br><a href="https://github.com/robotframework/QuickStartGuide/blob/master/QuickStart.rst#data-driven-tests">https://github.com/robotframework/QuickStartGuide/blob/master/QuickStart.rst#data-driven-tests</a><br><a href="https://github.com/Omenia/robotframework-whitelibrary">https://github.com/Omenia/robotframework-whitelibrary</a><br><a href="http://omenia.github.io/robotframework-whitelibrary/keywords.html">http://omenia.github.io/robotframework-whitelibrary/keywords.html</a><br><a href="https://accessibilityinsights.io/docs/en/windows/overview">https://accessibilityinsights.io/docs/en/windows/overview</a></pre><pre><a href="https://robotframework.org/robotframework/latest/libraries/OperatingSystem.html#Path%20separators">https://robotframework.org/robotframework/latest/libraries/OperatingSystem.html#Path%20separators</a></pre><pre><a href="https://github.com/Omenia/robotframework-whitelibrary/blob/master/atests/feature_tests/items.robot">https://github.com/Omenia/robotframework-whitelibrary/blob/master/atests/feature_tests/items.robot</a></pre><pre><a href="https://robotframework.org/robotframework/">https://robotframework.org/robotframework/</a></pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35b3aaa48c6b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>