Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6687157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:15:19+00:00 2026-05-26T05:15:19+00:00

i’m having a problem running an integration test through Gallio. The test works fine

  • 0

i’m having a problem running an integration test through Gallio.
The test works fine when I run it with Testdrive.NET or through the integrated Gallio in Visual Studio. When I’m trying to run it through the console (like our nant scripts do) it fails. The message received is this:

[failed] Test
TenForce.Execution.Api2.OData.Tests/AttachmentIntegrationTests/Att
achmentUpload Execute
System.ServiceModel.CommunicationObjectFaultedException: The
communication objec t, System.Data.Services.DataServiceHost, cannot be
used for communication becaus e it is in the Faulted state. at
System.ServiceModel.Channels.CommunicationObject.Close(TimeSpan
timeout) at
System.ServiceModel.ServiceHostBase.System.IDisposable.Dispose() at
TenForce.Execution.Api2.OData.Tests.IntegrationTests.AttachmentIntegration
Tests.AttachmentUpload() in
D:\Users\arne.de.herdt.TENFORCE2\Documents\Developme
nt\Projects\Robinson\TenForce.Execution.Api2.OData.Tests\IntegrationTests\Attach
mentIntegrationTests.cs:line 83

Disposing the test runner. Stop time: 16:45 (Total execution time:
20,515 seconds)

1 run, 0 passed, 1 failed, 0 inconclusive, 0 skipped

The complete commandline is the following:

Gallio.Echo.exe /r:IsolatedProcess TenFor
ce.Execution.Api2.OData.Tests.dll
/f:Namespace:TenForce.Execution.Api2.OData.Tes ts.IntegrationTests

I have no idea what is causing this problem in Gallio. It works from VS but not on the build agent or console. The source code of the test is this:

using System.Data.Services;
using System.ServiceModel;
using System.ServiceModel.Description;

namespace TenForce.Execution.Api2.OData.Tests.IntegrationTests
{
    using System;
    using System.Collections.Generic;
    using System.ServiceModel.Web;
    using MbUnit.Framework;
    using Objects;
    using Helpers;
    using Test.Attributes;

    /// <summary>
    /// <para>This class contains all the integration tests to verify the correct working conditions for attachment entities.</para>
    /// </summary>
    public class AttachmentIntegrationTests : BaseIntegrationTest
    {
        /// <summary>
        /// <para>This test will try to create a new attachment on an item using a local file.</para>
        /// </summary>
        [Test, MaxDuration]
        public void AttachmentUpload()
        {
            #region Test Preparation

            // Prepare a Workspace
            var workspace = CreateWorkspaceObject();
            Assert.IsTrue(Factory.CreateApi().Workspaces.Create(workspace), "Expected the test workspace to be created.");

            // Prepare a List
            var list = CreateList();
            list.Workspace = workspace;
            list.ItemType = new ItemType {Id = 5};
            Assert.IsTrue(Factory.CreateApi().Lists.Create(list), "Expected the test list to be created.");

            // Prepare an Item.
            var itemFields = new List<ItemField>
                                     {
                                         new ItemField {FieldId = "SF19", Type = "List", ValueId = list.Id},
                                         new ItemField {FieldId = "SF2", Type = "Title", Value = string.Format("I {0}", DateTime.Now)},
                                         new ItemField {FieldId = "SF4", Type = "AssignedTo", ValueId = 1}
                                     };
            var item = new Item { ItemFields = itemFields.ToArray() };
            Assert.IsTrue(Factory.CreateApi().Items.Create(item), "Expected the test item to be created.");

            #endregion

            using (var host = new DataServiceHost(typeof (Web.Api), new[] {BaseUri}))
            {
                // Start the host
                host.Open();

                // Create a new WebClient to create a call to the attachments resource
                var client = new ODataClient {BaseUri = BaseUri, Username = "sadmin", Password = string.Empty};

                // Send the file contents to the service using the correct url.
                string response = client.UploadAttachment(GetTestFileLocation("ReportingTest.xls"), item.Id);
                var parser = new ODataParser();
                parser.LoadResponse(response);

                // Fetch the Id of the Attachment, this should be greater than 0.
                int attachmentId = parser.GetEntityId();
                Assert.IsTrue(attachmentId > 0, "Expected the Id to be greater than zero.");

                // Verify if the item is coupled to the correct Item.
                response = client.GetResource(string.Format("Attachments({0})/Item", attachmentId));
                parser.LoadResponse(response);
                int itemId = parser.GetEntityId();
                Assert.IsTrue(itemId == item.Id, "Expected the linked item to have a matching Id.");

                // Change the filename of the uploaded file and verify whether the file is properly renamed.
                client.UpdateProperty(string.Format("Items({0})/Attachments({1})/Filename/$value", itemId, attachmentId), "uploaded_excel.xls");

                // Verify if the changes made it to the database.
                Attachment att = Factory.CreateApi().Attachments.Read(attachmentId);
                Assert.AreEqual("uploaded_excel.xls", att.Filename, "Expected the data to be changed on the entity.");
                Assert.IsTrue(System.IO.File.Exists(Factory.CreateApi().Attachments.GetAttachmentPath(att, false)), "Expected the file to be present on the hard drive.");

                // Close the host properly
                host.Close();
            }
        }
    }
}

Am I missing something in regards to hosting the DataService in the unit test?

EDIT 1
Running the following command:

netsh http add urlacl url=http://+:60000/ODataService/
user=administrator

Solved part of the problem. I can now run the test without problems fine on my development system through the console, but the build agents still can’t run the test. They push the following output:

failed Execute System.Net.WebException: The remote server returned an
error: (500) Internal Server Error. Status: ProtocolError Response:
System.Net.HttpWebResponse at System.Net.WebClient.UploadFile(Uri
address, String method, String fileName) at
System.Net.WebClient.UploadFile(Uri address, String fileName) at
System.Net.WebClient.UploadFile(String address, String fileName) at
TenForce.Execution.Api2.OData.Tests.Helpers.ODataClient.UploadAttachment(String
path, Int32 itemId) in
c:\Robinson\trunk\Projects\Robinson\TenForce.Execution.Api2.OData.Tests\Helpers\ODataClient.cs:line
69 at
TenForce.Execution.Api2.OData.Tests.IntegrationTests.AttachmentIntegrationTests.AttachmentUpload()
in
c:\Robinson\trunk\Projects\Robinson\TenForce.Execution.Api2.OData.Tests\IntegrationTests\AttachmentIntegrationTests.cs:line
89
——- Stdout: ——- Unable to read configuration section
common/logging. Using no-op implemenation.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:15:20+00:00Added an answer on May 26, 2026 at 5:15 am

    Took me quite some time to figure this out, but the problem is not Gallio.
    The problem is the toolkit used to develop the OData service. This toolkit is not able to run from a console hosting environment.

    After moving the service to a remote server and writing tests to call the functions remotely and parse the responses, we got the intended behavior working.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I am currently running into a problem where an element is coming back from
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm having trouble keeping the paragraph square between the quote marks. In firefox the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am trying to loop through a bunch of documents I have to put
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.