ѧ
JOURNAL OF SOFTWARE 
1999 10 5 Vol.10 No.5 1999



Եķ滷Ƕо
ޡⷼ
ժҪעΪԵһЧѽʵý׶, Ȼùע뼼Ŀǰ׼.йΧע˼,ͨǶϵķ滷,ʵֶԱ뼶Ĺ,ı״̬,շڵʧЧģʽ,´,ӶﵽԤڵĲĿ.һӦ·վźſϵͳĲ,ȡõЧ.
ؼʡ,,,ע,·ź.
ͼšTP311
Embedding Fault in Simulation Environment for Software Black-box Testing 
TU Hai-ying WU Fang-mei
Department of Telecommunication Shanghai Tiedao University Sha nghai 200331
Abstract Fault-injection, as a perfected technique for software testing, now has been put into practical use. However, only a very few of the documents have expounded on how to use fault-injection technique in soft ware black-box testing. A new approach to the difficulty, i.e., peripherally in jecting faults in the software is presented in this paper. By means of a fault- imbedded environmental simulation, faults are injected in the input level of the software under test. These faults may induce inherent failure mode, thus bringi ng about unexpected output--consequently, the anticipated goal of the test is attained. This method has been used for testing railway signaling control system software and desirable results have been achieved.
Key wordsSoftware testing, black-box, environmen tal simulation, fault injection, railway signaling.
  ע뼼ΪһֲԼָ,ضĹģ,Ϊġʶķʽ ,ʩڴϵͳ,ԼٸϵͳĴʧЧķ,ͬʱ۲Ⲣϵͳע ϵӦϢ,ͨ,ϵͳ֤۵Ĺ.
еϵͳԵĹע뷽,FERRARI1ǽֱʩ ڱϵͳ;DEPEND2ǽԭϵͳķģ,ͨģע ԭϵͳĿ,⻹һЩӲӲϵĹע뷽,ǰᶼ ǱϵͳԲ߿,Ҳһ.ĵ˼ǽע뼼Ӧ ĺ,ע뵽ķл,ͨǶϵķ滷,ģ леĸ쳣,,շȱݵı¶,´ ,ӶﵽԵĿ.
ڵӲѸͷչԼϵͳݴĹ㷺Ӧ,ǲӲ µʧЧ΢΢.صױ,80%95%ʵʱʧЧݴϵ ͳнΣ3.Զ,ȱ򲻿ɱ.һ ˵꾡˵ɵ,һɿԱǲܶ µ.ȻύܹܺõܵҪ,Ȼڷ ,пִܳĽ.Ÿ߿ɿԡ߰ȫ,ȱп صĺ.ԭ,ĲԽĹȱݽ,֤ Ϸ.ǳֲΪܸɲ,Ϊ³Բ.
1 ڶԱȼԷ
ĳЩӦ,ɿߺûĵ3Ŀɿԡȫ֤ǱҪ е.漰ıԼר,ʱıԲ߶ֻһ 䡱.
ͼ1ʾΪһֻڶԱȼԷ.Է˵ṩԱ ,ȷ롢ϵ.԰ͬʱԱͱĿϢ, ͳģ鸺·б.ͬΪӦóһµĽ, 뼴עһĹϺ,ܵ²ͬĽ.ڴŲԷԱ͸ ,עĹڶԱ֪,ԴĿԹϵķ.

