码迷,mamicode.com
首页 > 其他好文 > 详细

软件测试图覆盖

时间:2016-03-31 00:04:07      阅读:277      评论:0      收藏:0      [点我收藏+]

标签:

 public static void printPrimes (int n) 
    { 
        int curPrime;  
        int numPrimes; 
        boolean isPrime; 
        int [] primes = new int [MAXPRIMES];  
        primes [0] = 2; 
        numPrimes = 1; 
        curPrime = 2; 
        while (numPrimes < n) 
        { 
            curPrime++; 
            isPrime = true; 
            for (int i = 0; i <= numPrimes-1; i++) 
            {
                if (curPrime%primes[i]==0) 
                {  
                    isPrime = false; 
                    break; 
                } 
            } 
            if (isPrime) 
            { 
                primes[numPrimes] = curPrime; 
                numPrimes++; 
            } 
        } 
        
        for (int i = 0; i <= numPrimes-1; i++) 
        { 
            System.out.println ("Prime: " + primes[i]); 
        } 

一、控制流图

技术分享

二、测试用例t1=(n=3),和t2=(n=5),t2容易发生二t1不容易发生的错误是:数组越界问题。

三、n=1时,相应的测试路径访问连接while语句开始到for语句的边,而不用通过while循环体。

四、节点覆盖:{0,1,2,3,4,5,6,7,8,9,10,11,12}

     边覆盖:{(0,1),(1,2),(2,3),(3,4),(4,5),(5,7),(4,6),(3,7),(7,9),(6,3),(7,8),(8,9),(1,9),(9,10),(10,11),(11,10),(10,12)}

    主路径覆盖:{(0,1,2,3,4,5,7,8,9,10,11,),(0,1,2,3,4,5,7,8,9,10,12),(0,1,2,3,4,5,7,9,10,11),(0,1,2,3,4,5,7,9,10,12),(0,1,2,3,4,6),

                     (0,1,9,10,12),(10,11,10),(11,10,11),(3,4,6,3),(4,6,3,4),(6,3,4,6)}

 

五、主路径覆盖截图

技术分享

 

软件测试图覆盖

标签:

原文地址:http://www.cnblogs.com/xiao94/p/5332252.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!