Proposing SQL Statement Coverage Metrics: Difference between revisions

Line 350: Line 350:


Using this technique, we can monitor the call status of each execute statement found within the iTrust production code. When the test suite is done executing, the table in our research database will contain n unique records which correspond to each method call in the iTrust production code. Each record will contain a boolean flag indicating whether the statement was called during test suite execution. The line with the comment instrumentation shows how this method is implemented in the example code in Figure 8.
Using this technique, we can monitor the call status of each execute statement found within the iTrust production code. When the test suite is done executing, the table in our research database will contain n unique records which correspond to each method call in the iTrust production code. Each record will contain a boolean flag indicating whether the statement was called during test suite execution. The line with the comment instrumentation shows how this method is implemented in the example code in Figure 8.
  java.sql.Connection conn =
  factory.getConnection();
  java.sql.PreparedStatement ps =
  conn.prepareStatement("UPDATE
  globalVariables set SET VALUE = ? WHERE
  Name = ‘Timeout’;");
  ps.setInt(1, mins);
  SQLMarker.mark(1, 1); //instrumentation
  java.sql.ResultSet rs = ps.executeQuery();
<center>'''Figure 8. Code Instrumentation'''</center>


<code>SQLMarker.mark</code> is always placed immediately before the call to the execute SQL query (or target statement) so the method's execution will be recorded even if the statement throws an exception during its execution. There are issues in making the determination of the number of SQL statements actually possible in the production code; these will be addressed in Section 7.
<code>SQLMarker.mark</code> is always placed immediately before the call to the execute SQL query (or target statement) so the method's execution will be recorded even if the statement throws an exception during its execution. There are issues in making the determination of the number of SQL statements actually possible in the production code; these will be addressed in Section 7.