I. Scope of Testing


The HILK advance calculator is a software application for mathematical calculation designed for the Windows 95 and NT operating system. It performs basis arithmetic operating. To guarantee whole program work properly and correctly, We will do lots testing work. We test the User interface Module, Data Process Module, Output result module and Define variable module by using top down integration strategy.

The user interface is an Input/Output screen, implemented by using MFC. It is a component of Fle,Edit, Tools and help. At this stage, we test the menu bar by testing all relevant pull-down menus, toolbars, scroll bar, dialog boxes, buttons and icons. For the Data Process module, ;we test addition, subtraction, division and multiplication functions, also test the order of precedence and parentheses in the expression. The Output result Module ;displays the result of input data on the next line to the user on the Input/Output screen. We check the test results by using data manipulation and analysis. However for our testing, we divide it into following parts.


II. Test Plan

Since the HILK project had been implemented using top-down integration, the top-down testing approach is more appropriate and will be used for the project testing.

Following the top-down integration procedure, the initial implementation of the HILK is handled by Microsoft Visual C++ 's wizard, and is used as the central or main part of the implementation. The HILK is a very interactive application, and majority of the application task is to wait for events or read commands from the user and carried them out properly and correctly. For this purpose, the menu bar then is modified to handle these events and commands. Then the component to handle each command is created, and integrated to the main part by being plugged into the corresponding menu option. Meanwhile, other functions such as "process" was also implemented separately. After the completion and unit testing, each function then will be integrated to the main program. The implementation is complete when all functions have been implemented and integrated.

A. Test phases and builds

Our testing is divided into phases as following.

B. Schedule

The project has been given 7 days for testing. The testing schedule is as the following.

Day 1 Test the Control module by using function stubs to verify that all the messages from menus, toolbars and key shortcuts are dispatched to the appropriate modules.
Day 2 Test data input phase to verify that all characters displayed in the expression will be passed to the Process function correctly.
Day 3 Integrate Configuration module and test to verify that the precision setting works correctly
Test the output module to verify that the result will be displayed correctly and in the right format.
Day 4 Integrate Exporting Data and Importing External Data Module and test to verify that correct data will be read and written.
Day 5 Integrate the Define Variable module and test to verify that the list of defined variables is maintained properly and the module works correctly.
Day 6 Unit test the Process module to modify that the function returns the correct value.
Integrate the Process module and verify the data exchange between the Process module and the Control module is being handled correctly.
Also test the data exchange between the Process module and the Define Variable module to verify that the function recognizes the defined variables and their values.
Day 7 Perform the over all testing to verify that the HILK is ready for release.

Each day, when an error occurs, the debugging will be performed in the same day.

C. Overhead software

The top-down approach has chosen for this testing project. By following the series, the main Control module will be used as a test driver. Therefore, the overhead software will be the modified existing module. The details will be discussed further in Part III under overhead software description section. Overall, no major software or coding is needed for the testing.

D. Environment and resources

The HILK is developed under the Windows95 environment, with Microsoft Visual C++ being used as a developing tool. However, the HILK is intended to operate under both Windows 95 and NT operating systems. To insure that the application is operable in both platforms, testing must also be performed under Windows NT as well as under Windows 95.

There is no major communication between the application itself and the external drivers such as modem or speakerphone. Therefore, unusual hardware configurations are not needed. The external data is imported into the application through only file reading or serialization. However, while we responsible for reading or writing the correct data, the operating system will handle reading and writing data correctly.


III. Test Procedures

A. Order of integration

The main control module for the HILK calculator is the User Interface/Control module that is used as a test driver for the other parts of the program, subordinate modules. At this stage calls to functions of Configuration, Data Processing, Define Variable, Output Results and Initialization modules are replaced with stubs. For example, the call to configuration function is replaced with the following standard Windows message box.

AfxMessageBox("Module Configuration, function Configure Entered");

1. Purpose

The purpose of testing the User Interface/Control module is to verify that all the messages from menus, toolbars and key shortcuts are dispatched to the appropriate modules and that all the GUI elements function properly. Because the considerable part of the User Interface/Control module is built from reusable MFC library components, the testing will not concentrate on the reusable components: windows, drop-down menus, dialog box controls and so on.

2. Modules to be tested

At this phase of testing the User Interface/Control module and its components: expression reading and processing, file reading and writing, are tested.

B. Unit Tests

1. Description of test for the User Interface/Control module

Common White-Box testing techniques are applied to test this component of the program. The Input/Output window and expression reading are tested by supplying test input to the program and pushing evaluate button. Data flow testing includes the steps listed below.

