又长了一岁
August 7th, 2008 282 Viewssed中如何引用变量
August 5th, 2008 296 Views最近写了一个系统资源监控的脚本,想让它每次机器重启后也可以自动启动,决定放到inittab中去,于是写了一个脚本run.sh,执行的时候启动脚本,并且加入inittab,可是调试的时候发现sed对shell的变量引用一直无法替换,百思不得其解,后来得到几位高手指点,终于解决,还有两种解决方法。
问题描述:
命令是这样的
work_dir=/home/ractest
sed ‘/start_mon.sh/d
/init.crsd/ a\
h4:3:respawn:${work_dir}/scripts/start_mon.sh >/dev/null 2>&1
‘ /etc/inittab
想把work_dir替换,但是没成功。
sed “/start_mon.sh/d
/init.crsd/ a\
h4:3:respawn:${work_dir}/scripts/start_mon.sh >/dev/null 2>&1
” /etc/inittab
试过,报错
sed: command garbled: /init.crsd/ ah4:3:respawn:/home/ractest/ricky/atm_monitor/scripts/start_mon.sh >/dev/null 2>&1
在Solaris上不行,但是在Linux上是可以的,所以初步确定是sed版本的问题,但是在Solaris上怎么解决这个我呢?有如下两种方法:
方法一:使用单引号
单引号:
sed ‘/start_mon.sh/d
> /init.crsd/ a\
> h4:3:respawn:’${work_dir}’/scripts/start_mon.sh >/dev/null 2>&1
> ‘ /etc/inittab
方法二:使用双引号
sed “/start_mon.sh/d
> /init.crsd/ a\\
> h4:3:respawn:${work_dir}/scripts/start_mon.sh >/dev/null 2>&1
> ” /etc/inittab
经过测试,两种方法都可以成功。
记录之!
软件测试基础-Alpha和Beta
July 16th, 2008 519 Views软件产品的生命周期,我们经常说到Alpha测试,Beta测试(其实还有Gamma, Delta测试),软件发布的时候经常看到RC, RTM,这些究竟是如何界定的,发布阶段到底怎么划分的,我们今天就看看wiki的解释。
A software release is the distribution, whether public or private, of an initial or new and upgraded version of a computer software product. Each time a software program or system is changed, the software engineers and company doing the work decide on how to distribute the program or system, or changes to that program or system. Software patches are one method of distributing the changes, as are downloads and compact discs.
Software release stages
![]()
The software release life cycle is composed of different stages that describe the stability of a piece of software and the amount of development it requires before final release. Each major version of a product usually goes through a stage when new features are added, or the alpha stage; a stage when it is being actively debugged, or the beta stage; and finally a stage when all important bugs have been removed, or the stable stage. Intermediate stages may also be recognized. The stages may be formally announced and regulated by the project’s developers, but sometimes the terms are used informally to describe the state of a product. Conventionally, code names are often used by many companies for versions prior to the release of the product, though the actual product and features are rarely secret.
阅读全文 »
小猪猪看电影记
July 12th, 2008 305 Views这是小猪猪第三次看电影了-如果算上在妈妈肚子里的那次。第一次看电影是出生之前,嫌太吵没看完就中途退场了。
第二次是一岁半左右的时候,看投名状,那么惊天动地的打斗场面,居然就睡着了!
这次原计划去看《功夫熊猫》,听看过的朋友反馈还不错,结果错过了档期,早上打电话过去,东海太平洋全天都是新片《赤壁》,本想改变计划。无奈昨天答应他的,他已经记住了,早上一起床就闹着去看电影,冒着毛毛细雨,我们一家三口就出发了。
小朋友的注意力是有时限的,这点跟大人一样,差别是小朋友的更短,两个半小时的《赤壁》看到一个小时以后,就开始坐不出了,把鞋脱了在座位下面跑来跑去,幸好中午场的人不是很多,跑到最后累了,居然又一次在电影院睡着了!我原本还担心八卦阵那样血腥的打斗场面会不会对他幼小的心灵造成什么阴影,不知道两岁多点这个时候会不会有记忆?反正我两岁左右的事情是一点不记得了,:-D
距离电影快结束的时候,突然发现我放在裤兜里的钱包不见了,因为那一排就我们一家三口,所以初步怀疑是滑落在地上了,后来赶紧借手电过来找,把那排座位翻了遍,都没找着,心想完了,赶紧挂失吧,还好就两张招行的卡,赶紧95555就打过去了,报了卡号之后,很快就挂失了,正打算在挂另外一张的时候,电影散场了,工作人员帮忙在座位的夹缝找到了丢失的钱包-虚惊一场。顺便赞一句-招行的服务效率和质量还是不错的,没辜负我一直是他的忠实用户。
软件测试基础-自动化测试和手工测试
July 8th, 2008 556 Views自动化测试是近年在国内比较流行的概念,针对自动化测试对应的就是手工测试了,这两个概念之间的对照,从维基百科(wiki)转摘如下:
Test automation is the use of software to control the execution of tests, the comparison of actual outcomes to predicted outcomes, the setting up of test preconditions, and other test control and test reporting functions. Commonly, test automation involves automating a manual process already in place that uses a formalized testing process. < ==这里说,测试自动化是对已经比较规范的的手工流程进行自动化的过程,言外之意就是如果你连手工的流程都还不规范,还是别自动化了。
Over the past few years, tools with graphical user interfaces (GUI) that help programmers quickly create applications have dramatically improved programmer productivity. This has increased the pressure on testers, who are often perceived as bottlenecks to the delivery of software products. Testers are being asked to test more and more code in less and less time. <==看来自动化测试工具也不全是好事,测试人员的压力越来越大了。Test automation is one way to do this, as manual testing is time consuming. As different versions of software are released, the new features will have to be tested manually time and again. But, now there are tools available that help the testers in the automation of the GUI which reduce the test time as well as the cost; other test automation tools support execution of performance tests.
Many test automation tools provide record and playback features that allow users to record interactively user actions and replay it back any number of times, comparing actual results to those expected. However, reliance on these features poses major reliability and maintainability problems. Most successful automators use a software engineering approach, and as such most serious test automation is undertaken by people with development experience. <==大多数成功的测试自动化案例都是把它作为一个软件工程来实施,并且大多数情况下测试自动化都是具有开发经验的人来担任的。
A growing trend in software development is to use testing frameworks such as the xUnit frameworks (for example, JUnit and NUnit) which allow the code to conduct unit tests to determine whether various sections of the code are acting as expected under various circumstances. <==看来测试自动化框架的确很流行。Test cases describe tests that need to be run on the program to verify that the program runs as expected. All three aspects of testing can be automated.
阅读全文 »
软件测试基础-确认和验证
June 28th, 2008 504 Views这是经典的软件测试的两个概念,难怪有人说,软件测试的过程就是Verification和validation的过程。其中的verification我们就翻译为确认-对需求的确认。validation翻译为验证-验证最终的产品是我们期望的。下面看看wiki的定义吧。
Verification and Validation (software)
In software project management, software testing, and software engineering, Verification and Validation (V&V) is the process of checking that a software system meets specifications and that it fulfils its intended purpose. It is normally part of the software testing process of a project. In pharmaceutical industry, verification involves testing the suitability of well established procedures or (compendial) methods, whereas validation varies from Cross validation, Empirical validation, periodic partial validation, internal/external validation, competence validation by nature, and Cleaning validation, Process validation, Equipment validation, or Documentation validation by tasks.
Definitions
阅读全文 »
软件测试基础-黑盒和白盒
June 26th, 2008 498 Views黑盒和白盒只是一个相对的概念,严格意义上说,并并没有绝对的黑盒和白盒,而且现在也有了灰盒的概念。
看看wiki上对于黑盒白盒的定义吧。
Black box testing takes an external perspective of the test object to derive test cases. These tests can be functional or non-functional, though usually functional. The test designer selects valid and invalid input and determines the correct output. There is no knowledge of the test object’s internal structure.
This method of test design is applicable to all levels of software testing: unit, integration, functional testing, system and acceptance. The higher the level, and hence the bigger and more complex the box, the more one is forced to use black box testing to simplify. While this method can uncover unimplemented parts of the specification, one cannot be sure that all existent paths are tested.
Test design techniques
Typical black box test design techniques include:
* Equivalence partitioning
* Boundary value analysis
* Decision table testing
* Pairwise testing
* State transition tables
* Use case testing
* Cross-functional testing
[edit] Hardware
Functional testing devices like power supplies, amplifiers, and many other simple function electrical devices is common in the electronics industry. Automated functional testing of specified characteristics is used for production testing, and part of design validation.
White box testing
White box testing (a.k.a. clear box testing, glass box testing or structural testing) uses an internal perspective of the system to design test cases based on internal structure. It requires programming skills to identify all paths through the software. The tester chooses test case inputs to exercise paths through the code and determines the appropriate outputs. In electrical hardware testing, every node in a circuit may be probed and measured; an example is in-circuit testing (ICT).
Since the tests are based on the actual implementation, if the implementation changes, the tests probably will need to change, too. For example ICT needs updates if component values change, and needs modified/new fixture if the circuit changes. This adds financial resistance to the change process, thus buggy products may stay buggy. Automated optical inspection (AOI) offers similar component level correctness checking without the cost of ICT fixtures, however changes still require test updates.
Software Testing Portal
While white box testing is applicable at the unit, integration and system levels of the software testing process, it is typically applied to the unit. While it normally tests paths within a unit, it can also test paths between units during integration, and between subsystems during a system level test. Though this method of test design can uncover an overwhelming number of test cases, it might not detect unimplemented parts of the specification or missing requirements, but one can be sure that all paths through the test object are executed.
Typical white box test design techniques include:
* Control flow testing
* Data flow testing
For more information on Control flow testing and Data flow testing click on this link to download pdf.

