Software engineering, Autumn 2002, Exercise 8

 
  1. Consider the class TableNameParser. Its task is to find out what tables are used in an SQL-query. It need not work correctly if the query has syntax errors. Draw flow graphs for the methods of this class.

  2. Determine the McGabe complexities for the methods of TableNameParser.

  3. The syntax for SQL-queries is
     
      SELECT <result_items>
      FROM <tables>
      [WHERE <conditions>]
      [GROUP BY <grouping> [HAVING <group_conditions>]]
      [ {UNION | INTERSECT | MINUS } <sql_query> ]
      [ORDER BY <sorting_criteria>]
    
      <tables>= <table_expression> | <table_expression>, <tables>;
      <table_expresssion>= {<table_name> | (<sub_query>)} [[AS] <alias>]
      <sub_query>= sql_query without ORDER BY -part.
      Both <conditions> and <group_conditions> may contain sub_query. 
    
    Define a branch covering test material for the method getTableNames.

  4. What categories would you define for testing getTableNames using the black box technique.
    • T.J.Ostrand, M.J.Balcer: The Category-Partition Method for Specifying and Generating Functional Tests, CACM, 31, 6, 1988, pp 676-686

  5. Carry out a code review for TableNameParser. Is it correct or not? Why?

  6. How would you implement the test environment for class TableNameParser?


Harri Laine, 30.10.2002