The evaluate button has the same effect as pressing the Enter key or equal sign on the Arithmetics toolbar. The number of characters in the test input varies from 0 ( null input ) to more than 256 ( over the limit of the input buffer ), so that the module is tested with input of different length. The next step is giving the module input consisting of numbers only, characters only or a random mix of the both numbers and characters.

Correctness of the file input and output is verified by a number of tests, which include writing information from the Input/Output window to a file or reading data from a file. Different cases are considered:

  • The file is empty.
  • The file is larger than 4KB.
  • The buffer is empty.
  • The buffer is full.

    The test will not cover choosing a non-existing file or writing to a protected device since these cases are handled by the MFC components. Special attention is paid to serialization function that handles the file I/O. The prototype implements the function in the following way, though the actual program will require far more complicated structure.

    void CHILKDoc::Serialize(CArchive& ar)

    {


    if (ar.IsStoring())
    { ar<< m_text; // m_text is the actual buffer }
    else
    { ar<<m_text;}

    }

    Control flow testing requires choosing each menu item and toolbar element at least once in order to verify that the appropriate command handler is invoked. File ,Edit, Tools menu items, the Arithmetics and standard toolbars are tested. Since menus File and Edit are provided by reusable MFC library components, the most of the testing is concentrated on the Tools menu items: Format Precision, Set number of decimal places, Display toolbars, Define Variable.

    2. Overhead software description

    Testing of the User Interface/Control module requires substitution of the function calls from Configuration, Data Processing, Define Variable, Output Results and Initialization modules with stubs. For example, the call to the Data Processing module’s Process_Data function is replaced with the following code that does not perform any calculations, but display the sequence of characters to be evaluated and returns a constant instead of a result:

    float CHILKDoc::Process_Data(m_buffer)

    {

    AfxMessageBox(m_buffer);

    return 1.23;

    }

    The other calls do not return any value to the Interface/Control module and are replaced with simpler stubs creating a window with a name of the module and the function that is called:

    AfxMessageBox("Module ..., function ... Entered");

    3. Expected Results

    The Input/Output window has to reflect all the entered numbers and characters, that are input both from the keyboard or through the Arithmetics toolbar. The characters are to appear in the window on one line until the evaluate button (or its equivalents) is pressed. Null input should prevent the program from calling Process_Data function, otherwise the module calls the Process_Data stub that returns 1.23 constant. This return value is displayed on the line following the input and is preceded with

    When a file is open its content is displayed in the Input/Output window. If the file size is more than 4KB, a message saying that the limit is exceeded has to be displayed. If the chosen file contains no data the file becomes the current but nothing is displayed in the Input/Output window. If there was any data left from the previous calculations, it is cleared.

    Calls to functions from Configuration, Data Processing, Define Variable, Output Results and Initialization modules produce output describing what function has been called without performing any other operations. The MFC library components are expected to behave in the way common to other Windows applications.

    C. Test Environment

    1. Special tools and techniques

    The special technique used in the testing of the User Interface/Control module is insertion of a number of system message boxes displaying contents of variables and parameters. The technique provides greater visibility of the module. The test execution of the module is performed in the debug mode so that all TRACE statements are also become visible in the debug window.

    2. Overhead Software Description

    Microsoft Developer Studio 5.0 provides capabilities for testing and debugging the module. The debugger allows executing the program step by step or running the whole program with TRACE messages enabled.

    D. Test Case Data

    Provide the program with null input: clear Input/Output window and press evaluate button, or Enter key.

    Enter the following sequence of numbers and call the process data function: 1223345

    Enter a mix of characters and numbers: 12w346y90043 343)

    Input exactly 256 characters to test for the full buffer.

    Type any 257 characters in the Input/Output window to test for the exceeded length.

    Clear screen and save the file with empty.HLK name, open the file again.

    Open a file whose size is larger than 4KB.

    E. Expected Results for the Interface/Control module build

    A null buffer in the module does not allow to call Process_Data function, that is why nothing happens if the evaluate button is pressed.

    1223345 input will cause appearance of message window displaying this sequence of numbers. The program will also display ->1.23 on the next line in the Input/Output window.

    The mix of characters 12w346y90043 343) should produce the similar result as the above test but the message window displays this particular sequence.

    A sequence of exactly 256 characters will be displayed in the message window; the 1.23 result will be generated by Process_Data stub and displayed.

    The sequence whose length is 257 characters will cause the module to display an error message; the stub of the Process_Data function will not be invoked.

    A null buffer produces an empty file and if the empty file is open the buffer is empty too. This state is reflected in the blank Input/Output window.

    Define Variable Module

    A. Order of integration

    After the Interface/Control module was tested it can be used as a test driver for the subordinate modules. At this stage the Define Variable module is integrated into the program and tested. Function calls to the Configuration, Data Processing, Output Results and Initialization modules are still replaced with stubs generating message boxes. Since the tested module does not call functions from the other modules, there is no need in replacing function calls from this component with stubs.

    1. Purpose

    Testing of this module has to uncover any errors in handling user-defined variables. Correctness of reading data containing the variables from a file, updating, retrieving and saving into a file is verified. The tests affect the module’s user interface consisting of a dialog box.

    2. Modules to be tested

    At this phase of testing the Define Variable module and its components: display variables, edit variables are tested. In spite of the fact that the User Interface/Control has been previously tested, the module will also undergo some testing because it will serve as a test driver.

    B. Unit Tests for Module Define Variable

    1. Description of test

    Knowlege of the module’s internal structure allows application of white-box testing techniques. A user-defined variable is stored in a struct, which has two members. One member is a string containing the variable name, the other struct member whose type is float is the value of the variable. The structs representing variables are linked into a linked list.

    User defined variables are stored in udv.dat file in a way similar to the configuration information. Variable names are separated from their values represented by float numbers by a space. Proper construction of the linked list when the file udv.dat is open and read is tested. Sample data is written manually into the ASCII text file and the program is run. In this test overhead software is used to display contents of the list.

    Similar procedure is followed to insure correctness of saving the user-defined variables into a file on the program termination. Contents of the file can be opened and checked in a text editor.

    The next step is testing of the dialog box used to view and edit user-defined variables. Tests for correct construction of the drop-down list are conducted, as well as for proper function of OK, Cancel and Remove buttons.

    2. Overhead Software

    The overhead software consists of a function displaying the contents of the linked list of structs containing user-defined variables. This function, which is called Look_Up, is a member of the Define Variable module though it is used only during testing of the module. The function generates a message box displaying contents of the linked list. Other overhead software is a set of statements displaying state of the module.

    AfxMessageBox("Module ..., function ... Entered")

    3. Expected Results

    The User Interface/Control module serves as a test driver for testing of the Define Variable module. The former calls a member function of the latter to load the user-defined variables from the file called udv.dat when the program is started. Contents of the file should be reflected in the contents of the constructed linked list, the data member of the Define Variable module. When the program is normally terminated the data is written back to the text file. If function Look_Up is called during the program execution it has to display the exact contents of the file if there were no changes made to the list of the variables.

    Though the MFC library provides GUI components such as dialog boxes, correctness of the drop-down list containing variable names has to be tested. If there were no changes made to the list from the start of the program, the drop-down list has to display the same data as the one in the udv.dat file or the one displayed by the Look_Up function.

    C. Test Environment

    1. Special tools and techniques

    Test environment for the Define Variable module is the same as for the User Interface/Control module. The similar system of message boxes is used to increase visibility of the internal structure. Also debug mode of execution of the program allows to display TRACE statements in the Debug window of Microsoft Developer Studio.

    2. Overhead Software Description

    The overhead software used to test the module is primarily MS VC++ debugger. The test run of the driver with the Define Variable module is performed in the debug mode.

    D. Test Case Data

    Using a text editor modify udv.dat file so that it contains the following data:

    CALTAX 0.0725
    POUND 0.454
    FOOT 0.33
    METER 3.0

    Run the test driver, the Interface/Control module, and call the Look_Up function from the Define Variable module.

    Without modifying the list of variables exit the program to allow the module to store the contents of the linked list into the udv.dat file.

    Open the file with the above data and choose the Define Variable option from the menu to activate the dialog box, that displays and edits the variables.

    Enter NEWVAR into the text box and assign value 4.5 to it. Click OK to save changes and exit the dialog box. In order to verify correctness of the operation function Look_Up is called; also the dialog box can be open again to test if the changes were stored in the linked list.

    Remove all the variables from the list and save changes, call Look_Up function to display contents of the list. Exit from the program to allow the changes to be saved into the UDV.DAT file.

    E. Expected Results

    After the program has been started, call to Look_Up displays the exact 4 lines from the file:

    CALTAX0.0725
    POUND 0.454
    FOOT0.33
    METER3.0

    The program is terminated and no changes were made to the variables, the UDV.DAT file will contain the same data as it did before the start of the program.

    Opening the dialog box will result in construction of the drop-down list containing all the four names. If a particular name is chosen the corresponding value is displayed in the text box.

    Addition of the new variable will allocate space in the list and calls of the Look_Up function will show that the NEWVAR and 4.5 are inserted in the linked list. The data file will contain the following 5 lines then:

    CALTAX0.0725
    POUND 0.454
    FOOT3.0

    Deletion of all variables will empty the drop-down list and Look_Up will not display anything. Also the file UDV.DAT will be empty after the program termination.

    Data Process module

    A. Order of integration

    For the Data Processing module, the original coding was done under the HP UNIX system, and later integrated into the Visual C++ environment. Therefore, before putting things together, we need to test the Data Process module separately first. After verifying the Data Process module, we are able to assemble all the parts of the program together and test the other parts such as the main control module.

    1. Purpose.

    The purpose of testing the Data Process module is to verify that the by passing a given data string, the module will produce an appropriate or correct answer. The test needs to make sure that all functions that designed to take by the module will be carried out correctly.

    2. Modules to be tested

    At this phase of testing the Data Process module and its components, such as all the operations.

    B. Unit tests for modules in build

    1. Description of test for the Data Process module

    The Data Process module is designed to accept add, subtract, multiply, divide, power, and multiple parentheses.

    When the module accepted a data string, the data string will be translated into a new data structure which consists a link list. Each element of the link list stores either a number or an operator. For example, if the data string is 3+4, it will be translated into a link list as follows: 3->+->4. Therefore, the first step of testing the Data Process module is to pass over a data string, and make sure the correct translation will be made.

    After the translation of the data string, the Data Process module will follow the order of the operation and perform the operations from highest order which is parentheses and down to the lowest order which is add and subtract. While testing them, we follow the opposite direction, from the lowest operation which is add and subtract to the highest operation which is the parentheses.

    First we pass over a simple data string with only one addition or one subtraction, then we pass over a data string with several addition and subtraction mixed. Until we have the correct answer for all the data string, we finish testing the addition and subtraction.

    Second we pass over a simple data string with only one multiplication or one division, then we pass over a data string with several multiplication and division mixed, at last we pass over a data string with multiplication, division, addition, and subtraction all together. Until we have the correct answer for all data strings, we finish testing the multiplication and division.

    Thirdly, we pass over a data string with powers, then we pass over a data string with powers and other four tested operation all together. Until we have all the correct answer for the data strings, we finish testing the power operation.

    Finally, we pass over a data string with one single pair of parentheses that includes some of the five operations tested earlier, then we pass over two or more pair of parentheses that are nested with some of the five operations tested earlier. After that, we pass over two or more pair of parentheses that are not nested with some of the five operations tested earlier. At last, we pass over several pairs of parentheses that some are nested and some are not with some of the five operations tested earlier. Until we have the correct answer for all the date strings, we finish testing the parentheses operation.

    After finishing testing all the operations, the testing part for the Data Process module is done.

    2. Overhead software description

    On the HP UNIX, we designed a simple test drive that passes a data string to the Data process module and output the answer.

    The test drive follows:

    #include <iostream.h>
    #include "hilkdoc.h"
    int main (void)
    {
    CHILKDoc d;
    d.convert("((9-0*8^6)-8");
    cerr<<'\n'<<d.process_data()<<'\n';
    return 0;
    }

    The "hilkdoc.h" contains the Data Process module. The "CHILKDoc" is the Data Process module class. The "convert" function converted the given string which passed over to that function into a link list data structure. The "process_data" function calls the operators to evaluate the link list and give an answer.

    The string put after the "convert" is the test date string which could be replaced by appropriate test string at different testing phases.

    3. Expected Results

    The expected result is a correct answer that printed on the screen which is derived from the data string passed over to the Data Process module.

    C. Test Environment

    1. Special tools and techniques

    Between lines of code in the program, there will be "cerr" or "cout" statements that act like "TRACE" statement in the Visual C++ that gives the values of certain variables.

    2. Overhead Software Description

    It is done with the HP UNIX C++ compiler.

    D. Test Case Data

    1. 2.34 + 34.133
    2. 213 - 34.1
    3. 213 - 92.1 + 12.3 - 32.1234 -21
    4. 21.23 * 54.2
    5. 12.433 / 5.123
    6. 43.123 / 213.2 * 12123.44 * 21.1 / 65.2
    7. 123 / 234.2 + 12.24 * 12 / 435.3 - 175.23
    8. 3.23 ^ 3.1
    9. 7.53 * 34.21 ^ 2 - 45.24 ^ 5 / 7.54 + 23
    10. (32.34 + 12)
    11. 23 * 321 / (321.1 - 765.3)
    12. 65.123 * (12.46 + 21 * (896.432 - 99.32) / 542.76 + 2)
    13. 21.45 * ( 654.3 - 35.78) + (64.98 + 764.87) / 875
    14. 594 * ( 354.43 + 213 / ( 454.2 - 211.98) +(112.2 - 89.33) * 12.145) - (12.57 + 32.4657) *21.7

    E. Expected Results for the Interface/Control module build

    From 1 the answer should be: 36.4730

    From 2 the answer should be: 178.9

    From 3 the answer should be: 80.0766

    From 4 the answer should be: 1150.6660

    From 5 the answer should be: 2.426898

    From 6 the answer should be: 793.565

    From 7 the answer should be: -174.36738

    From 8 the answer should be: 37.89

    From 9 the answer should be: -25124008.45

    From 10the answer should be: 44.34

    From 11 the answer should be: -16.62089149

    From 12 the answer should be: 2950.147922

    From 13 the answer should be: 13268.2024

    From 14 the answer should be: 375063.6417

    IV. Actual Test Results

    When the user opens the HILK software, the File, Edit, Tools and Help are displayed on the top of the HILK window to wait for the user next action. To be sure each item on the menu bar working correctly, we tested the scroll bars by moving the cursor through the mouse. They worked correctly. We pull-down the File, the new, open, clear, save, save as, print, print preview, print setup, exit were displayed. We clicked the new, a clearInput/Output window displayed, then we input (5-7)/2+3*2. We got 4,then we clicked save as, and a dialog box came out. We saved the input expression and its result in a file. To test Print ,we clicked Print and send the file to the printer. We printed out the file on paper. We checked each item on the File. All of them worked correctly. The actual testing results matched the expected results.

    The Tools are a component of the Toolbars, Format Precision, Define variable and Edit Matrix.The Toolbars have standard, Arithmetic and Trigonometry items. When we clicked the Tools, then clicked the Toolbars and chose Arithmetic. We entered expressions either from the keyboard or clicked numbers, parentheses, operations and equal sign on the bottom of the HILK window. Those buttons worked correctly. The actual interface testing results and our expected results matched.

    img1
    The HILK software window

    To test arithmetical order of precedence:

    In the calculation process, the multiplication and division have higher order of precedence than addition and subtraction. When we entered 3-4*5+8/2 .We got -13 instead of 2. The actual result -13 matched our expected result.

    To test the parentheses and order of precedence in expressions:

    The parentheses have highest order of precedence in the calculation procedure. When we entered (3-4)*5+8/2, the result -1 was displayed on the next line. The actual testing result matched our expected result.

    To test more than two parentheses in expression:

    When we entered ((3-4)*5+1)+2*(8-10)/9-10, then clicked the equal sign. The result -14 was displayed on the next line. The actual result and our expected result matched.

    To test the Format Precision Toolbar:

    When we clicked the Format Precision toolbar, the Format precision dalog box popped-out. First we chose decimal precision position at 0, then input an expression (100-8)/3-5*23+90, we got 6. We reset the Format Precision, and chose decimal precision position at 4. We reentered (100-8)/3-5*23+90. We got 5.6667.The actual testing result 6 and 5.6667 met our expected results.

    img2

    Actual testing results

    To test only input one operand, and check the result:

    When we input 12345, then hit the Enter key. We got actual result 12345. This means that a single operand is equal to itself. This matched our expected result.

    To test a sequence mix of characters:

    When we entered 12r34q345y, we got 12. The actual result 12 did not match our expected result. The expected result is an error message window displayed to the user.

    Actual testing results

    To test a full buffer and exceeded buffer length:

    When we input a sequence of 256 characters or more than 256 characters, we expected a message window displayed. For example, we input numbers from 0-9, repeated them until 256 characters or more than 256 characters. We got an error message "This program has performed illegal operation and will be shut down. If the problem persist, contact the program vender." The actual result matched our expected result.

    To test different cases in part III (Data Process module):

    The actual results of case 1-4 matched the expected results. See following picture.

    img4

    The actual results from case 5-8 matched the expected results

    The actual result of case 9 did not matched the expected result. The actual result was

    -25124012.00, but the expected result was -25124008.45.

    The actual results from case 10-12 matched the expected results.

    The actual result of case 13 did not match the expected result. The actual result was an error message, but the expected result was 13268.2024.

    The actual result of case 14 did not match the expected result. The actual result was 0.0000, but the expected result was 375063.6417.

    The Edit, Define Variable toolbar, Help, Edit Matrix, Trigonometry are not finished yet. We will completely them in the future. So here we did not test them actually.


    V. References

    Roger S. Pressman, Ph.D. Software Engineering, 1997

    VI. Appendices

    There is no appendix.

    Back