Test is failing due to Internal Server Error



I have linked my .NetCore project to Circle CI but every time i run my xUnit tests my web Api integration test keeps failing with the error message “Internal Server Error”. I am unsure as to why this is failing,


So are your readers! At a minimum, we’d need to see your config and some logs to be able to help.

Usually an internal server error is code for a more specific error which is lurking in a log file somewhere. Can you find that?


my config file is:

   version: 2
           - image: microsoft/dotnet:sdk
           - checkout
           - run:
               name: Restore Nuget
               command: dotnet restore
           - run:
               name: Build Solution
               command: dotnet build ./CsvFileConverter.sln
           - run:
               name: Run Test
               command: dotnet test InternProject.CsvFileConverter.XUnitTests 
           - restore_cache:
                 - gem-cache-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }}
       version: 2
           - build

the full error is:

 [xUnit.net 00:00:18.7014811]     InternProject.CsvFileConverter.XUnitTests.WebApi.DealDataWebApiIntergrationTest.Should_GetAsync_PassWhenCorrectDataIsGottenThroughTheApi [FAIL]
 Failed   InternProject.CsvFileConverter.XUnitTests.WebApi.DealDataWebApiIntergrationTest.Should_GetAsync_PassWhenCorrectDataIsGottenThroughTheApi
 Error Message:
  Expected response.StatusCode to be 200, but found InternalServerError.
 Stack Trace:
    at FluentAssertions.Execution.XUnit2TestFramework.Throw(String message) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\XUnit2TestFramework.cs:line 32
    at FluentAssertions.Execution.AssertionScope.FailWith(String message, Object[] args) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Execution\AssertionScope.cs:line 225
    at FluentAssertions.Primitives.ObjectAssertions.Be(Object expected, String because, Object[] becauseArgs) in C:\projects\fluentassertions-vf06b\Src\FluentAssertions\Primitives\ObjectAssertions.cs:line 42
    at InternProject.CsvFileConverter.XUnitTests.WebApi.DealDataWebApiIntergrationTest.Should_GetAsync_PassWhenCorrectDataIsGottenThroughTheApi() in /root/project/InternProject.CsvFileConverter.XUnitTests/WebApi/DealDataWebApiIntergrationTest.cs:line 43
 --- End of stack trace from previous location where exception was thrown ---

I had this error in my xUnit tests a while ago before i linked it to CircleCi, but i have managed to fix it and all the Tests run successfully when i run the code locally. it only seems to fail on CircleCi


it has been edited :slight_smile:


Thanks for editing :slightly_smiling_face:.

Your error is:

Expected response.StatusCode to be 200, but found InternalServerError

So, it looks like you are accessing a web app or web service. I suspect you’re getting a 500 on the client side, but the error will be on the server side. What logs do you get there?

This does not look like a CI issue - just a Linux/tests/debugging issue.


I don’t know how to access or if i have the logs for this. I don’t get any more information than what i have shown above. I thought i might have to specify a path or a browser in my Yaml or add a extension file, to enable this to work but i don’t know how to or if that would be the correct approach.

I am new to CircleCi and this is my first project integration :sweat:


You’ve not said whether the thing you are testing via HTTP is your project, but my assumption is that it is. Thus, it will generate logs, you just need to find them. You could look on your development computer to see where to expect them.

As an alternative, you could get SSH access to a build server, start your service (not your tests) and see if you can connect to it from the console. I presume there is a simple GET you can do to see if it is working.


Thanks for your help i found the error after opening the logs there is an issue with accessing some of the files needed for testing.


This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.