Skip to main content

Posts

Make UnitTest Report Using HTMLTestRunner

I am a big fan of Python, and I am a big fan of TDD (Test Driven Development). The problem that I face for team development was that it is quite difficult to communicate the testing results to the team, because the results are in terminal so only us and God know :D Fortunately, somebody out there know my problem and create this amazing HTMLTestRunner.py. This tool is very handy and very easy to use. It almost feels like you don't need to do anything. OK, here's one example on how we use HTMLTestRunner. Ah, forget it. Download HTMLTestRunner.py from this website , and put somewhere in your computer. Say in this example, I put in ~/Downloads/HTMLTestRunner folder import unittest import sys _path = r"Downloads/HTMLTestRunner" sys.path.append(_path) import HTMLTestRunner class TestDemo(unittest.TestCase):     def testA(self):         assert True     def testB(self):         assert False class TestDemo2(unittest.Test...

Import Python Script to SikuliX

When we need to import python script into sikulix workspace, here is one of the way to do: 1. Import sys 2. Append the path to the script into sys.path 3. Import your python script Here is an example import sys sys.path.append("/Users/arwankhoiruddin/Downloads/python_packages/HTMLTestRunner") import HTMLTestRunner However, it has some limitations. You should refer to this document: https://answers.launchpad.net/sikuli/+faq/1114

Get Operating System used by SikuliX

If we write SikuliX code to check app on different operating system, we may need to define characteristic for each OS (e.g. image library or specific code). To check it, we can use built-in SikuliX script. Following is an example of OS checking if Settings.isWindows():     print "I am running on Windows" elif Settings.isLinux():     print "I am running on Linux" elif Settings.isMac():     print "I am running on Mac" That's it. Hope it helps.

Make vi appearance to be "real programming IDE"

"why not just use IDE or something like gedit?" I had that question long ago and that made me stick to GEdit and other IDEs. However, when I have to do some works on files in server, I just realise that I have to familiarise myself to command-based editor. And, that's the beginning for me to know vi. When I open it, the appearance is so boring. No line number, no syntax color. So, I decided to make at least that two things to make vi to be IDE like. Hahaha... Here's what I did: $ vi ~/.vimrc then type these lines in vimrc file set number   syntax on colorscheme desert ==== set number will add line number on the left part of vi syntax on will add colour of the syntax colorscheme desert will set the colour scheme to be "desert" That's it. I hope I can add some more customization of vi in the future. I feel that I am falling in love for the second time. Oh, vi... I love you.

How To Make Program to Corrupt File (Java)

Sometime we intentionally want our file to be corrupted e.g. to test software reliability. So, I made a program in Java that intentionally corrupt file. Please be careful to use this program as this program will make your file corrupt and cannot be reverted. Please backup your file before making it corrupt. OK, the logic is very simple. For each byte in the file, I simply put any random character (ASCII character is from 0 to 255). Here is the complete Java program: import java.io.RandomAccessFile; import java.util.Random; /**  *  * @author arwankhoiruddin  */ public class CorruptFile {     /**      * @param args the command line arguments      */     public static void main(String[] args) {         // TODO code application logic here         String FILEPATH = args[0];         System.out.println("File to corrupt: " + FILEPATH);     ...

Tips Berwisata di Saat Liburan Panjang bagi Pembenci Macet dan Keramaian

Saya adalah seorang yang tidak suka pada macet dan tempat wisata yang terlalu ramai. Saya tidak suka macet karena macet bikin waktu serasa cuma habis di jalan. Saya tidak suka tempat wisata yang terlalu ramai karena tujuan berwisata adalah menikmati alam dan menikmati quality time bersama keluarga. Di tempat wisata yang terlalu ramai, waktu biasanya akan dihabiskan untuk nyari tempat parkir, nyari tempat kosong untuk berteduh atau bermain, dan susah sekali untuk bisa menikmati tempat wisatanya sendiri karena justru yang terlihat adalah ramainya. Pada liburan panjang seperti ini (natal dan tahun baru di akhir minggu ditambah dengan liburan anak sekolah), kondisi jalan dan tempat wisata mainstream sungguh sangat tidak menarik. Di mana-mana jalanan macet, dan di tempat-tempat wisata, terlalu banyak orang yang berkunjung. Untuk menyiasati, ada beberapa hal yang bisa dilakukan: 1. Jangan lewat jalan yang biasa dilewati orang. Carilah jalan alternatif (lebih baik gunakan aplikasi peta s...

Install Python 3 and use VirtualEnv (OS X)

Install xcode: $  xcode - select   -- install Install homebrew: $  ruby   - e   "$(curl -fsSL  https://raw.githubusercontent.com/Homebrew/install/master/install )" Create .bash_profile: $ touch ~/.bash_profile Put this line inside .bash_profile:  export  PATH = / usr / local / bin : $ PATH Install python3: $ brew install python3 Create virtual environment. To make it easily found, create it under home: $ cd ~ && pyvenv arwan Activate the virtual environment created: $ source arwan/bin/activate Now you can start working in the new virtual environment. Note that it is worth to look at requirements.txt to see required packages on certain projects.