51Testing软件测试论坛

标题: 求助,如何编写测试计划 [打印本页]

作者: fugoolisk    时间: 2008-10-31 22:51
标题: 求助,如何编写测试计划
小弟正在学习软件测试, 现在老师有一道题目,对一个简单的java类做测试,要求写测试计划和测试用例数据,由于从来没有做过,我现在感觉无从下手,请各位前辈能够教教我。
如何编写测试计划。
谢谢
java类的代码如下:

public class Rect {
       public int x1, y1, x2, y2;
    public Rect(int x1, int y1, int x2, int y2) {
        this.x1 = x1;
        this.y1 = y1;
        this.x2 = x2;
        this.y2 = y2;
    }
    public Rect(int width, int height) { this(0, 0, width, height); }
    public Rect() { this(0, 0, 0, 0); }
    public void move(int deltax, int deltay) {
        x1 += deltax; x2 += deltax;
        y1 += deltay; y2 += deltay;
    }
    public boolean isInside(int x, int y) {
        return ((x >= x1)&& (x <= x2)&& (y >= y1)&& (y <= y2));
    }
    public Rect union(Rect r) {
        return new Rect((this.x1 < r.x1) ? this.x1 : r.x1,
                        (this.y1 < r.y1) ? this.y1 : r.y1,
                        (this.x2 > r.x2) ? this.x2 : r.x2,
                        (this.y2 > r.y2) ? this.y2 : r.y2);
    }
    public Rect intersection(Rect r) {
        Rect result =  new Rect((this.x1 > r.x1) ? this.x1 : r.x1,
                                (this.y1 > r.y1) ? this.y1 : r.y1,
                                (this.x2 < r.x2) ? this.x2 : r.x2,
                                (this.y2 < r.y2) ? this.y2 : r.y2);
        if (result.x1 > result.x2) { result.x1 = result.x2 = 0; }
        if (result.y1 > result.y2) { result.y1 = result.y2 = 0; }
        return result;
    }
    public String toString() {
        return "[" + x1 + "," + y1 + "; " + x2 + "," + y2 + "]";
    }
}



小弟在此先谢谢各位前辈了
作者: mingg    时间: 2008-11-18 11:43
按照程序中的步骤,逐步调用,并验证判断条件的结果!
例如:
调用 Rect(3,2) ;
查询程序运行结果

初值可以考虑int类型边界值,特殊值(0)或部分负数值等进行




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2