html tool

显示标签为“test”的博文。显示所有博文
显示标签为“test”的博文。显示所有博文

2018年6月4日星期一

pyfit - fitness use for python

http://www.codexiu.cn/python/blog/802/
[popexizhi: python slim 只找到了2.6和3.0使用的看来已经很久不更新了:)好可惜啊 ]

PS:fit 依赖包的安装
需要下载安装PyFIT,下载地址https://pypi.python.org/pypi/PyFIT/0.8a2
pip install PyFIT==0.8a2 

参考:https://www.cnblogs.com/muxinyue/p/4225801.html


Column Fixture

特点:行表格展现形式,一条测试用例对应一行数据
Wiki
#test page
!1 This is a demo for fitnesse
!2 Use this page as a reference.
!3 Variable Setup
!define COMMAND_PATTERN {python "%m" %p}
!define TEST_RUNNER {/usr/lib/python2.7/site-packages/fit/FitServer.py}
!path /root/tool/fitness/test/
!|ColumnFixtureTest.AddTest |
| a| b| add?|
|1|2|3|
|1|3|3|
----------------------------------------------------------------------
Python: [popexizhi: ColumnFixtureTest.py ]
from fit.ColumnFixture import ColumnFixture
class AddTest(ColumnFixture):
    _typeDict = {
                  "a":"Int",
                  "b":"Int",
                  "add":"Int",
                  }
    def __init__(self):
        ColumnFixture.__init__(self)
        self.a=''
        self.b=''
    def add(self):
        c=self.a+self.b
        return c


2018年4月17日星期二

fitness 补遗I


http://fitnesse.org/PlugIns
[popexizhi: 在看fitness的 doc,发现一个不同语言支持列表,还是很多样的;这里有个好玩的是,powershell, 很奇怪这个也可以用fitness点进去看了一下,发现https://github.com/konstantinvlasenko/PowerSlim
中提到linux如下,好奇怪的组合,go了一下,确实可以,好吧!看了windows真的是要和linux汇入一条河流了:).

Supported Platforms

  • Windows
  • Linux
  • Ubuntu
]

SLiM servers for different languages/environments 

Plugin or AccessoryAuthorURLDocs
RubySlimby Uncle Bob, Corey Haines, Doug Bradburyhttp://github.com/unclebob/RubySlimvideo Now at Slim version 0.3!
RubySlim for Ruby 1.9.3by Lar Vonkhttps://github.com/lvonk/rubyslimSlim version 0.3!
.Net slimby Mike Stockdalehttp://github.com/jediwhale/fitsharp/downloadsdocs
Python Slimby Tim Baconhttp://pypi.python.org/pypi/waferslimIt's a "0.9" release: while the code is believed to be "feature complete" (tested against fitnesse-20090214) more feedback from wider usage would be welcome ;-)
Transactional Spring Slim Runnerby Gojko Adzichttp://github.com/unclebob/springslimdocs
PhpSlimby Gregor Gramlichhttp://github.com/ggramlich/phpslimVideo Tutorials
CSlim: Slim for C and C++by Doug Bradbury, James Grenning, Uncle Bobhttp://github.com/dougbradbury/cslim/tree/masterSee README in the repository
Objective-C Slimby Eric Meyerhttps://github.com/ericmeyer/ObjectiveCSlimdocs
CocoaPod for Swift, Obj-Cby Paul Stringer, Eric Meyerhttps://github.com/paulstringer/OCSlimProjectCocoaPod for iOS and macOS Xcode Projects (wraps Objective-C Slim). See README in the repository.
Grails FitNesse pluginErik Pragthttp://www.grails.org/plugin/fitnessedocs
.NET Fitby Mike Stockdalehttp://github.com/jediwhale/fitsharp/downloadsdocs
Coffee Script SlimMike Suarezhttps://github.com/limadelic/decaf
Power Shell SlimKonstantin Vlasenkohttps://github.com/konstantinvlasenko/PowerSlimdocs
SmalltalkFitRandy Coulmanhttps://github.com/randycoulman/SmalltalkFitSee README in the repository  

2016年8月14日星期日

How to install and configure Testlink

add:http://informaticandocr.blogspot.com/2013/01/how-to-install-and-configure-testlink.html
---------------------------------------------------------------

Prerequisites:
- Java JDK
- MySQL Server
- Apache Web Server
- PHP5

Notes:
a. This tutorial was created using the following version of each software needed.
- Ubuntu 10.04 i386 as OS.
- TestLink 1.9.2
- MySQL 5.1
- Apache2

b. The installation of prerequisites is detailed at the end of the document.

c. As a personal recommendation, before start the testlink installer in the browser, set up the files and prerequisites to make the installation experience faster and easier.

Let’s Go!

1. Download & install some necessary packages
sudo apt-get install php5-mysql php5-pgsql php5-gd php5-ldap php-pear

2. Edit the php.ini file located in /etc/php5/apache2 and set the following parameters:
max_execution_time = 120
session.gc_maxlifetime = 2700

3.Restart the apache server

4. Download testlink:

5. Unpack your testlink package, change the name and copy to your /www apache directory:
5.1 Unpack
tar zxvf testlink-1.9.2.tar.gz
5.2 Change the name
mv testlink-1.9.2.tar.gz testlink
5.3 Copy to the /www directory
sudo cp -r teslink /var/www/testlink

6. Once you have it in your /www directory change the permissions of some folders in your testlink directory:
# chmod 777 gui/templates_c
# chmod 777 logs
# chmod 777 upload_area

