Esempio n. 1
0
 public int getTotalNumberOfTests() {
   try {
     return thHandler.getTestHistory((thHandler.getMethodList())[0]).getHighestTestID();
   } catch (MethodNotFoundException shouldnotHappen) {
     // TestHistoryHandler should refuse to load an empty file
     throw new SofyaError("Unable to determine total number of tests");
   }
 }
Esempio n. 2
0
  public SelectionData selectTests(String methodName, Edge[] dangerousEdges)
      throws MethodNotFoundException {
    TestHistory th = thHandler.getTestHistory(methodName);
    int maxTestID = th.getHighestTestID();
    TIntArrayList testList = new TIntArrayList();

    for (int i = 0; i < dangerousEdges.length; i++) {
      // int predBlockID = dangerousEdges[i].getPredNodeID();
      int succBlockID = dangerousEdges[i].getSuccNodeID();

      for (int j = 0; j < maxTestID; j++) {
        if (
        /*th.query(predBlockID, j) &&*/ th.query(succBlockID, j)) {
          testList.add(j + 1);
        }
      }
    }

    SelectionData sd = new SelectionData();
    if (testList.size() > 0) {
      sd.tests = testList.toNativeArray();
    } else {
      sd.tests = new int[0];
    }

    return sd;
  }
Esempio n. 3
0
 /**
  * Standard constructor, initializes the edge mapper with the given test history file.
  *
  * @param histFile Path to the test history file for the program, either absolute or relative to
  *     the current working directory.
  * @throws FileNotFoundException If the specified test history file cannot be found.
  * @throws BadFileFormatException If the test history file is corrupted.
  * @throws IOException For any other IO error which prevents the test history file from being read
  *     successfully.
  */
 public BlockTestMapper(String histFile)
     throws FileNotFoundException, BadFileFormatException, IOException {
   thHandler.readTestHistoryFile(histFile);
 }