public ArrayList getDisabledTests(string location) { ArrayList testList = new ArrayList( ); StreamReader sr = new StreamReader(location); string[] currentLine; DisabledTest disabledTest; // add all the test IDs to the list... while (sr.Peek( ) >= 0) { currentLine = sr.ReadLine( ).Split((new char[] { ' ', '\t' }), 2); disabledTest = new DisabledTest( ); if (currentLine.Length > 0) { disabledTest.testID = currentLine[0]; } if (currentLine.Length > 1) { disabledTest.reason = currentLine[1]; } testList.Add(disabledTest); } // close the file... sr.Close( ); return(testList); }
public ArrayList getDisabledTests( string location ) { ArrayList testList = new ArrayList( ); StreamReader sr = new StreamReader( location ); string[] currentLine; DisabledTest disabledTest; // add all the test IDs to the list... while ( sr.Peek( ) >= 0 ) { currentLine = sr.ReadLine( ).Split( ( new char[] { ' ', '\t' } ), 2 ); disabledTest = new DisabledTest( ); if ( currentLine.Length > 0 ) disabledTest.testID = currentLine[0]; if ( currentLine.Length > 1 ) disabledTest.reason = currentLine[1]; testList.Add( disabledTest ); } // close the file... sr.Close( ); return testList; }
/// <summary> /// Parses command line arguments passed to the test executable. /// </summary> /// <param name="args">The command line arguments string array passed from the entrypoint procedure.</param> /// <remarks> /// Author(s): teejay /// Revision: 1.0 /// Modified: 6/04/2003 /// </remarks> public virtual void parseCommandLineArgs(string[] args) { char[] argumentArray; string testCaseID = "Unprovided"; string dependencyFile = DEFAULT_DEPENDENCY_FILE; try { if (args.Length == 0) { throw new NoTestException( ); } else { // go through all the arguments passed on the commandline... for (int argCount = 0; argCount < args.Length; argCount++) { argumentArray = args[argCount].ToCharArray( ); if (args.Length > 1) { if ((argumentArray[0] == '-') || (argumentArray[0] == '/') && (argCount != 0)) { // switch based on switch (argumentArray[1]) { case 'd': // check to ensure that a dependency exists... if ((argCount + 1) >= args.Length) { throw new NoDependencyFileException( ); } else { // set to use the alternate dependency file specified... dependencyFile = args[argCount + 1]; } break; case 'a': System.Diagnostics.Debugger.Break( ); break; case 'c': Log.Log.color = true; break; case 'l': if ((argCount + 1) >= args.Length) { throw new Exception("No log file name specified with 'l' option."); } else { logFile = args[argCount + 1]; // set to use the log file specified... Log.Log.logWriter = new StreamWriter(logFile); } break; case 'o': if ((argCount + 1) >= args.Length) { throw new Exception("No output path specified with 'o' option."); } else { // set to use the log file specified... OutputPath = args[argCount + 1]; } break; case 's': Log.Log.logSilent = true; break; case 'v': verbose = true; break; case 'x': if ((argCount + 1) >= args.Length) { throw new Exception("No file specified with 'l' option."); } else { // set to use the log file specified... disableTestsLocation = args[argCount + 1]; DisableTests = getDisabledTests(disableTestsLocation); } break; case 'z': // create an arraylist containing all the test specific parameters... for (int count = argCount + 1; count < args.Length; count++) { testSpecificParameters.Add(args[count]); } break; } } } } } if (verbose) { Log.Log.printTestStatus("<< Test Framework V. 1.0 Running >>\n"); } if (verbose) { if (dependencyFile != DEFAULT_DEPENDENCY_FILE) { Log.Log.printSuccess("Using Alternate Dependency", dependencyFile); } } // set the test case ID... testCaseID = args[0]; performPreRunTasks( ); DisabledTest currentDisabledTest = null; foreach (DisabledTest disabledTest in DisableTests) { if (disabledTest.testID == testCaseID) { currentDisabledTest = disabledTest; } } if (currentDisabledTest == null) { // perform the test run... performRun(testCaseID, dependencyFile); // perform post run tasks... performPostRunTasks( ); } else { Log.Log.printSuccess("TEST DISABLED", "The test [" + testCaseID + "] has been disabled using a disable file.\n" + "REASON: [" + currentDisabledTest.reason + "]"); } } catch (NoTestException e) { TestExceptions.printException(e); printCommandLineHelp( ); // rethrow the exception to be caught again... throw e; } catch (TestExceptions e) { // rethrow the exception to be caught again... throw e; } }