7. Go to your browser and access the testlink installer at: localhost/testlink and follow the instructions in your screen.

8. If everything went well installer will tell you that the configuration file was not written, to do this, go to /var/www/testlink and create a file named config_db.inc.php with the information provided in the installer.

9. Now you can close your browser for a while.

10. The last step is change a configuration file by editing the file in /var/www/testlink/config.inic.php and set the following parameters:

$tlCfg->config_check_warning_mode = 'SILENT'
$tlCfg->api->enabled = TRUE;
$tlCfg->exec_cfg->enable_test_automation = ENABLED;

11. Done!. Now you can go to localhost/testlink and login with the username: admin and password: admin

[popexizhi:很有效的blog i like ]

2014年4月17日星期四

selenium Python 2 WebDriver log


python 脚本运行问题:
---------------------------------------------------
======================================================================
ERROR: test_creat (__main__.Creat)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "creat.py", line 11, in setUp
    self.driver = webdriver.Firefox()
  File "D:\Python2.6\lib\site-packages\selenium\webdriver\firefox\webdriver.py"
 line 59, in __init__
    self.binary, timeout),
  File "D:\Python2.6\lib\site-packages\selenium\webdriver\firefox\extension_con
ection.py", line 47, in __init__
    self.binary.launch_browser(self.profile)
  File "D:\Python2.6\lib\site-packages\selenium\webdriver\firefox\firefox_binar
.py", line 61, in launch_browser
    self._wait_until_connectable()
  File "D:\Python2.6\lib\site-packages\selenium\webdriver\firefox\firefox_binar
.py", line 105, in _wait_until_connectable
    self.profile.path, self._get_firefox_output()))
WebDriverException: Message: "Can't load the profile. Profile Dir: c:\\docume~1
\admini~1\\locals~1\\temp\\tmppy7eht Firefox output: *** LOG addons.xpi: startu
\r\n*** LOG addons.xpi: Skipping unavailable install location app-system-local\
\n*** LOG addons.xpi: Skipping unavailable install location app-system-share\r\
*** LOG addons.xpi: checkForChanges\r\n"

----------------------------------------------------------------------
Ran 1 test in 71.609s

FAILED (errors=1)

-----------------------------------------------------
go了半天没有什么头绪,看报错应该是找不到c:\\docume~1\admini~1\\locals~1\\temp\\tmppy7eht 中的firefox, 自己找了一下,也没有发现,嘻嘻,最后重新安装了一下
找到http://selenium.googlecode.com/git/docs/api/py/index.html ,测试了一下
-------------------------------------
Example 0:
open a new Firefox browser
load the page at the given URL
from selenium import webdriver

browser = webdriver.Firefox()
browser.get('http://seleniumhq.org/')
--------------------------------------
ok可以打开了,再次测试之前的脚本ok了。看来就是安装firefox的路径问题,问题是如果不重新安装,如何配置一下可以让selenium自己找到firefox呢?这是个问题:)
[?]如何配置一下可以让selenium自己找到firefox

2014年4月15日星期二

ld 获取不同与上一个ip的随机ip函数


1.如何获得指定范围的随机函数范围为[min,max] j=rand()%(max-min+1) + min
2.参数如何in/out
int _GetIP(const char *ip , char *oldip)
套用lr_系列函数的声明
const 的为返回值,这里的string类型都用 char 的指针来做了
input的直接用 char * 就ok
3.关于switch case的两个小问题
3.1 好久不用 case 后要用break都不适应了:)
3.2 看OO类比猜想是不是全部的case语句都可以用重载对象来实现呢?idea thinking一下吧4.古老的字符串比较问题
0 == strcmp(lr_eval_string("{ip}"),oldip)
这里的strcmp到不是什么问题,问题是在这个char * oldip与lr_save_string("192.168.1.1","ip")中的ip,在比较时要对这个Ir_save_string出来的ip做lr_eval_string()处理
4.1 lr_save_string保存出来的是lr的参数,这个值在ld的调试环境才显示,其他的C变量值是不显示的
4.2 lr_eval_string() 用来get parameter's string value using lr_eval_string function [来源:http://motevich.blogspot.com/2007/11/loadrunner-parameter-string-int.html]
----------------------------------------------------------------------
这里的一个小常识从这个地址来的
i = atoi(lr_eval_string("{prmCounter}"));

We get parameter's string value using lr_eval_string function and after that atoi function converts it to int value. Apparently, it is easy :)
------------------------------------------------------------------------

[?]
1.ld中C下如何设置参数的默认值,如果不可以,lr_系列的函数是如何封装的?

最后附上全部的代码:
------------------------------------------------------------------
//#include
//#include

vuser_init()
{

_GetIP("ip","");
lr_output_message(lr_eval_string("{ip}"));

_GetIP("ip","ip");
lr_output_message(lr_eval_string("{ip}"));
return 0;
}

int _GetIP(const char *ip , char *oldip)
{ //get different ipaddress
int i,j,x;

i=1;//first getip
while( (1 == i)||(0 == strcmp(lr_eval_string("{ip}"),oldip)))
{
j=rand()%3;
switch (j)
{case 1 : lr_save_string("192.168.1.1","ip");break;
case 2 :lr_save_string("192.168.1.2","ip");break;
case 0 :lr_save_string("192.168.1.0","ip");break;}
x=strcmp(lr_eval_string("{ip}"),oldip);
//lr_output_message("x=%d",x);
i++;
}
return 0;

}

