zoukankan      html  css  js  c++  java
  • 软件测试图覆盖

     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)}

    五、主路径覆盖截图

  • 相关阅读:
    htmlunit 基础01
    @Transactional 事务失效问题
    SQL优化总结
    单点登录实现过程
    常见的mybatis对应关系
    命名规范(Oracle数据库)
    12-5 作为可叠加修改的特质
    12-4 Ordered特质
    10 绘制螺旋示例
    10-6 参数化字段
  • 原文地址:https://www.cnblogs.com/xiao94/p/5332252.html
Copyright © 2011-2022 走看看