Beispiel #1
0
        private void ExecuteTest(NUnitTest test)
        {
            // Set Defaults
            RunnerResult result = RunnerResult.Success;

            if (test.ToDir == null) {
                test.ToDir = Project.BaseDirectory;
            }
            if (test.OutFile == null) {
                test.OutFile = "TEST-" + test.Class;
            }

            NUnitTestData testData = test.GetTestData();

            foreach (FormatterElement element in FormatterElements) {
                testData.Formatters.Add(element.Data);
            }

            if (testData.Fork == true) {
                result = ExecuteInAppDomain(testData);
            } else {
                result = ExecuteInProc(testData);
            }

            // Handle return code:
            // If there is an error/failure and that it should halt, stop
            // everything otherwise just log a statement.
            bool errorOccurred   = (result == RunnerResult.Errors);
            bool failureOccurred = (result != RunnerResult.Success);

            if ((errorOccurred && test.HaltOnError) || (failureOccurred && test.HaltOnFailure)) {
                // Only thrown if this test should halt as soon as the first
                // error/failure is detected.  In most cases all tests will
                // be run to get a full list of problems.
                throw new BuildException("Test " + testData.Class + " Failed" , Location);
            }

            // Used for reporting the final result from the task.
            if (errorOccurred) {
                _errorsPresent = true;
            }
            if (failureOccurred) {
                _failuresPresent = true;
            }
        }
Beispiel #2
0
 /// <summary>
 /// Adds a <see cref="NUnitTest"/> to the end of the collection.
 /// </summary>
 /// <param name="item">The <see cref="NUnitTest"/> to be added to the end of the collection.</param> 
 /// <returns>The position into which the new element was inserted.</returns>
 public int Add(NUnitTest item) {
     return base.List.Add(item);
 }
Beispiel #3
0
 /// <summary>
 /// Adds the elements of a <see cref="NUnitTest"/> array to the end of the collection.
 /// </summary>
 /// <param name="items">The array of <see cref="NUnitTest"/> elements to be added to the end of the collection.</param> 
 public void AddRange(NUnitTest[] items) {
     for (int i = 0; (i < items.Length); i = (i + 1)) {
         Add(items[i]);
     }
 }
Beispiel #4
0
 /// <summary>
 /// Removes a member from the collection.
 /// </summary>
 /// <param name="item">The <see cref="NUnitTest"/> to remove from the collection.</param>
 public void Remove(NUnitTest item) {
     base.List.Remove(item);
 }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NUnitTestCollection"/> class
 /// with the specified array of <see cref="NUnitTest"/> instances.
 /// </summary>
 public NUnitTestCollection(NUnitTest[] value) {
     AddRange(value);
 }
Beispiel #6
0
 /// <summary>
 /// Retrieves the index of a specified <see cref="NUnitTest"/> object in the collection.
 /// </summary>
 /// <param name="item">The <see cref="NUnitTest"/> object for which the index is returned.</param> 
 /// <returns>
 /// The index of the specified <see cref="NUnitTest"/>. If the <see cref="NUnitTest"/> is not currently a member of the collection, it returns -1.
 /// </returns>
 public int IndexOf(NUnitTest item) {
     return base.List.IndexOf(item);
 }
Beispiel #7
0
 /// <summary>
 /// Inserts a <see cref="NUnitTest"/> into the collection at the specified index.
 /// </summary>
 /// <param name="index">The zero-based index at which <paramref name="item"/> should be inserted.</param>
 /// <param name="item">The <see cref="NUnitTest"/> to insert.</param>
 public void Insert(int index, NUnitTest item) {
     base.List.Insert(index, item);
 }
Beispiel #8
0
 /// <summary>
 /// Determines whether a <see cref="NUnitTest"/> is in the collection.
 /// </summary>
 /// <param name="item">The <see cref="NUnitTest"/> to locate in the collection.</param> 
 /// <returns>
 /// <see langword="true" /> if <paramref name="item"/> is found in the 
 /// collection; otherwise, <see langword="false" />.
 /// </returns>
 public bool Contains(NUnitTest item) {
     return base.List.Contains(item);
 }
Beispiel #9
0
 /// <summary>
 /// Copies the entire collection to a compatible one-dimensional array, starting at the specified index of the target array.        
 /// </summary>
 /// <param name="array">The one-dimensional array that is the destination of the elements copied from the collection. The array must have zero-based indexing.</param> 
 /// <param name="index">The zero-based index in <paramref name="array"/> at which copying begins.</param>
 public void CopyTo(NUnitTest[] array, int index) {
     base.List.CopyTo(array, index);
 }
Beispiel #10
0
 /// <summary>
 /// Adds a <see cref="NUnitTest"/> to the end of the collection.
 /// </summary>
 /// <param name="item">The <see cref="NUnitTest"/> to be added to the end of the collection.</param>
 /// <returns>The position into which the new element was inserted.</returns>
 public int Add(NUnitTest item)
 {
     return(base.List.Add(item));
 }
Beispiel #11
0
 /// <summary>
 /// Removes a member from the collection.
 /// </summary>
 /// <param name="item">The <see cref="NUnitTest"/> to remove from the collection.</param>
 public void Remove(NUnitTest item)
 {
     base.List.Remove(item);
 }
Beispiel #12
0
 /// <summary>
 /// Inserts a <see cref="NUnitTest"/> into the collection at the specified index.
 /// </summary>
 /// <param name="index">The zero-based index at which <paramref name="item"/> should be inserted.</param>
 /// <param name="item">The <see cref="NUnitTest"/> to insert.</param>
 public void Insert(int index, NUnitTest item)
 {
     base.List.Insert(index, item);
 }
Beispiel #13
0
 /// <summary>
 /// Retrieves the index of a specified <see cref="NUnitTest"/> object in the collection.
 /// </summary>
 /// <param name="item">The <see cref="NUnitTest"/> object for which the index is returned.</param>
 /// <returns>
 /// The index of the specified <see cref="NUnitTest"/>. If the <see cref="NUnitTest"/> is not currently a member of the collection, it returns -1.
 /// </returns>
 public int IndexOf(NUnitTest item)
 {
     return(base.List.IndexOf(item));
 }
Beispiel #14
0
 /// <summary>
 /// Determines whether a <see cref="NUnitTest"/> is in the collection.
 /// </summary>
 /// <param name="item">The <see cref="NUnitTest"/> to locate in the collection.</param>
 /// <returns>
 /// <see langword="true" /> if <paramref name="item"/> is found in the
 /// collection; otherwise, <see langword="false" />.
 /// </returns>
 public bool Contains(NUnitTest item)
 {
     return(base.List.Contains(item));
 }