2013年3月5日星期二

network 分析


系统自带的命令
  • 来源:http://jasonyong.blog.51cto.com/47753/174197
    1. watch ifconfig
    2. watch more /proc/net/dev
    • 2.watch more /proc/net/dev
      来源:http://zhidao.baidu.com/question/154169071
      Inter-|   Receive                                                |  Transmit
       face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
      记录了不同网络接口(interface)上的各种包的记录
      第一列是接口名称,一般你能看到 lo (自环,loopback接口)和 eth0 (网卡)
      第二大列是这个接口上收到的包统计,第三大列是发送的统计,每一大列下又分为以下小列
      收(如果是第三大列,就是发)字节数(byte), 包数(packet), 错误包数(errs), 丢弃包数(drop), fifo (First in first out)包数, frame (帧,这一项对普通以太网卡应该无效的)数, 压缩(compressed)包数(不了解), 多播(multicast, 比如广播包或者组播包)包数。

    1. watch more /proc/net/snmp     [来源:http://blog.csdn.net/balderfan/article/details/7641697]
    • [go]关于/proc 文件
      来源:http://www.path8.net/tn/archives/2589
      "proc文件系统是一个伪文件系统,它只存在内存当中,而不占用外存空间。它以文件系统的方式为访问系统内核数据的操作提供接口。用户和应用程序可以通过proc得到系统的信息,并可以改变内核的某些参数。"
    [next] 分析使用参数是什么?内置和外置工具的使用
    • [doing]5/3/2013
      如果看到network的流量过大,如何进一步分析,
      统计全部的包的内容,排序包的内容,分析最多的内容
      如果这样分析,next:
      1.统计包的不同分类的工具
      2.包如何分类的方式
      3.抓包工具
      下一步分析应该按这个方向进行
      1.linux下的抓包工具(类比windows上的)
      2.对某个口上的包的分类统计工具
      3.数据包通用的分类标准是什么    

2013年3月4日星期一

翻译 :QTP脚本的错误处理方式


参考来源:http://www.qtpschool.com/2012/03/recovery-scenarios-in-qtp.html

Recovery Scenarios in QTP
  • What is Recovery Scenario?
    Recovery Scenarios are used to recover the test from unexpected errors and continue with execution.
    [pope译]
    Recovery Scenario 是什么?
    Recovery Scenario 被用来从异常错误中恢复测试 ,并执行。
    What is unexpected errors?
    Unexpected error or exception is a unpredictable/unexpected error which occurs suddenly during execution of the script. These kind of errors makes your script fail/stop/paused.
    [pope译]
    异常错误是什么?
    异常错误是 在执行脚本时,不可预测的/意外的 情况突然发生。这种类型的错误导致脚本fail/stop/paused。
    [?] 在脚本执行时stop与paused的区别不知会是什么?
    Atonomy of Recovery Scenarios?
    A recovery scenario consists of the following three patrs:
    1. Trigger Event
    2. Recovery Operations
    3. Post-Recovery Test Run Option
    [pope译]
    自动的Recovery Scenarios?
    Recovery Scenarios 包含如下三个部分:
    1.触发事件(Trigger Event)
    2.恢复操作(Recovery Operations)
    3.恢复测试后运行的选项(Post-Recovery Test Run Option)

    • Trigger Event:
      The event that interrupts your run session. For example a window that may pop up on screen.
      [pope译]
      触发事件:
      此事件打断你运行的session。例如window的 弹出窗

      Recovery Operations:
      The operations to perform to enable QTP to continue running the test after the trigger event interrupts the run session. For example, clicking an OK button in a pop-up window.
      [pope译]
      恢复操作:
      此操作在触发事件终止运行session后执行,能够使QTP继续运行此测试的操作。例如:在弹出window框中点击ok按钮。
      Post-Recovery Test Run Option:
      The instructions on how QTP should proceed after the recovery operations have been performed, and from which point in the test QTP should continue. For example, you may want to restart a test from the beginning, or skip a step entirely and continue with the next step in the test. Recovery scenarios are saved in recovery scenario files having the extension .qrs. A recovery scenario file is a logical collection of recovery scenarios, grouped according to our specific requirements.

      [pope译]
      恢复运行后的选项:
      此指令定义 在恢复操作之后如何运行QTP,从testQTP脚本的什么位置开始继续。例如:你打算从开始位置重新运行,或者在测试中忽略此步骤并继续下一步。恢复操作 保存恢复场景的文件在 extension.qrs中。一个恢复场景文件按照我们具体设定的要求,收集恢复场景上的内容。

      Recovery scenario manger can handle following four events:
      1. Pop-up window: To handle unwanted pop ups.
      2. Object state: To handle object related errors at runtime.
      3. Test run error: To handle vb script statement errors at runtime.
      4. Application crash: To handle crashed applications at runtime.
      [pope译]
      恢复场景需要处理以下四点:
      1.window弹出框:处理不需要的弹出框
      2.对象状态:处理对象中,因此而相关联的错误
      3.测试运行错误:处理vb script 脚本在运行时的错误
      4.应用程序崩溃:处理应用程序的崩溃情况
      • 1. Recovery Scenario for Pop-up Window:
        Steps to follow to handle unwanted pop-ups:
        Trigger Event Steps:
        Resources Menu -->Recovery Scenario Manager -->New -->Next -->Select “Popup Window” as Trigger event -->Next -->Click on Hand Icon -->Show unwanted window with Hand icon -->Next -->Next -->(Continue below mentioned steps)


        Recovery Operations steps:

        Select function call as Recovery Operation --> Next {Open Notepad --> Save empty file with .vbs extension} --> Browse the .vbs fie path --> Next --> Uncheck Add another Recovery Operation --> Next -->(Continue below mentioned steps)


        Post-Recovery Test Run Option Steps:
        Select Post-Recovery Test Run Option {Repeat current step and continue, Proceed to Next step, Proceed to Next Action, Proceed to next test iteration, Restart current test run, Stop the Test Run} -->Next -->Enter Scenario Name -->Next -->Select Option --> Finish -->Save the scenario with “.qrs” -->Record required Recovery Operation {Click ok, Click Cancel} take the script into function -->Save the library file -->Click Run




        [pope译]
        1.Window弹出框的恢复场景:
        如下步骤允许不需要的弹出框:
        触发事件的步骤:
        Resources Menu -->Recovery Scenario Manager -->New -->Next -->Select “Popup Window” as Trigger event -->Next -->Click on Hand Icon -->Show unwanted window with Hand icon -->Next -->Next -->(继续下面提到的步骤)
        恢复操作的步骤:
        选择function 调用作为Recovery Operation --> Next {Open Notepad --> Save empty file with .vbs extension} --> Browse the .vbs fie path --> Next --> Uncheck Add another Recovery Operation --> Next -->(继续下面提到的步骤)
        恢复测试后的运行参数步骤:
        选择Post-Recovery Test Run参数{Repeat current step and continue, Proceed to Next step, Proceed to Next Action, Proceed to next test iteration, Restart current test run, Stop the Test Run} -->Next -->Enter Scenario Name -->Next -->Select Option --> Finish -->Save the scenario with “.qrs” -->Record required Recovery Operation {Click ok, Click Cancel} take the script into function -->Save the library file -->Click Run
        2. Recovery Scenario for Object State:
        Steps to follow to check Property values of an object in the application match specified values. User can specify property values for each object in the hierarchy.

        Trigger Event steps:
        Resources Menu --> Recovery Scenario Manager --> New --> Next --> Select “Object state Window” as Trigger event --> Next --> Click on Hand Icon --> Show object with and icon --> Next --> Next-->select object property with value (enabled ,false)-->click next --> (Continue below mentioned steps)
        Recovery Operations steps:
        Select function call as Recovery Operation --> Next {Open Notepad --> Save empty file with .vbs extension} --> Browse the .vbs fie path --> Next --> Uncheck Add another Recovery Operation --> Next -->(Continue below mentioned steps)
        Post-Recovery Test Run Option Steps:
        Select Post-Recovery Test Run Option {Repeat current step and continue, Proceed to Next step, Proceed to Next Action, Proceed to next test iteration, Restart current test run, Stop the Test Run} --> Next--> Enter Scenario Name --> Next --> Select Option -->Finish --> Save the scenario with “.qrs” --> Record required Recovery Operation {Click ok, Click Cancel} take the script into function --> Save the library file --> Click Run

        [pope译]
        2.对象状态的场景恢复
        步骤要求选择 应用中匹配的特殊的属性值。用户可以对不同级别的每个对象具体设置特殊的值。
        触发事件的步骤:
        Resources Menu --> Recovery Scenario Manager --> New --> Next --> Select “Object state Window” as Trigger event --> Next --> Click on Hand Icon --> Show object with and icon --> Next --> Next-->select object property with value (enabled ,false)-->click next --> (继续下面的步骤)
        场景恢复步骤:
        选择function 作为Recovery Operation --> Next {Open Notepad --> Save empty file with .vbs extension} --> Browse the .vbs fie path --> Next --> Uncheck Add another Recovery Operation --> Next -->(继续下面的步骤)
        恢复测试运行后的参数的步骤:
        选择Post-Recovery Test Run参数{Repeat current step and continue, Proceed to Next step, Proceed to Next Action, Proceed to next test iteration, Restart current test run, Stop the Test Run} --> Next--> Enter Scenario Name --> Next --> Select Option -->Finish --> Save the scenario with “.qrs” --> Record required Recovery Operation {Click ok, Click Cancel} take the script into function --> Save the library file --> Click Run
        3. Recovery Scenario for Test Run Error:
        Steps to follow to check if test does not run successfully then Test Run Error can be raised.
        Trigger Event steps:
        Resources Menu -->Recovery Scenario Manager -->New -->Next -->Select “Testrunerror Window” as Trigger event -->Next -->select any error o -->Next -->Next -->(Continue below mentioned steps)
        Recovery Operations steps:
        Select function call as Recovery Operation -->Next {Open Notepad -->Save empty file with .vbs extension} -->Browse the .vbs fie path -->Next -->Uncheck Add another Recovery Operation -->Next -->(Continue below mentioned steps)
        Post-Recovery Test Run Option Steps:
        Select Post-Recovery Test Run Option {Repeat current step and continue, Proceed to Next step, Proceed to Next Action, Proceed to next test iteration, Restart current test run, Stop the Test Run} -->Next >Enter Scenario Name >Next -->Select Option --> Finish >Save the scenario with “.qrs” -->Record required Recovery Operation {Click ok, Click Cancel} take the script into function -->Save the library file -->Click Run
        [pope译]
        3.测试运行错误时的场景恢复:
        步骤运行如下操作:如果不能成功运行测试,Error可以被增加运行。
        触发事件的步骤:
        Resources Menu -->Recovery Scenario Manager -->New -->Next -->Select “Testrunerror Window” as Trigger event -->Next -->select any error o -->Next -->Next -->(继续下面步骤)
        恢复场景步骤:
        选择function作为Recovery Operation -->Next {Open Notepad -->Save empty file with .vbs extension} -->Browse the .vbs fie path -->Next -->Uncheck Add another Recovery Operation -->Next -->(继续下面步骤)
        恢复测试运行后的参数步骤:
        选择Post-Recovery Test Run  参数{Repeat current step and continue, Proceed to Next step, Proceed to Next Action, Proceed to next test iteration, Restart current test run, Stop the Test Run} -->Next >Enter Scenario Name >Next -->Select Option --> Finish >Save the scenario with “.qrs” -->Record required Recovery Operation {Click ok, Click Cancel} take the script into function -->Save the library file -->Click Run
        4. Recovery Scenario for Application Crash:
        Steps to follow to check application failure during Test Run.

        Trigger Event steps:
        Resources Menu --> Recovery Scenario Manager--> Click New--> Click Next -->Select Application Crash as Trigger event-->Next -->Select selected executable application-->Next --> (Continue below mentioned steps)

        Recovery Operations and Post-Recovery Test Run Option Steps:
        Select Recovery Operation {Keyboard, Mouse Operation,Close Application Process, function Call, Restart, Microsoft Windows} -->Next -->If you want to check Add another operation else uncheck-->Next -->Next -->Enter Scenario Name -->Next-->Select Option -->Finish -->Close -->Save the scenario with “.qrs”
        [pope译]
        4.应用程序崩溃的场景恢复:
        此步骤允许应用程序测试运行失败。
        触发事件步骤:
        Resources Menu --> Recovery Scenario Manager--> Click New--> Click Next -->Select Application Crash as Trigger event-->Next -->Select selected executable application-->Next --> (继续下面的步骤)
        恢复场景和恢复运行时的参数步骤:
        选择Recovery Operation {Keyboard, Mouse Operation,Close Application Process, function Call, Restart, Microsoft Windows} -->Next -->If you want to check Add another operation else uncheck-->Next -->Next -->Enter Scenario Name -->Next-->Select Option -->Finish -->Close -->Save the scenario with “.qrs”
      Error handling(on error resume next)   vs   Recovery Scenarios ? 
      • If you can predict that a certain event may happen at a specific point in your test or component, it is recommended to handle that event directly within your test or component by adding steps such as If statements or optional steps or "on error resume next", rather than depending on a recovery scenario. Using Recovery Scenarios may result in unusually slow performance of your tests.They are designed to handle a more generic set of unpredictable events which CANNOT be handled pragmatically.

        [pope译]
        错误处理(在error时继续下一步) 还是 场景恢复?
        如果你可以预测{predict}特定的事件在你的测试过程或某个组成部分的特殊点可能发生,推荐直接增加步骤,来控制你的测试过程或组成部分中出现的事件,例如声明或者选择步骤 或者 “错误时继续下一步”,而不是依赖场景恢复。使用场景恢复在你测试中,可能结果导致非常慢的性能问题。他们设计用来控制更多的一般性不可预见的事件中使用。
        Example:
        On error Statements
        Following are error statements :
        1. On Error Resume Next
        2. On Error Go to 0
        3. err.number
        4. err.description
        On Error Resume Next:
        On Error Resume Next statement enables the Error handling in the code.If there is error in the code "On error Resume Next" ignores it and continue with next line of code.
        On Error Go to 0:
        On error got to 0 statement disables error handling we have previously enabled it by using On Error resume Next.
        err.number and err.description:
        Provides the error number and the description of the error
        [pope译]
        例如:
        在error声明中,做如下error 声明:
        1.错误时继续下一句
        2.错误时转到0
        3.err号
        4.err描述
         错误时继续下一步:
        错误时继续下一步声明 能够在代码中使用错误控制。如果有一个错误处理代码是“错误时继续下一步”, 那么就是忽略它并继续下一行代码。
        错误时转到0:
        错误时转到0声明 ,失去了对错误的控制 我们之前使用“错误时继续下一步”继续使用它。
        err号和err描述
        提供错误号和错误描述信息    


  

2013年2月19日星期二

LoadRunner的打印参数到controller和agent 的temp目录


1.在controller中打印param选择的值
i.脚本中添加打印内容
lr_output_message("user==%s",lr_eval_string("{NewParam}"));
或者
lr_message("user==%s",lr_eval_string("{NewParam}"));
ii.设置控制台打印日志
Vuser->run-TimeSettings->log
log options:
always send messages
extended log -> Parameter subsitution
iii.在controller中scenario groups选择某个运行的Vuser右键选择show Vuser log
2.这次是loadrunner agent 的设置
问题:
i.连接时提示:
controller中的提示“Connection to load generator faled”
在agent的主机上log提示如下:
19/02/2013 10:17:51 Error: Failed to write command line into file. Reason: No permission to create temp directory: 172.16.105.175\brr_YAR.483. [MsgId: MERR-29966]
19/02/2013 10:17:51 Error: Process "C:\Program Files\Mercury\LoadRunner\bin\lr_bridge.exe" was not created. Reason: error in parsing command line into file. [MsgId: MERR-29996]

在go了两天后,突然意识到可能是设置问题,loadrunner给的errid号是
26401~28000
32401~32600
82201~85000
都没有29966的位置。好吧!agent不是亲娘啊!:)
一直郁闷这个不能create temp directory是要写到什么位置为什么是172.16.105.175\brr_YAR.483 共享?%temp% or tmp 都看了的也没有啊!
解决:
controller中设置agent的内容自己写的是:
name:172.16.105.218
platform:windows
temporary directory: 172.16.105.218
晕死了,LoadRunner 的官方手册如下解释:
name: type the name of the load generator you want to add in the name box.
temporary directory: type a location, on the load generator, where the Controller can store temporay files.
这个name中写IP 或者 hostname(这个要求dns可以连接到,难怪看到好多位置这里要求配置ect/中的host文件呢);而temporary directory 是Controller存储临时文件使用在agent端的temp目录位置,不写的话默认为“ C:\Documents and Settings\Administrator\Local Settings\Temp\brr_DOK.486”其中brr_DOK.486为创建的,之前的应该是“%temp%”的内容。这样就ok了,“Error: Failed to write command line into file. Reason: No permission to create temp directory: 172.16.105.175\brr_YAR.483. [MsgId: MERR-29966]” 就是创建不了临时文件吗!pope的语言理解太是问题了temporary directory 为什么理解成ip了呢?这个是自己最大发挥的特点吧,不仔细(翻译中也老发现自己这个问题,我当谨慎谨慎再谨慎,想想有什么结构性的方式可以改进自己吧!)
不过塞翁失马,焉知非福呢?!其他收获还是不小的,list:
1.[try]-loadtool:
firebug
httpwatch
fiddler
2.[try]
loadrunner的agent 可以在linux中run,setup and try use
3.[read]
http://commonlrissues.blogspot.com/2009/03/common-errors-between-controller-and.html(要翻墙)
这篇文章写的很全,解释agent的问题,文章中甚至说到网卡的设置从自动识别修改为100Mbs/全双工,虽然不是处理pope遇到的问题,但想来多数问题应该都有了。此文很不错,详细翻译和try一下吧!
4.[thinking]
写给自己的,在agent端有两个exe分别是   magentservice.exe 和 magentproc.exe
写在系统server中的就是magentservice.exe ,而首次安装没有重启系统时启动的是magentproc.exe,开始pope认为两者没什么区别,go了一下发现http://blog.csdn.net/xu1314/article/details/7280262 ,按这里写的“测试脚本中有访问映射网络驱动器的代码,此时应该选择Process而不是Service” 好吧!看了还是有差别的。
pope发现的几个细节:这个两个exe一起启动时,新日志中就如下:
18/02/2013 17:15:42 Error: Communication error: Failed to bind socket. A process on the machine is already bound to the same address. [MsgId: MERR-10344]
18/02/2013 17:15:42 Error: Two Way Communication Error: Function two_way_comm_create_acceptor failed. [MsgId: MERR-60999]
18/02/2013 17:15:42 Error: Failed to create "launchservice" server. [MsgId: MERR-29974]
18/02/2013 17:15:42 Warning: Extension launcher.dll reports error -1 on call to function ExtPerThreadInitialize [MsgId: MWAR-10485]
18/02/2013 17:15:42 Error: Vuser failed to initialize extension launcher.dll. [MsgId: MERR-10700]

