马上行动 - Action Now
===========================================================
Oracle - Hit/Miss Ratios
===========================================================

Here are some scripts related to Hit/Miss Ratios .

Buffer Hit Ratio

BUFFER HIT RATIO NOTES:

  • Consistent Gets - The number of accesses made to the block buffer to retrieve data in a consistent mode.
  • DB Blk Gets - The number of blocks accessed via single block gets (i.e. not through the consistent get mechanism).
  • Physical Reads - The cumulative number of blocks read from disk.

  • Logical reads are the sum of consistent gets and db block gets.
  • The db block gets statistic value is incremented when a block is read for update and when segment header blocks are accessed.
  • Hit Ratio should be > 80%, else increase DB_BLOCK_BUFFERS in init.ora

    select 	sum(decode(NAME, 'consistent gets',VALUE, 0)) "Consistent Gets",
    	sum(decode(NAME, 'db block gets',VALUE, 0)) "DB Block Gets",
    	sum(decode(NAME, 'physical reads',VALUE, 0)) "Physical Reads",
    	round((sum(decode(name, 'consistent gets',value, 0)) + 
    	       sum(decode(name, 'db block gets',value, 0)) - 
    	       sum(decode(name, 'physical reads',value, 0))) / 
    	      (sum(decode(name, 'consistent gets',value, 0)) + 
    	       sum(decode(name, 'db block gets',value, 0))) * 100,2) "Hit Ratio"
    from   v$sysstat
    
    

    Data Dict Hit Ratio

    DATA DICTIONARY HIT RATIO NOTES:

  • Gets - Total number of requests for information on the data object.
  • Cache Misses - Number of data requests resulting in cache misses

  • Hit Ratio should be > 90%, else increase SHARED_POOL_SIZE in init.ora

    select 	sum(GETS),
    	sum(GETMISSES),
    	round((1 - (sum(GETMISSES) / sum(GETS))) * 100,2)
    from 	v$rowcache
    
    

    SQL Cache Hit Ratio

    SQL CACHE HIT RATIO NOTES:

  • Pins - The number of times a pin was requested for objects of this namespace.
  • Reloads - Any pin of an object that is not the first pin performed since the object handle was created, and which requires loading the object from disk.

  • Hit Ratio should be > 85%

    select 	sum(PINS) Pins,
    	sum(RELOADS) Reloads,
    	round((sum(PINS) - sum(RELOADS)) / sum(PINS) * 100,2) Hit_Ratio
    from 	v$librarycache
    
    

    Library Cache Miss Ratio

    LIBRARY CACHE MISS RATIO NOTES:

  • Executions - The number of times a pin was requested for objects of this namespace.
  • Cache Misses - Any pin of an object that is not the first pin performed since the object handle was created, and which requires loading the object from disk.

  • Hit Ratio should be < 1%, else increase SHARED_POOL_SIZE in init.ora

    select 	sum(PINS) Executions,
    	sum(RELOADS) cache_misses,
    	sum(RELOADS) / sum(PINS) miss_ratio
    from 	v$librarycache
    
    http://vsbabu.org/oracle/sect05.html

  • nmtcolin 发表于:2008.05.06 15:03 ::分类: ( Testing ) ::阅读:(120次) :: 评论 (0)
    ===========================================================
    如何评价测试人员的工作绩效?
    ===========================================================
    如何评价测试人员的工作绩效?

      随着国内软件测试行业的不断发展,软件测试工作更加深入、规范。其中对测试人员的绩效考核也越来越重要。目前,很多公司对测试人员的考核方面都不相同,有些公司仍然是以单纯的问题单数量来对测试人员进行评价,这样直接对测试人员工作方向产生误导,影响到测试人员工作的积极性和稳定性。因此,为了能够更好对测试过程进行管理,必须对测试人员有一个客观、全面的评价。下面是本人在工作中的一些体会希望能给大家带来一些启发:


      一、测试人员工作绩效评价的误区

      1、 仅从提交的问题单数量、测试执行用例数量来判断测试人员的好坏

      这种做法明显缺乏全面性。问题单的数量只是评估测试质量的一个方面,我们更需要看中实际的测试质量。这就需要考察问题单的质量、测试的难度、问题单的级别。

      例如:模块A很不稳定,潜在的问题数可能有100个,由测试人员甲负责测试,他一个月执行300个用例,提交50个问题单,发现30个有效问题,有10个严重问题;

      模块B比较稳定,潜在的问题数可能有20个,由测试人员乙负责测试,他一个月执行100个用例,提交20个问题单,发现18个有效问题,有8个严重问题;

      从上述测试执行结果来看,甲提交的问题单数量和执行用例数量都要远远高于乙,但是从测试的质量来看,模块B的遗留问题显然少于模块A,甲执行测试的充分性显然不如乙,从问题单质量来看,甲提交的问题单虽然很多,但近半数是非问题,做了无用功,还影响到开发人员对问题的定位所消耗的时间。

      因此,必须要走出用问题单数量、用例数量评价测试人员的误区。


      2、 对测试人员发现的问题的价值没有进行评估

      发现1个系统架构设计方面存在的缺陷和隐患,远比发现几个普通界面的显示问题要有价值的多。因此,在对测试人员进行评价时,必须区分不同问题的重要性和价值。

      3、 不重视测试文档的质量

      测试文档的质量往往是测试人员的测试水平的反映,只有对系统进行了充分的、深入测试的测试人员才能写出高质量测试报告,说明测试的全面性和测试过程的质量。

      4、 不重视测试人员的综合能力

      首先,必须考察测试人员的责任心,如果一个测试人员工作不符责任,随意敷衍,即使提交的问题单数量多,也不能证明他测试的质量高。其次,需要关心测试人员的工作积极性,积极工作的态度不仅能带来很高的测试质量,还能提高整个团队的积极向上的风气。还有,测试人员的沟通能力,如果一个测试人员和开发人员对问题沟通交流不畅,甚至经常引发争执,这显然会影响测试工作的效率。


      二、建议对测试人员进行综合性的全面评价

      评价方法如下:

      

      三、总结

      综上所述,必须本着以测试质量为重、对测试负责的角度对测试人员绩效进行客观评价,同时也提高测试人员的质量意识。通过合理的绩效评价,让测试人员以积极的心态投入的测试工作中,保证测试工作的顺利进行。

    转自http://se.csai.cn/ExpertColumn/No036.asp

     查看全文
    nmtcolin 发表于:2008.04.25 14:19 ::分类: ( Testing ) ::阅读:(79次) :: 评论 (0)
    ===========================================================
    Test Generation framework
    ===========================================================

    JUnit Factory
    An experimental test-generation service from AgitarLabs, the research

    division of Agitar Software. JUnit Factory is a 2008 Jolt Productivity

    Award Winner!

    http://www.junitfactory.com
    http://www.junitfactory.com/articles/


    Introducing Crap4J
    There is no fool-proof, 100% accurate and objective way to determine if a

    particular piece of code is crappy or not. However, our intuition – backed

    by research and empirical evidence – is that unnecessarily complex and

    convoluted code, written by someone else, is the code most likely to

    elicit the “This is crap!” response.

    http://www.junitfactory.com/articles/crap4j/


    CUTE / JCUTE (a Concolic Unit Testing Engine for C and Java) is a tool to

    systematically and automatically test sequential C programs (including

    pointers) and concurrent Java programs. CUTE combines concrete and

    symbolic execution in a way that avoids redundant test cases as well as

    false warnings. The tool also introduces a novel race-flipping technique

    to efficiently test and model-check concurrent programs with data inputs.

    http://osl.cs.uiuc.edu/~ksen/cute/?page=overview

    CubicTest
    http://boss.bekk.no/cubictest/

    Welcome to functional web testing with CubicTest!
    CubicTest is a graphical Eclipse plug-in for writing Selenium and Watir tests. It makes tests faster and easier to write, and provides abstractions to make tests more robust and reusable.

    CubicTest's test editor is centered around pages/states and transitions between these pages/states. The model is intuitive for both Ajax and traditional web applications and supports most user interaction types.

    CubicTest featres an innovative test recorder and test runner based on Selenium RC which are fully integrated with the graphical test editor. Tests can also be run standalone from Maven 2.

    Selenium
    http://selenium.openqa.org/

    Selenium is a test tool for web applications. Selenium tests run directly in a browser, just like real users do. It runs in Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh, Safari on the Mac. We have plans to target Safari on the iPhone in some months.

    The quickest way to learn Selenium is via a Firefox plugin called Selenium IDE. It is quite compelling for developing tests in and quickly trying out Selenium before choosing Selenium for your project.

    There are two modes of operation for Selenium - Core and Remote Control (RC). Remote Control mode also has a related capability called Selenium Grid that allows you to throw hardware at tests to make it all faster.


    nmtcolin 发表于:2008.03.25 14:55 ::分类: ( Testing ) ::阅读:(94次) :: 评论 (0)
    ===========================================================
    LoadRunner监控Windows和Linux常见问题
    ===========================================================

    关于LR监视Windows和linux的说明

    一 windows

    1 监视连接前的准备工作

    首先保证被监视的windows系统开启以下二个服务Remote Procedure Call(RPC) 和Remote Registry Service 这里具体在那里开起服务就不说了)

    被监视的WINDOWS机器:右击我的电脑,选择管理->共享文件夹->共享 在这里面要有C$这个共享文件夹,(要是没有自己手动加)

    然后保证在安装LR的机器上使用运行.输入被监视机器IPC$ 然后输入管理员帐号和密码,如果能看到被监视机器的C盘了,就说明你得到了那台机器的管理员权限,可以使用LR去连接了

    说明: LR要连接WINDOWS机器进行监视貌似要有管理员帐号和密码才行,

    2 用LR监视windows的步骤

    (这里就不详细说明了,只要在窗口中右击鼠标选择Add Measurements就可以了)

    二 linux

    1 准备工作

    首先,监视Linux一定要有rstatd这个守护进程,有的Linux版本里也有可能是rpc.rstatd这里只是名字不同而已,功能是一样的

    一般来说LINUX需要下载一个包才有这个服务,包名字是rpc.rstatd-4.0.1.tar.gz. 这是一个源码,需要编译,

    下载并安装rstatd

    tar -ivh rpc.rstatd-4.0.1.tar.gz
    ./configure —配置
    make —编译
    make install —安装
    rpc.rstatd —启动rstatd进程

    配置rstatd 目标守护进程是xinetd,它的主配置文件是/etc/xinetd.conf 里面内容是

    只有基本信息
    # Simple configuration file for xinetd
    #
    # Some defaults, and include /etc/xinetd.d/

    defaults
    {
    instances = 60
    log_type = SYSLOG authpriv
    log_on_success = HOST PID
    log_on_failure = HOST
    cps = 25 30
    }

    includedir /etc/xinetd.d

    里面内容的意思在这里就不说了!网上有具体解释,

    我们这里需要修改的是/etc/xinetd.d/下的三个conf文件 rlogin ,rsh,rexec 这三个配置文件,

    打这三个文件里的disable = yes都改成 disable = no ( disabled 用在默认的 {} 中 禁止服务)

    或是把# default: off都设置成 on 这个的意思就是在xinetd启动的时候默认都启动上面的三个服务!

    (由于貌似用ps ax不能看到rlogin ,rsh ,rexec这三个进程是否开启,所以使用default: on,因为rstatd和xinetd这二个服务是否启动在ps ax里是看的到的)

    然后你在保证Linux机器上的进程里有rstatd和xinetd这二个服务就可以用LR去监视了

    几点小的技巧:

    检查是否启动: rsh server 监听和TCP 是514。
    [root@mg04 root]# netstat -an |grep 514
    tcp 0 0 0.0.0.0:514 0.0.0.0:* LISTEN
    如果能看到514在监听说明rsh服务器已经启动。

    检查是否启动: rstatd

    输入命令: rpcinfo -p

    如果能看到

    程序 版本 协议 端口

    *** **** udp 741 rstatd

    那就说明rstatd服务启动了,(当然这里也可以用ps ax代替)

    几点说明: 1) 在实际操作中有可能会碰到一些问题,这里还有一份网上的关于LR连接时候可能出错的情况,详细请见下面

    2) 网上也有人说在LR的资源窗口中右击鼠标出现的Add Measurements选项是暗淡的,我操作的时候没碰到,这里可能是LR没有完全安装的原因.

    3) 由于条件的限制,(没有UNIX环境)所以这次没有遇及UNIX的监控,但网上也有这方面的资料,说明的也比较清楚,在这里就不再重复了.

    4) 由于本人能力有限,只是把网上的内容归纳了一下,说的不对的地方请高人指点,我会更新内容.

    LoadRunner中服务器资源监控器疑难解答

    要监控服务器计算机上的资源,必须能够连接到该计算机。如果监控失败,并且 LoadRunner 找不到指定的服务器,请确认指定的服务器是否可用。在 Controller 或优化控制台计算机命令行中键入 ping <server_name>,执行“ping”操作。

    验证可以访问该计算机后,请查看下表中有关监控器疑难解答的其他提示。

    问题

    解决方案

    无法监控其他域中的 Windows 计算机,或者访问被拒绝

    要获得对远程计算机的管理权限,请在命令提示符下执行以下命令:

    %net use <计算机名>/用户:[<><远程计算机名>]

    提示输入密码时,输入远程计算机的密码。

    无法监控 NT/Win 2000 计算机(发出一条错误消息:未找到计算机名无法连接到主机

    要监控的 NT/Win 2000 计算机仅允许具有管理员权限的用户进行监控。要允许非管理员用户进行监控,必须授予用户对特定文件和注册表项的读取权限(Microsoft 技术说明编号 Q158438)。需要执行下列步骤:

    a. 使用浏览器或文件管理器,授予用户对下列项的读取权限:
    %windir%system32PERFCxxx.DAT

    %windir%system32PERFHxxx.DAT

    其中 xxx 是系统的基本语言 ID例如,英语的 ID 009。这些文件可能已丢失或损坏。如果对此有怀疑,请从安装 CD 中提取这些文件。

    b. 使用 REGEDT32,授予用户对下列项的读取权限:
    HKEY_LOCAL_MACHINESoftwareMicrosoftWindows NTCurrentVersionPerflib
    以及该项的所有子项。

    c. 使用 REGEDT32,至少授予用户对下列项的读取权限:
    HKEY_LOCAL_MACHINESystemCurrentControlSet ControlSecurePipeServerswinreg

    无法从 NT 计算机监控某些 Win 2000 计数器。

    Win 2000 计算机上运行 Controller 或优化控制台。

    某些 Windows 默认计数器生成错误

    删除有问题的计数器,并使用添加度量对话框添加相应计数器。

    无法从被监控的计算机上获得 SQL Server 6.5 版的性能计数器。

    这是 SQL Server 6.5 版的一个错误。解决方法为:在被监控的计算机上使用 regedt32,授予用户对以下注册表项的读取权限:

    HKEY_LOCAL_MACHINESOFTWAREMicrosoftMSSQLServerMSSQLServer

    Microsoft 技术说明编号 Q170394

    选定度量未显示在图中。

    确保已注册显示文件和 online.exe。要在不执行完全安装的情况下注册监控器的 dll,请运行 LoadRunnerbin 中的 set_mon.bat 批处理文件。

    监控 Windows 计算机时,图中不显示任何度量。

    检查内置的 Windows 性能监控器。如果该监控器不能正常工作,则可能是通信设置有问题。

    监控 UNIX 计算机时,图中不显示任何度量。

    确保 rstatd 正在 UNIX 计算机上运行(请参阅系统资源监控)。

    无法监控下列 Web 服务器之一:MS IISMS ASP ColdFusion

    请参阅上面的问题无法监控 Windows 计算机

    无法监控 WebLogic (JMX) 服务器

    打开 <LoadRunner 根文件夹>datmonitorsWebLogicMon.ini 文件,并搜索:
    [WebLogicMonitor]
    JVM=javaw.exe
    javaw.exe 更改为 java.exe。将打开一个包含跟踪信息的窗口。

    http://www.cntester.com/FocusPerformance/200711/1098.shtml


    nmtcolin 发表于:2008.03.23 21:31 ::分类: ( Testing ) ::阅读:(195次) :: 评论 (1)
    ===========================================================
    认识p-unit:一款开源的性能测试框架
    ===========================================================

    认识p-unit:一款开源的性能测试框架

    来源: AppFuse中文社区

    http://www.ibm.com/developerworks/cn/java/j-lo-punit/index.html

    p-unit 是一款开放源码的性能测试框架,和 JUnit 不同,JUnit 关注的是测试案例的正确性,而 p-unit 不仅关注测试案例的正确性,还收集测试案例的性能参数,默认情况下,p-unit 收集测试案例的时间和内存消耗情况,可以产生文件,图片,和 PDF 格式的报表。此外,p-unit 还支持参数化测试,多线程测试以及不同 Java 虚拟机性能之间的比较。
    p-unit 简介


    或许我们已经习惯了使用 JUnit 来写单元测试来保证代码质量(我也一直这么做),但可能经常碰到这样的问题:
    程序多线程下正确性如何?
    如何测试程序的性能?
    当有多个方案可以选择时,技术上如何比较不同方案的性能?

     对于问题 1,我们或许听天由命?或是凭借人工分析,或是根据用户反馈?很多软件单线程下的单元测试覆盖率相当高,从而保证了代码的健壮性。然而多线程测试时常被忽略,这并不代表多线程测试不重要,相反,修正一个用户报告的多线程 BUG 往往比单线程的要高出很多,因为测试案例经常不是 100% 可重现的。这更要求程序员在开发阶段充分的重视。目前多线程单元测试力度不够的一个重要原因是没有一个像 JUnit 那样易用的测试工具,另外重复写测试案例往往不被程序员接受。

     对于问题 2,一个成熟的关心性能的产品往往有一个性能测试平台。这个测试平台应该关注的是测试业务逻辑本身,而无需关心如何运行测试案例。你是否为写这样的测试平台痛苦过?以及花费时间在产生一些直观的报表上面?

     对于问题 3,我们往往写一个原型来比较不同产品之间的性能,如何比较执行速度和内存消耗?或是选择最适合你的虚拟机?

     p-unit 就是这么一款开源的性能测试软件,它能帮助你很好的解决上述问题。p-unit 可以:
    多线程支持:同一个测试案例可以单线程执行,也可以多线程执行,测试案例开发者只需写一套测试案例。
    参数化测试案例:很多测试案例,需要测试同一功能在不同数量级上的性能表现。
    不同虚拟机性能测试:只需指定虚拟机路径,即可测试同一个测试案例在不同虚拟机上的表现,报表上可以非常直观显示性能差别。
    事件机制构架:punit 是基于事件机制构架的,如果用户想定制报表,只需实现事件响应器,并注册该响应器到 punit 核心即可。


    多线程执行测试案例


     在了解如何多线程执行测试案例之前,我们先了解一下如何利用 p-unit 单线程执行测试案例。不同于 JUnit, p-unit 测试用例无需继承任何测试类或是实现接口,即可执行 test 开始的方法。尽管 JUnit 4 中加入了注释(Annotation) 的特性,但测试方法前缀为 "test" 仍然是测试者们的首选。因此如果你的 JUnit 测试案例遵循的是 test 命名规则,那么 p-uni t可以兼容运行 JUnit 测试案例。
    下面的代码清单 1 是一个最为普通的测试案例:

    CODE:


    public class SimpleTestClass {

    public void setUp() {
    SampleUtil.doSomething();
    }

    public void tearDown() {
    SampleUtil.doSomething();
    }

    public void testA() {
    System.out.println("testA");
    SampleUtil.doSomething();
    }

    public void testB() {
    SampleUtil.doSomething();
    }

    public void testC() {
    SampleUtil.doSomething();
    }

    }

    public class SampleUtil {
    private static Random _random = new Random();

    public static void consumeMemory(int length) {
    byte[] data = new byte[length];
    for(int i = 0, j = 0; i < data.length; ++i) {
    ++j;
    }
    }

    public static void consumeTime(int time) {
    ThreadUtil.sleepIgnoreInterruption(time);
    }

    public static void doSomething() {
    consumeTime(Math.abs(_random.nextInt()) % 500);
    consumeMemory(Math.abs(_random.nextInt()) % 100000);
    }
    }
     这是做为普通的测试案例,但是注意到这仅仅是一个测试案例,不包含其他任何逻辑,这也是 p-unit 追求的业务逻辑和测试运行环境分离的一个理念。同一个测试案例,用户可以选择不同的测试环境去运行,而不是绑定在某一个特定的测试软件工具上。现在我们来看 p-unit 是如何运行这个测试案例的。你只需要在 main 函数中写一行代码来运行它:

    清单 2. 单线程运行测试案例

    CODE:


    public static void main(String[] args) {
    new PUnitSoloRunner().run(SimpleTestClass.class);
    }
    清单 3. 单线程运行测试案例结果

    CODE:


    [solo] Started running samples.SimpleTestClass
    samples.SimpleTestClass
    testA
    testA() - [287.0ms]
    testB() - [27.0ms]
    testC() - [213.0ms]
    total: 3, failures:0 (GREEN) - 2025.0ms
     是否和想象中的一样?下面我们来看如何多线程执行这个测试案例。或许从上面的例子你已经猜到了,在 main 函数还是只需一句代码,只用把 PUnitSoloRunner 换成 PUnitConcurrentRunner 即可!

    清单 4. 多线程运行测试案例

    CODE:


    public static void main(String[] args) {
    new PUnitConcurrentRunner().run(SimpleTestClass.class);
    }
    清单 5. 多线程运行测试案例结果

    CODE:


    [concurrent] Started running samples.SimpleTestClass
    samples.SimpleTestClass
    testA
    testA
    testA
    testA
    testA
    testA
    testA
    testA
    testA
    testA
    testA() - [405.0ms]
    testB() - [469.0ms]
    testC() - [503.0ms]
    total: 3, failures:0 (GREEN) - 1447.0ms
     是否和想象中的一样?默认情况 p-unit 启动 10 个线程来执行,要指定不同的线程数,只需将线程数做为参数传入 PUnitConcurrentRunner 即可。p-unit 甚至支持不同的测试案例有不同的线程数,这要求测试案例实现 p-unit 中定义的 Concurrent 接口,该接口的定义为:

    清单 6. p-unit Concurrent 接口

    CODE:


    public interface Concurrent {
    public int concurrentCount();
    }
     该接口的意思,相信无需再多做解释了,返回该测试案例需要的线程数。

    最新回复

    quake at 2007-11-21 15:35:48
    参数化测试案例


     性能测试,不同于单元测试,经常要求测试不同数量级在同一个测试场景中的表现,JUnit 是一款非常优秀的单元测试工具,但没覆盖到这个方面。比如我们比较类库 Foo1 的方法 bar() 和类库 Foo2 的方法 bar() 哪个更符合自己的应用程序,我们需要测试该函数在应用程序可能的数量级的范围内的表现。有经验的开发者知道经常碰到在小数量级 A 更好大数量级 B 更好的局面,因此全面的测试对于代码的性能理解非常重要,能帮助开发者做出正确的决定。p-unit 支持将参数传给测试方法,测试案例需要实现 p-unit 的 parameterizable 接口,该接口的主要方法是返回一组参数列表,这组列表的参数将会一一传给测试方法。

    清单 7. p-unit 参数化测试案例

    CODE:


    public class ParamTestClass implements Parameterizable {
    public static void main(String[] args) {
    new PUnitSoloRunner().run(ParamTestClass.class);
    }

    public Parameter[] parameters() {
    return new Parameter[] { new ParameterImpl(10), new ParameterImpl(20) };
    }
    public void testA(ParameterImpl param) {
    SampleUtil.doSomething();
    }

    public void testB(ParameterImpl param) {
    SampleUtil.doSomething();
    }

    public void testC(ParameterImpl param) {
    SampleUtil.doSomething();
    }

    public void setUpAfterWatchers(Parameter param) throws Exception {
    }
    public void setUpBeforeWatchers(Parameter param) throws Exception {
    }
    public void tearDownAfterWatchers(Parameter param) throws Exception {
    }
    public void tearDownBeforeWatchers(Parameter param) throws Exception {
    }
    static class ParameterImpl implements Parameter {
    private int _count;
    ParameterImpl(int count) {
    _count = count;
    }
    public int count() {
    return _count;
    }

    public String toString() {
    return String.valueOf(_count);
    }
    }
    }
    上述代码的执行结果为:

    CODE:


    [solo] Started running samples.ParamTestClass
    samples.ParamTestClass
    testA(10) - [57936.0bytes,447.0ms]
    testA(20) - [33128.0bytes,61.0ms]
    testB(10) - [24832.0bytes,137.0ms]
    testB(20) - [0.0bytes,63.0ms]
    testC(10) - [83560.0bytes,468.0ms]
    testC(20) - [16528.0bytes,47.0ms]
    total: 6, failures:0 (GREEN) 1450.0ms
     从上述结果看出,每个方法被执行了 2 次,每次传入不同的参数。多线程运行参数化测试程序?相信读者已经明白怎么去实现了,只需将 PUnitSoloRunner 替换成 PUnitConcurrentRunner。
    quake at 2007-11-21 15:40:22
    运行环境测试案例

     随着 Java 开源,出现了更多的 Java 运行环境,除了 SUN 的参考实现外,BEA、IBM 均有自己的 Java 运行环境,更有如 Apache Harmony 的开源运行环境(尽管现在 Apache Harmony 尚不能称为 Java 运行环境)。运行环境测试案例,为运行环境开发者以及选择运行环境,都能提供一定的帮助。比如说下面的例子就是测试 java.util.ArrayListjava.util.Vector 在两个不同运行环境的表现。测试案例写法和普通的测试案例完全一样,我们只需告诉 p-unit 不同的运行环境的 Java 路径以及正确的 classpath,然后调用 runVMs 函数即可:

    清单 9. p-unit 运行环境测试案例

    CODE:


    public static void main(String[] args) {
    PUnitSoloRunner runner = new PUnitSoloRunner();
    runner.addPUnitEventListener(new OverviewReporter(new ImageRender()));
    runner.runVMs(ListTestClass.class, new VM[] { VMConfig.HARMONY, VMConfig.SUN });
    }
    public class VMConfig {
    private static String CLASSPATH = " -cp correct_classpath_including_all_jars_and_path";
    private static String HARMONY_PATH = "harmony_pathbinjava" + CLASSPATH;
    private static String SUN_PATH = "sun_pathbinjava" + CLASSPATH;
    public static VM HARMONY = new VM(HARMONY_PATH, "HARMONY");
    public static VM SUN = new VM(SUN_PATH, "SUN");
    }
    public class ListTestClass {

    private static final int LIST_COUNT = 100000;
    private static Object element = new Object();
    private Random indexGenerator = new Random();;

    public void testInsertArrayList() {
    ArrayList arrayList = new ArrayList(LIST_COUNT);
    insertSequence(arrayList);
    insertRandom(arrayList);
    }
    public void testInsertVector() {
    Vector vector = new Vector(LIST_COUNT);
    insertSequence(vector);
    insertRandom(vector);
    }
    public void insertSequence(List list) {
    for (int i = 0; i < LIST_COUNT; ++i) {
    list.add(element);
    }
    }
    public void insertRandom(List list) {
    for (int i = 0; i < LIST_COUNT; ++i) {
    list.add(indexGenerator .nextInt(LIST_COUNT),element);
    }
    }
    }
    上述代码的运行结果如下:


    20070604102119810.jpg



     从上图中可以很直观的看出,笔者使用的 HARMONY 版本在该测试案例中速度更快(左图),但内存消耗更多(右图)。下一节将讲述如何输出报表,但或许你已经注意到了,代码非常简单。

     从上面的实例中我们已经看到 p-unit 的输出结果的两种形式,控制台和报表图片。默认情况下,p-unit 将输出到控制台。p-unit 采用事件机制,在运行器的每个节点都会提供通知事件。所有的输出都是通过注册事件响应器来实现的。这也表明了结果输出和运行器完全隔离,用户也可以定制自己的报表。p-unit 有 4 种内建输出,分别为控制台、文件、图片报表以及 PDF 报表。上一节的例子中我们已经看到图片报表,其代码为:
    清单 10. 添加 p-unit 总体图片报表

    CODE:

    runner.addPUnitEventListener(new OverviewReporter(new ImageRender())); p-unit 内建的报表有分三种不同的粒度:总体级别(OverviewReporter),TestSutie 级别(TestSuiteReporter),以及测试案例类级别(TestClassReporter)。这三种级别都可以输出图片格式或是 PDF 格式,因此,总共有六种类型的输出。上述的代码就是输出总体级别的图片。由于事件监听器是互相独立的,因此你可以既选择输出图片又选择输出 PDF 文件,只需再添加事件监听器即可:
    清单 11. 添加多个 p-unit 事件监听器

    CODE:


    runner.addPUnitEventListener(new OverviewReporter(new ImageRender()));
    runner.addPUnitEventListener(new OverviewReporter(new PDFRender()));
    总结
     至此,你是否基本理解了 p-unit 的概念呢?简单,易用,关注多线程,关注性能,这就是 p-unit。此外 p-unit 还有很多很好的小特性,如 Alphabetical 接口来保证执行测试函数的先后顺序等。使用 p-unit,让你的代码更健壮!

    nmtcolin 发表于:2008.03.22 14:42 ::分类: ( Testing ) ::阅读:(57次) :: 评论 (1)
    ===========================================================
    QA and Testing Interview Questions
    ===========================================================

    When interviewing for a QA or Testing position, it's important to be honest.

    Hiring managers want to know what you know, what you can do, and what you are like. And nobody wants to hire a liar.

    As a hiring manager, I can tell if you are stretching the truth - particularly if you are just repeating simple definitions to complex concepts.

    If you are asked about QA or Testing terms that aren't familar to you, tell the interviewer that you haven't heard of those terms, then ask what they mean. Since terms in this field are very company-specific, you may already know the concept, but just haven't heard the term before.

    If you are asked about a tool that you haven't used before, tell the interviewer that you haven't used it. Sometimes, you can point out other, similar tools that you have used. Usually, if you are capable of learning one tool, you are capable of learning many. And if you are good enough otherwise, many companies will hire you and train you on their tool of choice.

    That said, some people posting at SQAForms.com (where I help moderate) constantly ask about interview questions. There, moderators are discouraged from answering such questions, and discourage others from doing so.

    Here are some links which may help those who find value in such things. I will not vouch for the accuracy of any of the answers, nor that any of the questions make sense.

    But if you asked for help with interview questions, I sincerely hope this gives you what you are seeking. Good luck on your interview!

    http://www.sqablogs.com/jstrazzere/908/QA+and+Testing+Interview+Questions+%28and+some+answers%29.html


    nmtcolin 发表于:2008.03.19 09:36 ::分类: ( Testing ) ::阅读:(99次) :: 评论 (0)
    ===========================================================
    测试资源收藏
    ===========================================================

    http://www.developertesting.com/
    Developer Testing, Discussions about Software Quality

    http://www.junitfactory.com/
    JUnit Factory is a 2008 Jolt Productivity Award Winner!

    http://chinasoftesting.googlepages.com/home
    测试之家(测试工具, 测试资料, 软件测试, 配置管理, 过程管理, 资料下载)

     查看全文
    nmtcolin 发表于:2008.03.18 09:24 ::分类: ( Testing ) ::阅读:(730次) :: 评论 (0)
    ===========================================================
    WinRunner - As a GUI based load testing tool
    ===========================================================

    We use WinRunner as a load testing tool operating at the GUI layer as it allows us to record and playback user actions from a vast variety of user applications as if a real user had manually executed those actions. We use WinRunner in addition to LoadRunner when we want to record user experience response time. Visit mercuryinteractive.com/products/WinRunner/ for detailed information on WinRunner.

    http://www.loadtest.com.au/Technology/winrunner.htm

    The following diagram shows how a GUI layer testing tool, such as WinRunner, operates.


    nmtcolin 发表于:2008.03.11 09:35 ::分类: ( Testing ) ::阅读:(37次) :: 评论 (0)
    ===========================================================
    Standard WinRunner Functions
    ===========================================================

    This helps me select functions quickly by type of object and then by purpose. Add the function prefix to the suffixes inside each cell.

    I am working now to create sample scripts that demo these functions in use.

    http://www.wilsonmar.com/1wrfuncs.htm

    Topics this page:
    on this page OS Functions
    on this page File Functions
    on this page COM Functions
    on this page Window Functions
    on this page Text Controls
    on this page Navigation Controls
    on this page Special Controls
    on this page String Functions
    on this page CSO Libraries
    on this page Custom Controls
    on this page Function Libraries
    on this page Generic Custom Functions
    on this page Naming Conventions
    on this page Your comments???

    http://www.wilsonmar.com/docs/wr70/csolib.zip


    nmtcolin 发表于:2008.03.07 14:43 ::分类: ( Testing ) ::阅读:(69次) :: 评论 (2)
    ===========================================================
    Java程序性能测试一实现方法
    ===========================================================

    Java程序性能测试

    1 概述

    在开发中,性能测试是设计初期容易忽略的问题,开发人员会为了解决一个问题而“不择手段”,作者所参与的项目中也遇到了类似问题,字符串拼接、大量的网络调用和数据库访问等等都对系统的性能产生了影响,可是大家不会关心这些问题,“CPU速度在变快”,“内存在变大”,并且,“好像也没有那么慢吧”。

    有很多商业的性能测试软件可供使用,如JprofilerJProbe Profiler等,但在开发当中显得有些遥远而又昂贵。

    2 目标

    本文将讲述如何利用Java语言本身提供的方法在开发中进行性能测试,找到系统瓶颈,进而改进设计;并且在尽量不修改测试对象的情况下进行测试。

    3 预备知识

    面向对象编程通过抽象继承采用模块化的思想来求解问题域,但是模块化不能很好的解决所有问题。有时,这些问题可能在多个模块中都出现,像日志功能,为了记录每个方法进入和离开时的信息,你不得不在每个方法里添加log("in some method")等信息。如何解决这类问题呢?将这些解决问题的功能点散落在多个模块中会使冗余增大,并且当很多个功能点出现在一个模块中时,代码变的很难维护。因此,AOPAspect Oriented Programming)应运而生。如果说OOPAobject Oriented Programming)关注的是一个类的垂直结构,那么AOP是从水平角度来看待问题。

    动态代理类可以在运行时实现若干接口,每一个动态代理类都有一个Invocation handler对象与之对应,这个对象实现了InvocationHandler接口,通过动态代理的接口对动态代理对象的方法调用会转而会调用Invocation handler对象的invoke方法,通过动态代理实例、方法对象和参数对象可以执行调用并返回结果。

    说到AOP,大家首先会想到的是日志记录、权限检查和事务管理,是的,AOP是解决这些问题的好办法。本文根据AOP的思想,通过动态代理来解决一类新的问题——性能测试(performance testing)。

    性能测试主要包括以下几个方面:

    l 计算性能:可能是人们首先关心的,简单的说就是执行一段代码所用的时间

    l 内存消耗:程序运行所占用的内存大小

    l 启动时间:从你启动程序到程序正常运行的时间

    l 可伸缩性(scalability)

    l 用户察觉性能(perceived performance):不是程序实际运行有多快,而是用户感觉程序运行有多快.

    本文主要给出了计算性能测试和内存消耗测试的可行办法。

    4 计算性能测试

    4.1 目标:

    通过该测试可以得到一个方法执行需要的时间

    4.2实现:

    Java为我们提供了System. currentTimeMillis()方法,可以得到毫秒级的当前时间,我们在以前的程序当中一定也写过类似的代码来计算执行某一段代码所消耗的时间。

    long start=System.currentTimeMillis();

    doSth();

    long end=System.currentTimeMillis();

    System.out.println("time lasts "+(end-start)+"ms");

    但是,在每个方法里面都写上这么一段代码是一件很枯燥的事情,我们通过Javajava.lang.reflect.Proxyjava.lang.reflect.InvocationHandler利用动态代理来很好的解决上面的问题。

    我们要测试的例子是java.util.LinkedListjava.util.ArrayListget(int index)方法显然ArrayList要比LinkedList高效,因为前者是随机访问,而后者需要顺序访问。

    首先我们创建一个接口

    public interface Foo {

    public void testArrayList();

    public void testLinkedList();

    }

    然后我们创建测试对象实现这个接口

    public class FooImpl implements Foo {

    private List link=new LinkedList();

    private List array=new ArrayList();

    public FooImpl()

    {

    for(int i=0;i<10000;i++)

    {

    array.add(new Integer(i));

    link.add(new Integer(i));

    }

    }

    public void testArrayList()

    {

    for(int i=0;i<10000;i++)

    array.get(i);

    }

    public void testLinkedList()

    {

    for(int i=0;i<10000;i++)

    link.get(i);

    }

    }

    接下来我们要做关键的一步,实现InvocationHandler接口

    import java.lang.reflect.InvocationHandler;

    import java.lang.reflect.Method;

    import java.lang.reflect.*;

    public class Handler implements InvocationHandler {

    private Object obj;

    public Handler(Object obj) {

    this.obj = obj;

    }

    public static Object newInstance(Object obj) {

    Object result = Proxy.newProxyInstance(obj.getClass().getClassLoader(),

    obj.getClass().getInterfaces(), new Handler(obj));

    return (result);

    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

    Object result;

    try {

    System.out.print("begin method " + method.getName() + "(");

    for (int i = 0; args != null && i < args.length; i++) {

    if (i > 0) System.out.print(",");

    System.out.print(" " +

    args[i].toString());

    }

    System.out.println(" )");

    long start=System.currentTimeMillis();

    result = method.invoke(obj, args);

    long end=System.currentTimeMillis();

    System.out.println("the method "+method.getName()+" lasts "+(end-start)+"ms");

    } catch (InvocationTargetException e) {

    throw e.getTargetException();

    } catch (Exception e) {

    throw new RuntimeException

    ("unexpected invocation exception: " +

    e.getMessage());

    } finally {

    System.out.println("end method " + method.getName());

    }

    return result;

    }

    }

    最后,我们创建测试客户端,

    public class TestProxy {

    public static void main(String[] args) {

    try {

    Foo foo = (Foo) Handler.newInstance(new FooImpl());

    foo.testArrayList();

    foo.testLinkedList();

    } catch (Exception e) {

    e.printStackTrace();

    }

    }

    }

    运行的结果如下:

    begin method testArrayList( )

    the method testArrayList lasts 0ms

    end method testArrayList

    begin method testLinkedList( )

    the method testLinkedList lasts 219ms

    end method testLinkedList

    使用动态代理的好处是你不必修改原有代码FooImpl,但是一个缺点是你不得不写一个接口,如果你的类原来没有实现接口的话。

    4.3扩展

    在上面的例子中演示了利用动态代理比较两个方法的执行时间,有时候通过一次简单的测试进行比较是片面的,因此可以进行多次执行测试对象,从而计算出最差、最好和平均性能。这样,我们才能“加快经常执行的程序的速度,尽量少调用速度慢的程序”。

    5 内存消耗测试

    5.1 目标

    当一个java应用程序运行时,有很多需要消耗内存的因素存在,像对象、加载类、线程等。在这里只考虑程序中的对象所消耗的虚拟机堆空间,这样我们就可以利用Runtime 类的freeMemory()totalMemory()方法。

    5.2 实现

    为了方便期间,我们首先添加一个类计算当前内存消耗。

    class Memory

    {

    public static long used()

    {

    long total=Runtime.getRuntime().totalMemory();

    long free=Runtime.getRuntime().freeMemory();

    return (total-free);

    }

    }

    然后修改Handler类的invoke()方法。

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

    Object result;

    try {

    System.out.print("begin method " + method.getName() + "(");

    for (int i = 0; args != null && i < args.length; i++) {

    if (i > 0) System.out.print(",");

    System.out.print(" " +

    args[i].toString());

    }

    System.out.println(" )");

    long start=Memory.used();

    result = method.invoke(obj, args);

    long end=Memory.used();

    System.out.println("memory increased by "+(end-start)+"bytes");

    } catch (InvocationTargetException e) {

    throw e.getTargetException();

    } catch (Exception e) {

    throw new RuntimeException

    ("unexpected invocation exception: " +

    e.getMessage());

    } finally {

    System.out.println("end method " + method.getName());

    }

    return result;

    }

    同时我们的测试用例也做了一下改动,测试同样一个显而易见的问题,比较一个长度为1000ArrayListHashMap所占空间的大小,接口、实现如下:

    public interface MemoConsumer {

    public void creatArray();

    public void creatHashMap();

    }

    public class MemoConsumerImpl implements MemoConsumer {

    ArrayList arr=null;

    HashMap hash=null;

    public void creatArray() {

    arr=new ArrayList(1000);

    }

    public void creatHashMap() {

    hash=new HashMap(1000);

    }

    }

    测试客户端代码如下:

    MemoConsumer arrayMemo=(MemoConsumer)Handler.newInstance(new MemoConsumerImpl ());

    arrayMemo.creatArray();

    arrayMemo.creatHashMap();

    测试结果如下:

    begin method creatArray( )

    memory increased by 4400bytes

    end method creatArray

    begin method creatHashMap( )

    memory increased by 4480bytes

    end method creatHashMap

    结果一幕了然,可以看到,我们只需要修改invoke()方法,然后简单执行客户端调用就可以了。

    6 结束语

    AOP通过分解关注点和OOP相得益彰,使程序更加简洁易懂,通过Java语言本身提供的动态代理帮助我们很容易分解关注点,取得了较好的效果。不过测试对象必须实现接口在一定程度上限制了动态代理的使用,可以借鉴Spring中使用的CGlib来为没有实现任何接口的类创建动态代理。

    7 参考资料

    本文中提到的一些性能测试概念主要来自http://java.sun.com/docs/books/performance/

    一些AOP的概念来自Jbosshttp://www.jboss.org/index.html?module=html&op=userdisplay&id=developers/projects/jboss/aop

    动态代理和AOP的某些知识来自http://www.springframework.org/docs/reference/aop.html

    8 作者声明

    东西写的一般,不过是我辛勤劳动所为,转载请注明出处,可以通过whq3721@163.com 与我联系,http://freshman.52blog.net

    本文来自:http://blog.csdn.net/freshmanya/archive/2004/11/28/196893.aspx

    笔记:
    文章写得很好,很实用。
    采用java本身的动态代理机制实现的AOP来测试实现了某个接口的类的各个方法的性能,很妙。
    正如作者所说的,这种方式的局限性就在于只能测试实现了某接口的类的测试。采用AspectJ应该会是更好的方式。
    nmtcolin 发表于:2008.02.01 15:43 ::分类: ( Testing ) ::阅读:(918次) :: 评论 (67)
    ===========================================================
    J2EE性能问题的诊断示例
    ===========================================================

    J2EE性能问题的诊断示例

    http://www.innovatedigital.com/htm_speek/Diagnose_J2EE3.shtml


    nmtcolin 发表于:2008.01.24 09:21 ::分类: ( Testing ) ::阅读:(69次) :: 评论 (0)
    ===========================================================
    Three Reasons To Consider Being a Test Developer
    ===========================================================

    Three Reasons To Consider Being a Test Developer

    When it comes to careers in the world of software most people think of programmers or what are more formally known as developers. Developers are the people who write the software which is consequently sold or utilized by the organization. I’ll call them dev-developers to distinguish them from test developers. Sometimes people will also think of testers. Testers are the people who don’t program but run the software written by developers to find bugs. What gets lost in the shuffle is a specialized class of developers who are also testers. We like to call them test-developers. These are the people that write software to test software. It is they who will be the subject of this essay.

    The term “test developer” is sometimes used to refer to a tester who knows a scripting language like Javascript or Perl or maybe even knows VB. Usually this person has no formal training and takes on only simple tasks. That is not what I refer to in this essay. The test developers I am referring to are a specialization of developers. They write complex code in production languages utilizing computer science techniques. See my previous essay on why test developers are real developers.

    So, why should you consider becoming a test developer? Why not just become a dev-dev instead of a test-dev? That is the subject of this essay. There are three primary reasons to become a test-dev rather than a dev-dev. These are that it makes you a better programmer, the code you write is more broad, and it is at a sweet spot in the development cycle.

    Programmers who are or have been test developers are, on average, better programmers than those who have not. They have a feel for what is likely to go wrong with software and so code for failure instead of coding for success. All too often those who have not been testers write code until it works and then stop. They write so that it can work but not so it will always work. Test-developers have practice breaking programs and so know where they will encounter problems. They are thus more successful at anticipating what error conditions may happen and writing resilient code.

    Secondly, test developers tend to write code which exercises the product at a higher level. Instead of focusing all of your effort on a way to make a widget spin, instead you get to see what happens if multiple widgets spin at the same time or how spinning widgets interact with the IFoo class. Test developers write code that exercises the product as a whole which is often more interesting and more rewarding than spending time optimizing one little corner case. You get a more wholistic view of the product which leads to better understanding of how the various pieces interact. Additionally, you often get to do more fun work like determining ways to break the system, put various pieces together, analyze its performance, etc.

    Finally, test development is at a sweet spot in the product release cycle. Dev-developers work furiously in the early cycle getting their pieces code complete. They then work furiously late in the cycle fixing the final few bugs. The end result is often very long hours. Test developers, on the other hand, are generally under less pressure. In the early product cycle, you can only work as fast as code becomes available to you. In the late cycle, your tests are already in place. If they aren’t, it is too late to add them. I don’t mean to imply that test developers don’t work hard. They do. They just tend to feel less deadline pressure than dev-devs.

    If you have experiences as a test developer that you feel may benefit someone trying to make a career decision involving test development, please share them in the comments section.

    http://blogs.msdn.com/steverowe/archive/2005/01/19/356361.aspx


    nmtcolin 发表于:2008.01.22 17:01 ::分类: ( Testing ) ::阅读:(78次) :: 评论 (0)
    ===========================================================
    Crap4J力求通过算法判定代码质量http://www.crap4j.org/
    ===========================================================

    Crap4J力求通过算法判定代码质量

    Crap4J这个新项目的目标非常清晰:

    现在没有一种特别简单的,100%准确并且客观的方法来判定一段代码是否糟透了。不过研究和经验都能证明我们的直觉:那些由其他人写的过于复杂和曲折的代码往往就是那些让人说出“这简直是垃圾”的代码。如果看这段代码的人将来还要负责维护这段代码,那么他的反应往往就会变成“有没有搞错!”

    但光是抱怨还不够,我们需要更精确的测量。Crap4j根据复杂性和测试覆盖率得出了一个数值指标。

    给定任意Java方法m,m的CRAP值如下式计算:

    CRAP(m) = comp(m)^2 * (1 - cov(m)/100)^3 + comp(m)

    其中 comp(m)是方法m的圈复杂性(cyclomatic complexity),cov(m)自动测试(如JUnit测试,非人工QA)达到的测试覆盖率。圈复杂性(cyclomatic complexity)是一个广泛使用的著名指标,它的取值等于方法中唯一决策(unique decisions)的数量加1。测试覆盖率计算我们采用的是基本路径覆盖(basis path coverage)。

    跟任何指标一样,指标的数值必须小心使用,不可盲从;不过这个指标的确可以作为改善代码的出发点,它提供了一种手段去明确定位最需要改进的代码。

    较低的CRAP值表示代码不太复杂和/或代码受到了自动化、可重复的测试的周全保护,因此修改和维护代码的风险较小。较高的CRAP值表示修改的风险较大,因为受到高度复杂性或者低自动化测试覆盖率(甚至没有自动化测试)的双重威胁。

    Crap4j可从 www.junitfactory.com/crap4j/update/下载,它是一个Eclipse插件。要获得更详细的信息,可以阅读JUnitFactory提供的介绍

    查看英文原文:Crap4J Seeks to Use Algorithms to Determine Code Quality

    http://www.artima.com/weblogs/viewpost.jsp?thread=215899

     查看全文
    nmtcolin 发表于:2008.01.22 15:55 ::分类: ( Testing ) ::阅读:(68次) :: 评论 (1)
    ===========================================================
    Approaches to Performance Testing
    ===========================================================
    Approaches to Performance Testing
    http://dev2dev.bea.com/pub/a/2005/09/performance_testing.html

    Abstract

    There are many different ways to go about performance testing enterprise applications, some of them more difficult than others. The type of performance testing you will do depends on what type of results you want to achieve. For example, for repeatability, benchmark testing is the best methodology. However, to test the upper limits of the system from the perspective of concurrent user load, capacity planning tests should be used. This article discusses the differences and examines various ways to go about setting up and running these performance tests.

    Memory Leak Analysis
    JRockit Mission Control 2.0(Energy)
    http://dev2dev.bea.com.cn/bbsdoc/20060710293.html
    Memory Leak Analysis

    nmtcolin 发表于:2007.11.30 14:57 ::分类: ( Testing ) ::阅读:(71次) :: 评论 (0)
    ===========================================================
    基于用户体验的性能测试
    ===========================================================

    (一)基于用户体验的性能测试-创建下降曲线

    (二)基于用户体验的性能测试-单用户区域

    (三)基于用户体验的性能测试-性能屈服期


    nmtcolin 发表于:2007.11.15 14:01 ::分类: ( Testing ) ::阅读:(69次) :: 评论 (0)
    ===========================================================
    我用FreeMind
    ===========================================================

    原文出处:http://risker.org/tech/FreeMind/
    1. 所谓MindMap
    1.1 MindMap是什么
    MindMap是什么呢?其实是英国人托尼·巴赞创造的一种提出笔记方法,和传统的直线记录方法完全不同,它以直观形象的图示建立起各个概念之间的联系。在国内,MindMap又被称为脑图或思维导图。

    思维导图(Mind Mapping)以放射性思考(Radiant Thinking)为基础的收放自如方式,除了提供一个正确而快速的学习方法与工具外,运用在创意的发想与收敛、项目企划、问题解决与分析、会议管理等方面,往往产生令人惊喜的效果。它是一种展现个人智力潜能极至的方法,将可提升思考技巧,大幅增进记忆力、组织力与创造力。它与传统笔记法和学习法有量子跳跃式的差异。

    1.2 MindMap软件介绍
    其实当前MindMap软件相当多,最为流行的应该这三款:

    Mindjet MindManager
    Inspiration
    FreeMind
    对我来说,FreeMind最合适,原因有二:

    跨平台,这样无论我在Windows、Debian或者FreeBSD下都可以正常使用;
    采用xml保存数据,方便读取或者与其它程序转换;
    功能简洁,却又恰到好处的够用,因此我就选定它了!

    2. 我用FreeMind
    2.1 速读
    通过我的读书笔记可以看出,用FreeMind做记录是非常方便的。

    采用了FreeMind后,我对一些“快餐书籍”的阅读方式是这样的:

    仔细看一遍目录,根据目录先画一张mindmap,基本把握作者的思路;
    进入阅读状态,边读边写写画画,圈出重点,读完一章,便在mindmap中完善一章的内容,如此周而复始;
    看整张mindmap,从整体回顾,找出重点,标记不同的颜色以便今后重点重读,并且结合自己的感觉,填进mindmap中;
    扔开mindmap,闭上眼睛回忆阅读的结果。
    2.2 小项目管理
    FreeMind有个很好的功能是根据目录创建文件,也就是可以根据某个目录下的文件结构来直接生成一个MindMap,这个功能也很诱人,于是我利用它来管理我的小项目。

    首先直接生成一幅MindMap,然后进行部份细节调整和分类,再标出生要等级。当项目中有新任务创建时,就做简单记录。这样就能轻松地将企业内部的项目放在一起全盘考虑和分析了。

    2.3 脑力激荡
    一帮朋友在一起讨论某个创业机会时、几个程序员在商量产品功能特点的时候、企业管理人员聚会研究公司发展战略的时候……或者,仅仅是自己想写一篇文章的时候,比如我现在:)

    FreeMind是否都能助你一臂之力?

    2.4 会议记录
    会议记录这点似乎乏善可陈,谁都能看出用它做会议记录,相对较能抓住所谈事务的主题,并且容易促进与会者的关联分析。

    3. 小技巧
    3.1 快捷键或鼠标
    我常用的快捷键有:

    在下方新增节点 = Enter
    新增子节点 = INSERT
    在上方新增节点 =Shift+Enter
    查找 = Ctrl+F
    编辑 = F2
    展开或缩起 = Space

    当然,按F3-F9能够给节点设置不同的颜色等等,也是很常用的。另外还有些组合键,如按住Alt键后用鼠标选中根节点,就是全选。按住Ctrl+Shift后用鼠标连接两个节点,便是在节点间创建连接线……快捷键也可以自定义,但通常无须这样做。具体的细节也可以参见帮助文件。

    3.2 在web上发布
    当你精心完成一个MindMap后,是否有希望别人看到的愿望呢?直接通过freemind-browser可以轻松地将Mindmap发表到网站上,并且访问者能够象直接操作程序般对各节点进行展开、关闭等行为。

    只要将freemindbrowser.html中的两部份稍做修改,即标题和具体mm文件的位置,并连同freemindbrowser.jar一起复制到你的web服务器上,用户应该就能够正常浏览了。

    3.3 聪明的复制与粘贴
    FreeMind比其它软件优势的一个地方还在于它智能的复制方式,例如,我可以通过一个有缩进层次关系的txt、html或其它文件复制成很漂亮的MindMap,也能将MindMap直接复制进word、excel甚至outlook中,并保持良好的缩进和层次关系。

    3.4 修改配置文件
    在一份user.properties的文件中,保存着许多可配置的选项,其中仅有几项是通过Edit->Preference可以设定的。这份文件通常在你的~目录下,在windows 2k、xp和2003下,应该在c:Documents and Settings(your user name) freeminduser.properties,如果是Win9x下则在C:WINDOWSfreeminduser.properties,要判断你的HOME目录,可以直接在cmd窗口输入:echo %HOMEPATH%

    里面的部份格式如下:

    ## Experimental features, "true" / "false"
    #experimental_file_locking_on = false
    ##If dnd is enabled. "true" or "false"
    #draganddrop = true
    ###The Modes which Freemind will load on startup, full Class names separated by a comma.
    #modes = freemind.modes.browsemode.BrowseMode,freemind.modes.mindmapmode.MindMapMode,freemind.modes.filemode.FileMode
    ##The initial mode that is loaded on startup
    #initial_mode = MindMap
    并不难理解,就不多做说明了。

    3.5 MindManager数据导出到FreeMind
    身边有很多朋友使用的Mind Map工具是MindManager X5,这毫无疑问是一款杰出的商用软件,但与FreeMind之间的格式却是不相通用的,好在两者都采用xml格式来保存数据,因此数据转换并不困难。

    先用解压缩工具打开MindManager的*.mmap文件--该格式实际上就是将相关信息打包压缩。下图是用winrar打开时的情况,我们可以看到里面有一个Document.xml的文件,这就是MindManager的主文件了。

    采用特定的xslt,比如mm2fm.xslt,再配合xsltproc软件,将Document.xml解压后直接进行处理,便能够轻松地将该xml顺利转成Freemind所能理解的mm格式:

    c:xsltproc>xsltproc.exe -o ssp2p.mm mm2fm.xslt Document.xmlc:xsltproc>
    3.6 FreeMind数据保存到MindManager
    因为成功地游说了几个朋友转移到FreeMind上来,因此一般我自己没有这个需求,偶尔要做这种转换时,就投机取巧了一把:

    选择File->Export to HTML,将mm导出为html;
    用MS Word打开该html文件,并另存为Word的doc格式;
    打开MindManager,采用File->Open->Microsoft word document(*.doc,*.dot),选定刚才保存的文件后打开。

    3.7 添加自己的插件
    一个程序如果可定制程度高,当然能让人觉得更加自由。MindManager可以使用vb编写宏,并且直接载入菜单,这方面FreeMind做得如何呢?

    答案是:相当出色,事实上你可以用java或者jython编写插件并加载。

    在windows下,到C:Program FilesFreeMindaccessoriesplugins下创建文件Pyhello.py如下:

    from freemind.extensions import NodeHookAdapterimport javax.swing as swingclass Pyhello(NodeHookAdapter): def __init__(win): win = swing.JFrame("HelloWorld") win.size = (200, 200) win.show()instance=Pyhello()
    这是插件程序本身,唯一的功能就是显示Hello World :)

    创建Pyhello.properties如下:

    documentation=This is a simple Jython script that tests the node hook possibilites
    ## the script returns an object of this type:base=freemind.extensions.NodeHookAdapterscript=Pyhello.pymodes=freemind.modes.mindmapmodedocumentation=welcome to risker.orgicon=accessories/plugins/icons/kcmsystem.png
    这里定义了上面那个程序的位置、运行模式、说明及图标,重新载入FreeMind时,我们可以看到在工具栏上多出一个图标,点击弹出helloworld。

    3.8 数据导出
    当前的最新测试版本是v 0.72,在这个版本中新增了将MindMap导出为图片或xslt文件的插件,不用费劲心机地截屏或者打印了,直接存成图片发送好了。


    nmtcolin 发表于:2006.06.09 09:18 ::分类: ( Testing ) ::阅读:(402次) :: 评论 (11)