搜尋此網誌

2014年2月25日

Sequence diagram / Discrete graph tool

Graph tool:
1. GraphViz:
    a. Tutorial: http://graphs.grevian.org/documentation
    b. On-line tool: http://graphs.grevian.org/graph


Sequence diagram tool:
1. PC based:
    a. Mscgen
    b.http://simplecestlavie.blogspot.tw/2012/05/uml-quick-sequence-diagram-editor.html
2. On-line tool:
    a. https://www.websequencediagrams.com/
    b. http://yuml.me/diagram/scruffy/activity/draw
    c. https://grapholite.com/Designer (Many)
    d. https://www.draw.io/# (Many)
    e. https://creately.com (Many)
    f. http://bramp.github.io/js-sequence-diagrams/



Documentation system for source code by graph / sequential diagram:
1. Doxygen
    a. Tutorial:
        * http://www.ibm.com/developerworks/aix/library/au-learningdoxygen/
        * http://www.stack.nl/~dimitri/doxygen/doxygen_intro_cn.html

2014年2月11日

經油 vs 孕婦

不確定正確,網路文章統計的

不可
肉荳蔻
真正薰衣草
茴香、洋茴香
玫瑰草
大茴香
苦橙
歐白芷根
乳香
樟腦奧勒岡
花梨木(只限於嗅覺吸入法使用)
胡蘿蔔籽
依蘭
肉桂
橙花
穗花薰衣草
橘子
百里酚百里香
紅柑
龍艾
檸檬
茴香
茶樹
檸檬草
針葉松
檸檬尤加利
葡萄柚
檀香
佛手柑
德國洋甘菊
甜橙
側柏醇百里香
廣藿香
永久花
藍膠尤加利
澳洲尤加利
樟腦迷迭香
羅馬洋甘菊
薰衣草
牛膝草
杜松
樟樹
苴香
沒藥
雪松
迷迭香
百里香
艾草
山金車
白樺
快樂鼠尾草
絲柏
薄荷
冬青
鼠尾草
冬青木
樺木
樟木
醒目薰衣草
芳樟葉
丁香
羅勒
天竺葵
香蜂草
玫瑰
伊蘭
茉莉
馬鬱蘭
牡荊
歐芹
蒔蘿
西班牙鼠尾草

2014年2月10日

[轉] 手机GUI自动化测试介绍

Android UIAutormator - First touch

1. Control and switch between multiple activities of a single app.
2. Control an switch between multiple apps.
3. Combine with API for result checking?
4. User gesture coverage (Single tap, Double tap, Long press, Swipe, Scroll, etc).
5. UI component travel

Study:
3. Sample:
     b. Calculator:
     g. 


Step:
1. Create a Java project.
2. Add Junit lib.
3. Add android.jar & uiautomator.jar.
4. Coding.
5. <android-sdk>/tools/android create uitest-project -n <project_name> -t <AVD_ID> -p <project_path> (AVD_ID 透過 android list 取得)
6. Edit build.xml -> line2 ("help" -> "build").
7. build.xml -> ant build
8. adb push xxx.jar /data/local/tmp/
9. adb shell uiautomator runtest xxx.jar -c <Package_name>.<Class_Name>.

2014年2月7日

Java + Android + Sikuli + UIAutomator = Test automation

Project page: https://code.google.com/p/sikuli-api/

Eclipse:
  • sikuli-api-1.0.2-standalone.jar
  • slf4j-nop-1.7.5.jar
  • log4j-over-slf4j-1.7.5.jar

Example: (Java project)

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.lang.annotation.Target;

import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;

import org.sikuli.api.DesktopScreenRegion;
import org.sikuli.api.ImageTarget;
import org.sikuli.api.ScreenRegion;
import org.sikuli.api.visual.Canvas;
import org.sikuli.api.visual.DesktopCanvas;


public class SikuliTest {

    private static BufferedImage bi;
    private static JFrame frame;

    public static void main(String[] args) throws Exception {
        try {           
            Util.execCMD("adb push WiFi_UItest.jar /data/local/tmp");
            Util.execCMD("adb shell uiautomator runtest WiFi_UItest.jar -e CheckId 1 -c s2.wifi.TurnOn -c s2.wifi.CheckResult -s");
            Util.execCMD("adb pull /mnt/sdcard/Pictures/test_TurnOn.png C:\\tmp");
           
            loadImage();

            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    createAndShowGUI();
                }
            });
           
            ScreenRegion s = new DesktopScreenRegion();
            Thread.sleep(3000);
            ScreenRegion result = s.find(new ImageTarget(new File("c:\\tmp\\383.jpg")));
            // System.out.println("Score: " + result.getScore());
            // System.out.println("State: " + result.getState());
           
            // Construct a Canvas object of the type DesktopCanvas
            Canvas canvas = new DesktopCanvas();
            // Add a box around a screen region 'r'
            canvas.addBox(result);
            // Add a label on the screen region r
            canvas.addLabel(result, "WE FOUND IT!!");
            // Display the canvas for 3 seconds
            canvas.display(3);
           
            // frame.dispose();
           
        } catch (IOException e) {
            // handle exception
        }
    }

    private static void loadImage() throws IOException {       
        bi = ImageIO.read(new File("C:\\tmp\\test_TurnOn.png"));
    }

    private static void createAndShowGUI() {
        frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        final JPanel panel = new JPanel() {
            @Override
            protected void paintComponent(Graphics g) {
                Graphics g2 = g.create();
                g2.drawImage(bi, 0, 0, getWidth(), getHeight(), null);
                g2.dispose();
            }

            @Override
            public Dimension getPreferredSize() {
                return new Dimension(bi.getWidth()/3, bi.getHeight()/3);
            }
        };

        frame.add(panel);
        frame.pack();
        frame.setLocationRelativeTo(null);
        // frame.setLocation(500, 20);
        frame.setVisible(true);
    }
}

Image comparison

2.       Sikuli
3.       OpenCV
4.       http://www.vlfeat.org/
5.    ImageMagic (http://positon.org/compare-diff-between-two-images)