想来是端口被别人使用了,所以自己无法运行吧!

这两者的日志都在%temp%中
magentservice.exe为LoadRunner_agent_service.log
magentproc.exe为LoadRunner_agent_startup.log

2013年1月18日星期五

tomcat-mysql 连接问题 (附解决没有/etc/my.cnf 和启动服务的问题)



  • Types: [java.lang.Integer, java.lang.Long, java.lang.Long]
    org.springframework.transaction.CannotCreateTransactionException: Could not open JDBC Connection for transaction; nested exception is com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: The last packet successfully received from the server was 64,474,527 milliseconds ago.  The last packet sent successfully to the server was 64,474,527 milliseconds ago. is longer than the server configured value of 'wait_timeout'. You should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid this problem.
    更改此服务器设置解决以上问题
    • 参考:http://blog.csdn.net/zljjava/article/details/7996091
      unu lab:
      [lab ] add autoReconnect=true
      [popexizhi:16/1/13 测试,没有效果还是提示这个问题]
      -------------------------------------------------------------------------------------------------------------
      du lab:
      “interactive_timeout:服务器关闭交互式连接前等待活动的秒数。交互式客户端定义为在mysql_real_connect()中使用CLIENT_INTERACTIVE选项的客户端。又见wait_timeout
          wait_timeout:服务器关闭非交互连接之前等待活动的秒数。在线程启动时,根据全局wait_timeout值或全局interactive_timeout值初始化会话wait_timeout值,取决于客户端类型(由mysql_real_connect()的连接选项CLIENT_INTERACTIVE定义),又见interactive_timeout
          如此看来,两个变量是共同控制的,那么都必须对他们进行修改了。继续深入这两个变量wait_timeout的取值范围是1-2147483(Windows),1-31536000(linux),interactive_time取值随wait_timeout变动,它们的默认值都是28800。
          MySQL的系统变量由配置文件控制,当配置文件中不配置时,系统使用默认值,这个28800就是默认值。要修改就只能在配置文件里修改。Windows下在%MySQL HOME%/bin下有mysql.ini配置文件,打开后在如下位置添加两个变量,赋值。

      [lab] 修改数据库设置吧
      mysql 安装没有my.cnf 文件
          参考:http://yangrenjun.iteye.com/blog/1426525
      MySQL在启动时自动使用/usr/share/mysql目录下的my-medium.cnf文件,这种说法仅限于rpm包安装的MySQL
      所以pope自己拷贝了一个 ,没有修改就放到了etc下测试一下

      要重启mysql时,发现连init.d中的应用都没有添加
         参考:http://www.xker.com/page/e2011/0217/100202.html
      “MySQL加入到系统服务里面 
      cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld ”
      自己添加了一下,顺便看了看mysql.server的内容,嘻嘻,参数也不多,回头可以好好看一下了。
      最后测试了一下,在my.cnf 中加入两个变量
      wait_timeout=388000
      interactive_time=388000
      在mysql中查询:show variables like '%timeout%';
      | wait_timeout               | 388000 |
      +----------------------------+--------+
      ok了,等明天早晨看效果了。:)
      [lab] 还是不可以,提示一样的,现在考虑是wait_timeout 和interactive_time的单位问题吗?是毫秒?go一下,修改 明天继续测试
      go 一下参见:http://dev.mysql.com/doc/refman/5.0/en/mysql-real-connect.html
      单位是seconds,这项目就是说这个项目对这个问题是没有效果的
      [popexizhi: 好奇怪的事,18/1/13,昨天就早晨重启了一下tomcat什么参数也没有修改,今天早晨这个问题自动没有了?那我昨天早晨看到的问题,是因为只修改数据库后重启db没有重启tomcat的原因吗?不知道,这个可以作为下一个lab的内容doing了。这个lab可以到此结束了,ok,好诡异的feel]
    [next]
    •  unu
      [doing] 总结上文学到的内容
      • unu: 没有/etc/my.cnf 和 mysqld的服务如何做
        MySQL在启动时自动使用/usr/share/mysql目录下的my-medium.cnf文件,这种说法仅限于rpm包安装的MySQL
        “MySQL加入到系统服务里面  cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld ”

        du:
        my.cnf 中添加设置内容,解决超时连接问题
        在my.cnf 中加入两个变量 (单位:秒)
        wait_timeout=388000
        interactive_time=388000
        在mysql中查询:show variables like '%timeout%';
        | wait_timeout               | 388000 |
        +----------------------------+--------+
      du
      [lab] 修改mysql的设置后重启mysql,不重启tomcat,重现问题
      tri
      [lab] try 修改应用连接中的

      autoReconnect=true

