[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-wget] [GSoC PATCH 09/11] update README

From: Zihang Chen
Subject: [Bug-wget] [GSoC PATCH 09/11] update README
Date: Fri, 14 Mar 2014 21:18:25 +0800

diff --git a/testenv/ChangeLog b/testenv/ChangeLog
index 8d92fb6..dc6dbb0 100644
--- a/testenv/ChangeLog
+++ b/testenv/ChangeLog
@@ -1,3 +1,5 @@
+2014-03-14  Zihang Chen  <address@hidden>
+       * README: Amend README according to previous commits.
 2014-03-13  Zihang Chen  <address@hidden>
        * base_test.py:
        (CommonMethods): Rename to BaseTest.
diff --git a/testenv/README b/testenv/README
index 6b15d70..56df646 100644
--- a/testenv/README
+++ b/testenv/README
@@ -10,25 +10,30 @@ Run the './configure' command to generate the Makefile and 
then run 'make check'
 to execute the Test Suite. Use the '-j n' option with 'make check' to execute
 n tests simultaneously.
-File List:
-    * HTTPServer.py: This file contains a custom, programmatically configurable
-    HTTP Server for testing Wget. It runs an instance of Python's http.server
-    module.
+    * server: This package contains custom programmatically configurable 
+    (both HTTP and FTP) for testing Wget. The HTTP server runs an instance of
+    Python's http.server module. The FTP server is to be implemented.
-    * WgetTest.py: This file contains various functions and global variables 
-    each instance of the server that is initiated. It includes functions to
-    start and stop the server, to initialze the test environment and to cleanup
-    after a test.
+    * test: This package contains the test case classes for HTTP and FTP. The
+    test case classes includes methods for initializing and cleaning up of the
+    test environment.
+    * exc: This package contains custom exception classes used in this test
+    suite.
+    * conf: This package contains the configuration classes for servers to be
+    configured with.
+    * misc: This package contains several functions, classes and constants used
+    in this test suite.
     * Test-Proto.py: This is a prototype Test Case file. The file defines all
     the acceptable elements and their uses. Typically, one must copy this file
     and edit it for writing Test Cases.
-    * ColourTerm.py: A custom library for printing coloured output to the
-    terminal. Currently it only supports 4 colours in a *nix environment.
@@ -93,8 +98,7 @@ effort to get accustomed to.
 All Test Files MUST begin with the following Three Lines:
 from sys import exit
-from WgetTest import {HTTPTest|FTPTest}
-from misc.wget_file import WgetFile
+from WgetTest import {HTTPTest|FTPTest}, WgetFile
 It is recommended that a small description of the Test Case is provided next.
 This would be very helpful to future contributors.
@@ -102,7 +106,7 @@ Next, is the const variable, TEST_NAME that defines the 
name of the Test.
 Each File in the Test must be represented as a WgetFile object. The WgetFile
 Class has the following prototype:
-WgetFile (String name, String contents, String timestamp, dict rules)
+WgetFile (str name, str contents, str timestamp, dict rules)
 None except name is a mandatory paramter, one may pass only those parameters
 that are required by the File object.
@@ -139,10 +143,11 @@ Both, the HTTPTest and FTPTest modules have the same 
-    servers
+    protocols
-name expects the string name, and is usually passed the TEST_NAME variable,
-the three hooks, expect python dictionary objects and servers is an integer.
+name should be a string, and is usually passed to the TEST_NAME variable,
+the three hooks should be Python dict objects and protocols should be a list of
+protocols, like [HTTP, HTTPS].
 Valid File Rules:
@@ -192,6 +197,7 @@ executed. The currently supported options are:
     * Urls          : A list of the filenames that Wget must attempt to
     download. The complete URL will be created and passed to Wget 
+    (alias URLs)
     * WgetCommands  : A string consisting of the various commandline switches
     sent to Wget upon invokation. Any data placed between {{ }} in this string
     will be replaced with the contents of self.<data> before being passed to
@@ -208,7 +214,7 @@ hooks are usually used to run checks on the data, files 
downloaded, return code,
 etc. The following hooks are currently supported:
     * ExpectedRetcode : This is an integer value of the ReturnCode with which
-    Wget is expected to exit.
+    Wget is expected to exit. (alias: ExpectedRetCode)
     * ExpectedFiles   : This is a list of WgetFile objects of the files that
     must exist locally on disk in the Test directory.
     * FilesCrawled    : This requires a list of the Requests that the server is
@@ -224,11 +230,24 @@ recommended method for writing new Test Case files is to 
copy Test-Proto.py and
 modify it to ones needs.
 In case you require any functionality that is not currently defined in List of
-Rules defined above, you should add the required code in WgetTest.py.
-In most cases, one requires a new Rule to be added for the Server to follow.
-In such a case, create a new Class in WgetTest.py with the same name as the 
-and define an __init__ () function to handle the data. A method must also be
-defined in HTTPTest / FTPTest modules to handle the said Rule.
+Rules defined above, you should implement a new class in the conf package. The
+file name doesn't matters (though it's better to give it an appropriate name).
+The new rule class should be like this:
+from conf import register
+class MyNewRule:
+    def __init__(self, rule_arg):
+        self.rule_arg = rule_arg
+        # your rule initialization code goes here
+Additionally, A method with the exact name of the newly created rule class must
+ also be defined in HTTPTest / FTPTest modules to handle the said Rule.
 Once a new Test File is created, it must be added to the TESTS variable in
 Makefile.am. This way the Test will be executed on running a 'make check'.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]