• 软件测试第三次作业


    这次作业主要是根据代码,画出控制流图,并涉及计边覆盖,点覆盖,主路径的知识。

    具体作业内容如下

    /*******************************************************
         * Finds and prints n prime integers
         * Jeff Offutt, Spring 2003
         ******************************************************/
        public static void printPrimes (int n)
        {
            int curPrime; // Value currently considered for primeness
            int numPrimes; // Number of primes found so far.
            boolean isPrime; // Is curPrime prime?
            int [] primes = new int [MAXPRIMES]; // The list of prime numbers.
             
            // Initialize 2 into the list of primes.
            primes [0] = 2;
            numPrimes = 1;
            curPrime = 2;
            while (numPrimes < n)
            {
                curPrime++; // next number to consider ...
                isPrime = true;
                for (int i = 0; i <= numPrimes-1; i++)
                { // for each previous prime.
                    if (curPrime%primes[i]==0)
                    { // Found a divisor, curPrime is not prime.
                        isPrime = false;
                        break; // out of loop through primes.
                    }
                }
                if (isPrime)
                { // save it!
                    primes[numPrimes] = curPrime;
                    numPrimes++;
                }
            } // End while
             
            // Print all the primes out.
            for (int i = 0; i <= numPrimes-1; i++)
            {
                System.out.println ("Prime: " + primes[i]);
            }
        } // end printPrimes
    

      一 画出控制流图

    二、设计一个t2=(n=5)比t1=(n=3)容易发现发现的错误

    三、写一个测试用例,使相应的测试路径访问连接while语句开始到fot语句得边,而不用通过while的循环体

    t:n=1

    四、例举每个节点覆盖,边覆盖和主路径覆盖的TR

    节点覆盖需求:{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}

    边覆盖需求:{(1,2),(2,11),(2,3),(3,4),(4,5),(5,6),(5,7),(6,5),(6,9),(7,8),(7,2),(8,2),(9,10),(10,7),(11,12),(12,13),(12,15),(13,14),(14,12)}

    主路径覆盖需求:

  • 相关阅读:
    HTML
    JavaScript事件对象
    JavaScript 事件入门
    如何向github上传文件
    crystal
    BUUCTF[强网杯 2019]随便注wp
    BUUCTF[CISCN2019 华东南赛区]Web4 wp
    BUUCTF[NPUCTF2020]ezinclude wp
    Windows下Ant的环境配置
    Java解惑(1)——表达式之谜
  • 原文地址:https://www.cnblogs.com/GSONG/p/5335339.html
Copyright © 2020-2023  润新知