2÷滷
,ǾаȫҪģִл4 .ڲԵķ滷Ӧ뱻еʵڹԡʱԼ Ͼܵؽӽ.ں,滷Ϊ״̬S. ˼ɢ¼滷õӦԺ.ķ滷һ ¼ҪƲ:
a) ȷйصĻ;
(b) ֶ;
(c) ķģ;
(d) ģĻΪ,״̬ת¼;
(e) .
軷صĲϸm,n,÷滷 mװ,״̬SS1S2...Si...Sn,S iʾi״̬.SiHiȡֵ,iHiֿܵ״̬ ʵiͬһĶHiֿܵ״̬,m,nHi (1in )ֵԽ,滷Խ,ԵĹҲ֮.
3ǶϵĻ
һ,ߺͿڶԴĿ̬źܴ.ԵĿ Ϊ˾¶ڵȱ,Ա,ȥ.,ĿΪĶ ¾ͳ˲ԵһֱҪֶ.ڷʱϵڰպͲе,Ƕ ϵĻﵽʵʻнеʱʵֵĲЧ.ܹ Իг־ùϵķӦ,ҿԷڻ˲³ֵ.Ҫ, ʵоƻԵĲĿڷ滷Ҳɷؽ.
滷Ƕʱ,ؼڹϵ,ָֹԭĳ ϱֵĹΪǷͬ.ԲͬĹΪĹģ,ʵе ʽҪ.һ˼еƿɴ򻯷ģ͵ĸӳ̶.һֿе :ȷ˵ĸ,гӦĿÿһ ܵʧЧģʽ滷֮ϵ.ַڹӦк̶ܴȵ רҾ.ר֪ʶضҪ,ҲӰЧʵĹؼ֮ .,ʧЧĻʽ,ɹΪ.,ۺϻΪ͹ Ϊģ,Ʒ.
Ϊʹʵ,Խĳ״̬͹״̬ʾһģ,һ Ƕϵķ滷ģ.,ǶϵĻ潫ǰƲе(c),(d) ʵĶ,:
(c) Ƕϵķģ,ʱ״̬תƹ켣̬֮䡢 ̬̬̬̬̬֮״̬ת,ͼ2Ϊ͵ĳķģ .:״̬ļN={Nj1jr};Ǳ״̬L={Lj 1js};״̬ļF={Fj1jt};r+s+t=H(HΪĿ״̬). +fʾעĳֹ;-fʾ;+kʾĳһĶ.

(d) ģĺϵĻΪ.ڲȡɢ¼ʱ򷨵 ,Ƕϵķʽؼ,ͼ3ʾ.
fault-embedded-action-process(list,order)
{ judge the object location is right;
switch(order)
{case k:insert new events into the list 
object,time,original state Ni,following state Nj ;
object,time,original state Li,following state Lj ;
object,time,original state Li,following state Fj ;
object,time,original state Fi,following state Fj ;
object,time,original state Fi,following state Lj; 
casef: insert two kinds of new events into the list (+f or -f)
object,time,original state Ni,following state Fj ;
object,time,original state Ni,following state Lj ;
object,time,original state Li,following state Fj ;
object,time,original state Fi,following state Fj ;
object,time+duration,original state Fi,following state Nj;
object,time+duration,original state Li,following stat e Nj;
}
}
ͼ3 ǶϷʽ
ͼеġobject,time,original state,following stateʾ¼,4 ֱ¼ʱ̡ԭʼ״̬Ͷĺ״̬.е1״̬ ת¼ڽ(order-k)ʱ,2״̬ת¼ɹ(orde r-f).ʵֹ,עϵĶʽ.һ ,ļ¼ʽΪobject,ʼʱtime,k,ļ¼ ʽΪobject,ʼʱtime,ϳʱduration,f. ʵʽķ,ֱڽķͽ עķ.
ڷаѽĳһпܵ״̬ת¼뵽¼ʱlist ,˱пܴڴͬʱ¼,Ҷͬһͬʱ¼,ֻһ Ч¼.ȻЧ.ͬʱ¼صΣЧʱ,о 5ݾͻ¼⴦,һ.
4ע
֪,ԵĶȱĿз. ³ԵĲͬҲѸָ.ڶʵʵĿ,ݲԽĿ зּ.ݲͬӦ,ĳһϵΪϸָû ,üµʹ.Щȱݹ,޸ ,лع.
ֲԵĲ԰˳,һĿܵ½ϸ߹ʵĲ,ڲ Թʹùϲ԰Ŀĳ.԰¿ɷΪ3:
(a) ԰(k);
(b) ϲ԰(1ֹf);
(c) Ϲϲ԰(ֹ).
Լ޹µĲ֤ڻϵ걸.˵ר Ĺϸɲּڿ鱻绷쳣ʱİȫ.ע ϻǶϡʵеĳƵȺ͹ϵµʧЧΣ̶, ԰Ϊͬȼİ.뱻֮ӳϵͼ4ʾ. AΪ԰;BΪ˵ҪĵϰϹϰ;CΪ ܵΣպĵϰϹϰ;DΪġܿܵغĵ Ϲϰ.