2012年12月28日星期五

testlink 图表中中文字符集的问题

testlink server 上是1.9.2 的版本
查看图形报表时一直显示中文为乱码,今天go了一下,修改ok了,记录如下:

参考:http://www.ishow.me/2011/06/17/277.html

--------------------------原文-------------------------------------
步骤一:
将下载或从Windows中提取到的字体SIMYOU.TTF拷贝到Testlink中的Pchat的字体目录,路径为:
\third_party\pchart\Fonts
 【popexizhi:自己从C:\WINDOWS\Fonts 中直接找到的 用的是 宋体字 simsun.ttc 】
步骤二:
修改config.inc.php:

$tlCfg->charts_font_path = TL_ABS_PATH . “third_**/pchart/Fonts/tahoma.ttf”;
中的字体重新设置:
$tlCfg->charts_font_path = “c:/windows/fonts/SIMYOU.TTF“; 
注:本次测试用的字体为从系统中提取的,测试过系统中提取的宋体、黑体和微软雅黑都不行,其它字体希望有心的童鞋继续测试。
【popexizhi:不用重启,修改后重新加载页面就可以了。我用是宋体也是支持的,可能这个作者和自己用的testlink版本或是其他东西的版本有差异吧?!】

-----------------------------------------------------------
PS:testlink 中的test case 还是用细粒度对test 执行时较好,bug关联,执行step都比较好。但是test analysis的思路 与需求之间的关系 在细粒度下的分散问题,自己在test analysis中处理,可以在testcase 中处理吗?测试套的关系如何更好的使用,是个问题,再好好想想吧!

