多看看java.lang.reflect包,他可以自动化地生成如field, method等信息,有个统计信息,任务完成3分之二。测试分黑盒白盒,建议不做白盒,只做黑盒。只测试单一小函数,不要尝试去做应用逻辑(因为人都不一定能看懂别人代码,你的“毕业设计”更做不到)。注意 Syste.out 这个东西,想方法把错误响应信息截到,写入文件。

解决方案 »

  1.   

    研究一下人家怎么做的,比如JUnit,你可以下载下来试试,google一下就可以
      

  2.   

    http://www.comp.nus.edu.sg/~cs3215/tester/JAutoTester.html
    做完后别忘记请客!!!!!!!
      

  3.   

    真玄...
    建议第一步你要做的是,能统计出一个工程下有多少个源文件,每个源文件中多少个类,每个类中有多少个成员函数及数据成员
    第二步:细化统计,如静态函数,构造函数,工具函数...
    第三步:成员数据的访问类型
    第四步:从main函数入手,跟踪执行流程...
      

  4.   

    helpall():
        不好意思,我的E文很次,那个软件有中文的吗?但实在很好,谢谢!    如果能提供一些中文资料,那就更加感激不尽了!!!
      

  5.   

    有些大,应该象jbuilder的编辑页面,能自动差错。
    实在不行,反编译jbuilder了,呵呵,我说的玩的,反不出来,不要找我。
      

  6.   

    JUnit就是你的目标
    有源码哦:)
      

  7.   

    // This file contains the interface operations to the AutoTester.
    // You need to write a class call Wrapper that implements this interface.有一个文件就是上面这样说的,是要我写一个类(call Wrapper 是什么意思?)实现这个接口。有哪位大侠写过这个类吗?能不能贴出来让我参考一下?我Java学了几个月,道行还浅,望各位大侠相助!!
      

  8.   

    哪里可以找到JUnit呢?还有原码?
      

  9.   

    // This file contains the interface operations to the AutoTester.
    // You need to write a class call Wrapper that implements this interface.有一个文件就是上面这样说的,是要我写一个类(call Wrapper 是什么意思?)实现这个接口。有哪位大侠写过这个类吗?能不能贴出来让我参考一下?
     helpall() 帮帮忙吧?谢拉!!!
      

  10.   

    看一下MouseAdapter的说明,MouseAdapter是MouseListener的Wrapper.
      

  11.   

    helpall() :
       我花心思看了那个文件包,知道里面那个InterfaceToTester 接口还没有实现,这个好像是学校的大作业???有没有参考答案呢? helpall() 您能帮我找一下吗?我的Java还没学好,时间不多了谢谢!!!这是那些说明:
    To hook up to the auto-tester, you need to modify Wrapper.java. The Wrapper class implements the interface called InterfaceToTester. The specification of the interface is as follows: 
    // This file contains the interface operations to the AutoTester.
    // You need to write a class call Wrapper that implements this interface.import java.util.Vector;public interface InterfaceToTester {  /**
       * In order to test your SPA program, you need to be given the source
       * file. The AutoTester will use this method to pass you the full
       * pathname of the source file. In your implementation of this method,
       * you should write code that will invoke your SPA to parse the source
       * file.
       * @param filename full pathname of the SIMPLE source file
       * @exception throw any exception that has occurred during parsing
       */
      public void parse(String filename) throws Exception;  /**
       * Once the parsing is completed, the AutoTester will invoke this
       * method once for each query that your SPA program will evaluate.
       * In your implementation of this method, you should write code
       * that will invoke your SPA to evaluate the query.
       *
       * The query will be passed as a single string. For example,
       * "assign a; Select a such that Parent(3, a);". A more complex
       * one would be 
       * "variable v; stmt s1, s2; Select s1 such that Follows(s1, s2)
       *  and Modifies(s1, v);". Note that no matter how long the query
       * will be, it will always be passed as a single string. You can
       * manipulate this string according to your own needs. For example,
       * if your program expects the query to come in two lines (the
       * first is declarations while the second is the actual query),
       * you can do the splitting of the query in this method before
       * passing them to your SPA program.
       *
       * Once your SPA has evaluated the query, you need to pass the 
       * results back in a vector. Each element of the vector indicates 
       * 1 result. Each element has to be a String object. For example,
       * let's say the results is 1, 2, 3. You need to convert these 
       * integers to String and store them in the Vector. Order is not
       * important (so you don't need to sort the results, the AutoTester
       * will handle this). But case is important e.g. if the results is
       * a set of procedure names "First", "Second", make sure you don't
       * change the case. If your evaluation returns a boolean result,
       * ensure it returns "true" or "false" (in lowercase).
       * If your evaluation returns no result, just 
       * return an empty Vector. If the results are tuples e.g. 1 2, 2 3,
       * then you store each tuple result as a single string with the
       * individual element of the tuple separated by a space e.g. the
       * Vector for the preceding tuple results will contain two String
       * Objects. The first is "1 2" and the second is "2 3".
       *
       * @param query the query string
       * @return a Vector containing the results. Each element must be
       *         a String object. Return an empty Vector if the evaluation
       *         returns no results.
       * @exception throw any exception that occurs during evaluation
       */
      public Vector evaluate(String query) throws Exception;
    }Basically, there are two methods you need to implement. The first is method "parse". At the start of the testing process, the auto-tester will invoke the parse method of the Wrapper class, passing it the name of a SIMPLE source file for parsing. You need to write code that will invoke your own parser to parse this file. Upon completion of the parsing, the auto-tester will repeatedly invoke the second method "evaluate". It passes the PQL query as a single string. Your job here is to write the necessary code that will pass the query to your evaluator. After processing the query, the method will return the answers in a Vector. 
    Once you finish implementing the Wrapper class, compile the Wrapper.java file. Before that, you must make sure that your classpath is set to include the AutoTester.jar file. Let's say you put your AutoTester.jar file in C:\CS3214s. Then, set your classpath as follows: 
    set CLASSPATH=whatever_your_current_classpath;C:\CS3214s\AutoTester.jar

    Now, you are ready to run the auto-tester. The auto-tester accepts three arguments. The first is the name of the file containing the SIMPLE source. The second is the name of the file containing the queries. The third is the output file to store the results of the testing. To try out the auto-tester, do the following: 
    java AutoTester trial.txt trialcase.txt output.txt
    Once the testing is completed, you can view the results of the test from output.txt.   On the day of your final presentation, make sure your SPA can communicate with the auto-tester as described above. What we will do is to give you a different set of trial.txt and trialcase.txt and you will run the auto-tester to show us the results of the tests.
      

  12.   

    上面那一大段E文中的“SPA ”是指什么?