Ȼ,ǰû,Եó½:
ۢ: ĿӦa2b2=;
ۢ: a2b2c2=нǿĿ; 
ۢ: a2b2c2d2=.
Ա뱣֤ÿһܶõ˳ֵ֤.ڹģ Сϵͳ,Ƽʹ걸,ÿһÿܴڵ붼Ϊ, Թܵͬʱ,ӲĿϵͳǷ.Ȼ,ģϴʱ, ϱը,ʹʱϲٿ.ʱֻܳȡÿĵ ȡȡʽг.
ڽеϺϹϲʱ,ϵע뷽ʽԤ,Ҳģʽ. ϱȽϼ,Է滷ĳһĳֹϺ,ֻԸöһϿӰ .ϹǾ,ͨע뵥ʵֵ.ЩϿͬһ Ĳͬ,ҲǷڲͬϵйԵĹ.֮,ЩϹ Ӧʵʵϵͳлпܷ,Ƚȱݵ¼. ,ϵ걸Բʵ,ϹϵĲ򲻿걸,ҲҪھȼ ֺԻͲ.
ͼ5ʾǵϵע,ϹǶεذ趨ʱע .Զͼ6ʾ,ͼеϹϲ˫Ϊ.ڲ,Լƻ ݻֵİɵߵ˳.,һõĲԹ߱߱൱. ڹע,Ĺעǲܵ,Զ֮,Ӧṩһ Ѻõ˹Խ,Էؽиֹú͹.


ڲʱĵһҪԵԴ֧,԰ơʱ Աõ.ӦۺϿǱĹͲԿ֧,ѡѵͷʱ,ֹͣ ,ûӹϵͳɿ߶Բϸ޸.
5Ӧʵͽ
Ĳĸ˼Ӧ·վźſϵͳ.·վźſ ϵͳһ־и߶Ȱȫʵʱϵͳ,ҲҪǰȫ,й ȫ.
ݺ˼빹Ĳƽ̨ͼ7ʾ.

վźſϵͳķ滷̨λƽ̨λ,³վֵԱĲ ֳλƽ̨λ,³վź豸.ǶϺķ滷Ա 4:(a) ֵԱ;(b) ֵԱķ;(c) ֳ豸״̬ ;(d) ֳ豸״̬.
԰Ǹ˵רҾ,4϶.Աͳģ λƽ̨λ,ϱϢнͳ.
ƽ̨ѶԶ·վźſϵͳϵͳĲ,ȡõЧ.Ƕ ϵķ滷ñ¶һЩδֹȱ.ʵг˷滷 ģĹ,ЩȱݱصİȫԺ.1Ϊƽ̨·վźſ ϵͳýĶ.1ڳз1ǰȫȱ, ˼;ںϰзְȫȱ.2ͨ, 3సоڰȫǰȫȱ.
1Խձ

ȼ12
Aȱ
Bȱ
Cȱȱȱ

оڰۡԼٺͷ滷ĲԷ滹ֵֵ̽,ڽ Ĺвϵ.
оõչƻĿ.
,Ů,1972,ʿ,ҪоΪ,Լ.
   ⷼ,Ů,1938,,ʿʦ,ҪоΪ˹,ȫ.
ͨѶϵ:,Ϻ 200331,ϺѧŹϵ
ߵλ:(ϺѧŹϵ Ϻ 200331)
E-mail: haiying@shtdu.edu.cn
ο
[1]Kanawati G A, Kanawati N A. FERRARI: a flexible software-based fau lt and error injection system. IEEE Transactions on Computer, 1995,44(2):24825 9
[2]Goswami K K, Lyer R K. DEPEND: a simulation-based environment for system l evel dependability analysis. IEEE Transactions on Computer, 1997,46(1):6074
[3]Tang Dong, Hecht H. An approach to measuring and assessing dependabi lity for critical software systems. In: Stark G ed. Proceedings of the 8th Inter national Symposium on Software Reliability Engineering. Los Alamitos, CA: IEEE C omputer Society Press, 1997. 192202
[4]Zhu Hong. Specification and evaluation of software environment simul ation for testing safety critical software. In: Min Ying-hua, Tang Dong eds. Pr oceedings of the International Workshop on Computer-aided, Design, Test, and Ev aluation for Dependability. Beijing: International Academic Publishers, 1996. 19 3198
[5]Steinman J S. Interactive SPEEDES. In: Rutan A H ed. Proceedings of the 24th Annual Simulation Symposium. Los Alamitos, CA: IEEE Computer Society Pr ess, 1991. 149157
1998-04-13յԭ,1998-06-22յ޸ĸ
