搜尋此網誌

顯示具有 測試 標籤的文章。 顯示所有文章
顯示具有 測試 標籤的文章。 顯示所有文章

2014年7月30日

UI test tips / UI 測試小技巧

1. 若測試在本機發動,為了起始測試,在 try 區段就要把所有例外都處理完畢,導回 first page 後才開始進行測試
2. 若測試由遠端發動,儘量利用遠端完成 DUT 的初始化,確保測試開始時就是在 first page。然後在 try 區段完成正確測試流程,在 catch 中分類所有錯誤現象。若無法在遠端完成初始化,原則就同 item1

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);
    }
}

2012年11月21日

Android benchmark test tool / performance test tool

Keep updating.

Overall:
  • CF-Bench (APK) - For multi-core


Browser:
  • Vellamo (APK)

Keyword:
  • Mobile benchmark
  • Browser benchmark
  • Mobile browser benchmark
  • Android benchmark
  • Browser performance
  • HTML5 benchmark

2012年7月31日

Mscgen study - Light weight tool to create sequential diagram

http://www.mcternan.me.uk/mscgen/

Sample script:


msc {
  a, "b", c ;

  a->b [ label = "ab()" ] ;
  b->c [ label = "bc(TRUE)"];
  c->c [ label = "process(1)" ];
  c->c [ label = "process(2)" ];
  ...;
  c->c [ label = "process(n)" ];
  c->c [ label = "process(END)" ];
  a<-c [ label = "callback()"];
  ---  [ label = "If more to run", ID="*" ];
  a->a [ label = "next()"];
  a->c [ label = "ac()"];
  b<-c [ label = "cb(TRUE)"];
  b->b [ label = "stalled(...)"];
  a<-b [ label = "ab() = FALSE"];
}



2012年7月27日

Graphviz study note - Powerful graph visualization software to create kind of diagrams

Powerful graph visualization software


1.          Define digraph gr { graph []; }
2.          Define Graph / Node / Edge attributions [fontname, fontsize, style, color, shape, fillcolor, width, height, …]
3.          Define Node / Edge [font, style, color, shape, fillcolor, label, (html table tag), width, …]
4.          Define Subgraphs and Clusters {label, bgcolor, …}
5.          Define Node / Edge relation [dir, color, style, :n|ne|se|…, …]
6.          Relation condition {rank, ordering, …}
7.          Output format

If want to create Sequential Diagram, Mscgen tool may be another good choice.

Reference:

2012年7月25日

Android GUI Test Concept

2012/7/25



Stage:
1. How to identify components ID?
    a. Components ID (EasyMonkeyDevice, Hierachyviewer, WebDriver)
    b. Coordinates (getevent / sendevent / monkey)
    c. Picture-driven (Sikuli, ImageMagic, OpenCV, TINA, OpenPR, ...)
    d. Hard keys
2. How to collect and backup end-users' operation?
    a. Components ID
    b. Coordinates / Coordinates scaling
    c. Picture-driven
3. How to translate these operations to test scripts?
    a. getevent / sendevent
    b. monkey
    c. Picture-driven
4. How to replay test scripts?
    a. getevent / sendevent
    b. monkey
    c. Picture-driven
5. How to manage test scripts to test suites?
6. How the test will be performed?
    a. One-to-One
    b. One-to-Many
    c. Central control for pairs test
    d. Cloud based / Web based
    e. Keyword-driven
    f. Model-driven
    g. Picture-driven

2012年6月19日

Android UI Test Technical (Robotium / NativeDriver)


最近在尋找 Android GUI test framework,就是沒有一種又是黑盒子測試、又可以不用修改測試對象的 source code
若用座標 record & replay,誤差太大
目前只看到 NativeDriver & Robotium 比較有競爭力
上面那個網址有精確的評論,先記錄起來
後續再提供一篇目前 survey 到的 library or framework

2012年5月4日

計算 CPU utilization 於多核心的 ARM 系統 / CPU utilization on multi-core platform

目的: 計算 CPU utilization 於多核心的 ARM 系統

CPU info location:
1.          /proc/cpuinfo
2.          /proc/stat
3.          /proc/loadavg
4.          /proc/<pid>/stat
5.          /proc/<pid>/task/<tid>/stat

CPU test factor:
1.          CPU load
2.          CPU temperature
3.          Process CPU utilization
4.          Thread CPU utilization
5.          CPU frequency / scaling
6.          CPU BogoMIPS
7.          CPU benchmark
8.          CPU stress / long run
9.          CPU info
10.      Workload on specific CPU
11.      Power consumption
12.      Process queue
13.      Interrupt
14.      IO
15.      Context switch

�考�址:
1.          Unix/Linux 系统自动化管理: CPU 管理篇 (http://www.ibm.com/developerworks/cn/aix/library/0909_unixcpu_wangwh/)
2.          Linux平台Cpu使用率的�算 (http://blog.csdn.net/super005/article/details/6133959)
3.          系�平均��(Load average)�疑 (http://ssorc.tw/rewrite.php/read-59.html)
4.          linux�程cpu�源分配命令nice,renice,taskset (http://www.iteye.com/topic/633616)
5.          Calculating CPU Usage from /proc/stat (http://colby.id.au/node/39)
7.