TFS 2015 Command Line build task fails after executing xUnit tests but there's no error/issue - selenium

In the build definition in TFS 2015, I've got a Command Line step that runs the following command:
xunit.console.exe \PathToTests\Tests.dll -xml \PathToResultsFolder\Results.xml
During the build, I can see the tests are being discovered and executing and everything's looking good.
But if I don't check "Continue on error" in the Command Line step, after the tests run and the result XML file has been saved, the step fails with the following error:
Task CmdLine failed. This caused the job to fail. Look at the logs for the task for more details.
But there's actually no error or anything I can see. The tests have run and the XML file has saved properly and is able to published to TFS. And I don't see an error like this if I run the command from the build machine.
Any ideas?

Related

TFS - Enabling "Rerun Failed Tests"

I have a TFS Release definition that runs several tests as part of the deployment:
When I check the "Rerun Failed Tests" Option in my "Visual Studio Test" step in:
My unit tests no longer run as part of my release. The release fails with the following error in the "Visual Studio Test" step:
2019-02-22T16:21:33.0983821Z ##[error]Error opening response file
'C:\TFS' 2019-02-22T16:21:33.1413767Z ##[error]The test source file
"C:\TFS Agent\ _work\r6\a\Agent_work_temp\ea14a091-36bd-11e9-99f5-51895cf3942e.txt" provided was not found.
I figured since the error started with the following statement:
Error opening response file 'C:\TFS'
That there is some sort of bug with the TFS test runner where the call to the task to execute the tests is not putting the path in quotes. I changed all my TFS build agents to using the following "type" of paths for all builds(I removed all spaces from the folder the TFS agents lived in):
C:\TFSAgent\ _work
And it seems to work now...

Dotnet test task fails with ''MSB1008: Only one project can be specified" error after upgrade to version 2.0

The TFS instance I am working on was recently upgraded from TFS 2017 Update 1 to TFS 2018 Update 2, allowing me to change the dotnet task version used in my build definitions from 0.* to 2.*.
In doing so, the dotnet test step no longer works, returning the following error:
MSBUILD : error MSB1008: Only one project can be specified.
Switch: trx
The command it runs is:
C:\Program Files\dotnet\dotnet.exe" test <Agent_WorkFolder>\1\w\3\s\source\MySolution\MyProject.csproj --configuration release --logger trx --logger trx --results-directory <Agent_WorkFolder>\1\w\_temp
The parameters given to the task are:
Paths to projects = **\*Tests*.csproj
Arguments = --configuration $(BuildConfiguration) --logger trx
Reverting the task version back to 0.*, and it runs again. What is causing this error?
The problem is caused by --logger trx being specified in the Arguments to the task. The newer versions of the task automatically adds this switch when executing the dotnet test command as its the output which TFS supports for reading test results. The extra argument results in the switch being given twice, so whilst MSBUILD error is unhelpful, the Switch: trx part gives a clue as to what is the problem.
Removing the switch from the arguments resolved the problem.

Jenkins Running xUnit Tests Code 58

This has me completely stumped. I have a Jenkins build configured to run some xUnit tests in my solution via an MSBuild script.
When it gets to the task to run the tests I get a failure message:
error MSB3073: The command .... exited with code 58.
I can't even find any info on what error code 58 is.
If I copy the command to a CMD window and run it it runs perfectly so the command itself is definitely correct. Any ideas what error code 58 is? Or has anyone seen this problem before and have a solution?

jenkins error FATAL: Unable to find build script at C:\selenium tests for moveon\moveon4tests1\build.xml

I am using Jenkins and Ant to run my selenium tests. It works fine when I run them on my local machine.
Now I have a Jenkins server which is on a different location and I have to run my tests on that server.
when I tried to run the tests on that server Its is failing because it couldn't find the build.xml file. can you please let me know how can I change the home directory path?
Started by user :**********
Building in workspace /var/lib/jenkins/jobs/moveon4 java tests/workspace
FATAL: Unable to find build script at C:\selenium tests for move\movetests1\build.xml
Build step 'Invoke Ant' marked build as failure
Finished: FAILURE
Are you using "Invoke Ant" in your Jenkins job configuration for the build step that executes your Ant build ? If so, the build file location is hidden away in the Advanced section - it's an annoying quirk of Jenkins.

Unexpected System.Reflection.TargetInvocationException error executing SQL command

MSBUILD - When executing DDL file I get this error:
Unexpected System.Reflection.TargetInvocationException error executing SQL command
Before this execution two other ones are executed with no problems.
I'm assuming that you're using the ExecuteDDL task from the MSBuild Community Tasks library. If so, I've run into the same issue before and I have always found that the script fails if I run it manually in SQL Management Studio.
I recommend that you run the two scripts that succeeded, then running the on that's failing manually and make sure that it doesn't have any errors.