2012年12月24日星期一

test analysis 对系统设计的静态走查




  • 从test point 完善 test case 时,feel 不想 给出很具体的data 或是 step 了,
    but 进一步深入完善时,其实这个data和step的过程时自己在关注很具体的内容时,发现use这个结构时的问题,完善和具体化test case的data 和step 其实是对被测试内容的设计走查,在brain中的具体化过程,正是这个test 设计思路 的 力量所在。
    自己一直在疑惑的设计时,很难想象到问题,在code实现和test中却可以发现的问题,就是一个在具体化过程发现这个抽象设计问题的真正不合适的地方的很好的方法。
    so:
    1.完善和细化test case 中的data 和 step
    2.【thinking】 how to 系统使用这个过程,在设计过程中。    

2012年11月20日星期二

(未完成)I/O--翻译:ANALYZING I/O PERFORMANCE IN LINUX

来源: http://www.cmdln.org/2010/04/22/analyzing-io-performance-in-linux/

...
Great so now that I know what IOPS are how do I cal­cu­late them? IOPS are a func­tion of rota­tional speed (aka spin­dle speed), latency and seek time. The equa­tion is pretty sim­ple, 1/(seek + latency) = IOPS. Scott Lowe has a good exam­ple on his techreplublic.com blog.
Sam­ple drive:



  • Cal­cu­lated IOPS for this disk: 1/(0.003 + 0.0045) = about 133 IOPS
  • [pope译] 很好那IOPS 如何计算?IOPS是 rotational speed (转速 :主轴旋转速度),latency(延时)和 seek time (查找时间) 。这个公式很简单 1/(seek + latency) = IOPSScott Lowe 在他的techreplublic.com blog. 上有一个很不错的例子:
    " 如下硬盘:


    ===============================================================================


    It’s great to know how to cal­cu­late a disks IOPS but for the most part you can get by with com­monly accepted aver­ages. Of course sources vary but from what I have seen.
    Rota­tional Speed (rpm)IOPS
    540050–80
    720075–100
    10k125–150
    15k175–210
    Should I use SATASAS or FC? That’s a loaded ques­tion. As with most things the answer is “depends”. I don’t want to get into the SATA vs SAS debate you can do your own research and make your own deci­sions based on your needs, but I will point out a few things.
    These fac­tors are  key con­sid­er­a­tions when choos­ing what kind of dri­ves to use.
    [pope译]这样很好计算磁盘IOPS ,大部分你可以得到的数值是可接受的平均值。但根据我看到的源的不同而改变。
    Rota­tional Speed (rpm)IOPS
    540050–80
    720075–100
    10k125–150
    15k175–210
    我可以使用SATA,SAS 或者FC 吗?(【popexizhi】sata,sas,fc 参见:http://blog.csdn.net/tianlesoftware/article/details/6009110)这个是加载问题.多数答案是"依赖"。我不想在 SATA 或者SAS 中讨论你的使用和满足你自己需求的决策,但是我给出一些内容:
    选择何种类型的设备成为注意考虑的因素。

    ===============================================================================
    What RAID level should I use? You know what IOPS are, how to cal­cu­late them and deter­mined what kind of dri­ves to use, the next log­i­cal ques­tion is com­monly RAID 5 vs RAID 10. There is dif­fer­ence in reli­a­bil­ity, espe­cially as the num­ber of dri­ves in your raid-set increases but that is out­side the scope of this post.
    [pope译] 那我该用什么级别的RAID呢?你知道什么是IOPS,如何计算它们 以及 决定使用什么类型的设备,下一个分析的是RAID5 或 RAID 10 的选择。这真的很不一样,特别是当你的raid-设置数量的增长超出这个对应位置要求的范围时。[popexizhi:好吧! 自己翻译的也感觉有点儿晕,再想想 increases  [?]]
    Raid LevelWrite Oper­a­tionsRead Oper­a­tionsNotes
    011Write/Read: high through­put, low CPU uti­liza­tion, no redundancy
    [pope译]Write/Read:高速输出,低水平CPU占用,没有冗余
    121Write: only as fast as sin­gle driveRead: Two read schemes avail­able. Read data from both dri­ves, or data from the drive that returns it first. One is higher through­put the other is faster seek times.
    [pope译]Write:与单个设备一样快
    driveRead:两种读取方法,从两个设备同时读取,或读取返回数据最快的那个。其中一个的定位输出时间比另一个快。
    541Write: Read-Modify-Write requires two reads and two writes per write request. Lower through­put higher CPU if the HBA doesn’t have a ded­i­cated IOprocessor.
    Read: High through­put low CPU uti­liza­tion nor­mally, in a failed state per­for­mance falls dra­mat­i­cally due to par­ity cal­cu­la­tion and any rebuild oper­a­tions that are going on.
    [pope译]Write: Read-Modify-Write  每次写请求使用两个读取和写入请求。如果HBA 没有dedicated IO处理,就会有较低的输出 较高的CPU使用。[?]这里HBA的dedicated IOprocessor 如何翻译有问题,再想想吧!Read: 正常是低CPU使用,高输出。但在错误的预估状态时, 性能急剧下降同时引起大量计算和重新进行下面的操作。[popexizhi:这里的a failed state 是磁盘缓存对预读内容缓存的估算错误吗?]
    651Write: Read-Modify-Write requires three reads and three writes per write request. Do not use a soft­ware imple­men­ta­tion if it is avail­able
    Read: High through­put low CPU uti­liza­tion nor­mally, in a failed state per­for­mance falls dra­mat­i­cally due to par­ity cal­cu­la­tion and any rebuild oper­a­tions that are going on.
    [pope译]Write: Read-Modify-Write  每个写操作请求使用三个读取和三个写入操作。如果可行不使用软件实现。
    Read:正常时低CPU使用,高输出。但在错误的预估状态时, 性能急剧下降同时引起大量计算和重新进行下面的操作。
    As you can see in the table above, writes are where you take your per­for­mance hit. Now that the penalty or RAID fac­tor is known for dif­fer­ent raid lev­els we can get a good esti­mate of the the­o­ret­i­cal max­i­mum IOPS for aRAID set (exclud­ing caching of course). To do this you take the prod­uct of the num­ber of disks and IOPS per disk divided by the sum of the %read work­load and the prod­uct of the raid fac­tor (see write oper­a­tions col­umn) and %write workload.
    [pope译] 正如你在上面表中看到的,写操作决定着你的操作性能。现在通过RAID设置,我们可以很好的预估理论上每个RAID设置的最大的IOPS (当然不包括缓存)[?]Now that the penalty or RAID fac­tor is known for dif­fer­ent raid lev­els we can get a good esti­mate of the the­o­ret­i­cal max­i­mum IOPS for aRAID set (exclud­ing caching of course). 这句翻译的有问题,再想想!