JTracker - J2EE逻辑测试解决方案

类别:Java 点击:0 评论:0 推荐:

使用蓝图

测试图解:

  Java 源文件:                                                

 package testservlet;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

public class sample extends HttpServlet {
...
static int count=0;
/*<<<TPID=TP110>>>*/        //
<< =============== logical test point,the test ID is TP110 
public void init() throws ServletException {
}

public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
...
PrintWriter out = response.getWriter();
out.println("<html>");
/*<<<TPID=TP211> >>*/       //
<< ===============  logical test point,the test ID is TP211 
count++;
out.println("<head><title>sample</title></head>");
out.println("<body>");
out.println("<p>The servlet has received a GET. This is the reply.</p>");
out.println("</body></html>");
/*<<<TPID=TP222>>>*/        //
<< ===============  logical test point,the test ID is TP222 
}
/*<<Clean up resources>>*/
public void destroy() {
}
}

  测试CASE:                                                       

TestCase001.tc //Normal CASE001...
TestCase002.tc //NormalCASE002...
...

  TestCase001.tc:

////////test CASE info//////// 
caseInfo{
title = normal basic case;                                           //test case title
path = D:\UnitTest;                                                    //test file path
source = Servlet1.java;                                               //source file name
package = testservlet;                                                //package name 
class = testservlet.Servlet1;                                       //full class name
}
////////Logic Test Point///////// 
MEnter(name=doGet){                                              //when system entry Servlet1's doGet method, it will take this logic test;
//Logic test content;
title("test1 here is doGet full name");                     //display "test1 here is doGet full name";
field.dis(intfield);                                                       //display Servlet1's field intfield;
}
MExit(name=doGet){                                                //when system exit the method Servlet1.doGet ,it willtake this logic test;
//Logic test content;
title("test1 here is doGet method name");            //display "test1 here is doGet method name";
field.dis(stringfield);                                                //display Servlet1's field stringfield;
}
BPoint(TP = TP222){                                               //when system run at test point TPSLV132, it will take this logic test;
//Logic test content;
title("TP222here");                                                   //display "TP222here";
field.dis(field3);                                                         //display Servlet1's field field3;
}

 

  测试结果:                                                          

TestCase001.tr //Normal CASE001...
TestCase002.tr //NormalCASE002...
...

  TestCase001.tr:

*******************************************************************
** JTracker 1.0 standard edition                                 **
** Copyright(c) 2002-2003 Chen ShiMing. All Rights Reserved.     **
** http://www.jtracker.net                                       **
*******************************************************************
****************************** START ******************************
**************************** case info ****************************
===== CASE::: testCase001.tc =====
-------ADD::MEnter(name=doGet)
-------ADD::MExit(name=doGet)
-------ADD::BPoint(TP = TP222)
*******************************************************************
***Location::time=10:45.34.158*testservlet.Servlet1*doGet*line=51
*** Module::MEnter(name=doGet)
------------------------------
title:"test1 here is doGet full name"
dis : intfield=1 
===================================================================
***Location::time=10:45.34.259*testservlet.Servlet1*doGet*line=99
*** Module::BPoint(TP = TP222)
------------------------------
title:"TP222here"
dis : field3=3 
===================================================================
***Location::time=10:45.34.339*testservlet.Servlet1*doGet*line=146
*** Module::MExit(name=doGet)
------------------------------
title:"test1 here is doGet method name"
dis : stringfield=string 
===================================================================
******************************** END ******************************

本文地址:http://com.8s8s.com/it/it17018.htm