How to get build result - visual-studio-2012

I have created a batch file which build my solution( in visual studio).How to get the build result so that I can decide weather the build is passed or failed ?
Batch File Content :
CALL MSBUILD %USERPATH%\EngineSln\Engine.sln

The return code of msbuild.exe would be non-zero when build fails. The way to check it in batch file is
msbuild.exe Path\To\MySolution.sln
if ERRORLEVEL 1 (
echo Build failed!
) else (
echo Build succeeded.
)

Related

No test result files matching D:\build\V1\_w\1\s\test\target\reports\*.xml were found

I have configured azure pipeline for running my build.
While running test case step the build ran with status “success” with message: No test result files matching D:\build\V1_w\1\s\test\target\reports*.xml were found, so publishing JUnit test results is being skipped”
And after this when zip file is creating automatically as part of build “create zip with failed tests info” it failed the build with error message: ##[error] Error: Achieve creation failed for archive file: D:\build\V1_w\1\s\tests\target\reports.zip ENOENT
Please help me to resolve this issue.
I have done all the required right configuration but still it’s occurring.
Thanks 🙏

Why Does CruiseControl.net Build Still Succeed When Exec Task Fails?

I have this task in publishers after xmllogger:
<exec>
<executable>CheckForWarnings.cmd</executable>
<successExitCodes>0</successExitCodes>
<baseDirectory>C:\Program Files (x86)\CruiseControl.NET\server</baseDirectory>
<buildArgs>all</buildArgs>
</exec>
I've verified that this task is returning a non-0 exit code via the ccnet service logs:
2013-01-29 23:21:20,571 [Encompass.2013R1:INFO] Integration complete: Failure - 1/29/2013 11:21:20 PM
So why is the build still green?
Tasks put inside the publisher section will not change the build result, as they are part of the report (publisher) and not the build (tasks).
The publishers section is run after the build completes (whether it
passes or fails). This is where you aggregate and publish the build
results.
http://www.cruisecontrolnet.org/projects/ccnet/wiki/Tasks_and_Publishers
You have to put the exec task in the tasks section, not the publish section, if you want it to fail the build.

What are the success exit codes from tSQLt

I am trying to integrate tSQLt / SQLTest with CruiseControl.NET
My tests are running and I've written xsl files to display the results but I need to know how to mark the build as failed if any tests fail.
My CCNet exec is:
<exec executable="$(sqlCmdPath)">
<description>Run Unit Tests</description>
<buildArgs>-E -d MyDatabase
-i "\CruiseControlProjects\Configuration\CI_SQL\RunTests.sql"
</buildArgs>
<baseDirectory>\Artifacts\MyDatabase</baseDirectory>
<successExitCodes>0,63</successExitCodes>
</exec>
RunTests.sql:
IF EXISTS (SELECT * FROM sys.objects WHERE OBJECT_ID = OBJECT_ID(N'[tSQLt].[RunAll]')
AND TYPE IN (N'P',N'PC'))
BEGIN
EXECUTE [tSQLt].[RunAll]
END
The tests are run and I have a subsequent task which produces the results in xml that are then merged into the build log:
<exec executable="$(sqlCmdPath)">
<description>Get Unit Tests</description>
<buildArgs>-E -b -d MyDatabase -h-1 -y0 -I
-i "\CruiseControlProjects\Configuration\CI_SQL\GetTestResults.sql"
-o "\CruiseControlProjects\Configuration\CI_SQL\Results\TestResults.xml"
</buildArgs>
<baseDirectory>\Artifacts\MDatabase</baseDirectory>
<successExitCodes>0,63</successExitCodes>
</exec>
So how do I get the overall build to fail?
If you use the -b parameter to sqlcmd, you should find that it will throw an error with a non-zero code when the batch fails (which will happen if tSQLt fails at least one test).
However, I have one potential suggestion to explore. If you can load the XML file within Cruise Control, then the tests can be loaded in as the XML file is in the same format as an nUnit test output file. (Note - I've used this method on TeamCity and Jenkins, but not tried with Cruise Control). This will treat the tests as tests rather than an 'all-or-nothing' approach, and enabling you to track which tests fail repeatedly.
Hope that helps,
Dave.

Setting up a rake task to run a specific Cucumber scenario

I'm trying to set up a rake task to run any cucumber scenario with a certain tag(#server).
I have a rakefile in the root of the project directory with this code:
require 'cucumber/rake/task'
desc "Get SQL response and store it in a file"
Cucumber::Rake::Task.new(:server, 'Execute SQL (#server only)') do |t|
t.cucumber_opts = [ '--tags', '#server' ]
end
task :default => :server
With a cucumber.yml file for default profile in the root of the project as well
default: --profile server_cache
server_cache: --format pretty --tags #server
I try running "jruby -S rake" on the command prompt while in my project folder and I get this error:
"'jruby.bat.exe' is not recognized as an internal or external command, operable program or batch file"
Am I trying to run the task in a wrong way?
I'm using jruby 1.5.6, version 1.8, on windows xp.
Thanks in advance for any help!
I would have posted this as a comment, but your problem has nothing to do with rake, and everything to do with gem installation
I'm curious, are you using RubyMine? I've had this problem before when I installed gems for jruby using RubyMine's installer. For whatever reason, it munges the batch files during installation of gems.
For example, your rake.bat file should look something like this:
#ECHO OFF
#"%~dp0jruby.exe" -S rake %*
If it doesn't, it's probably been updated by your gem install process.
You're executing the command correctly, but something has munged the rake.bat (or cucumber.bat, check it as well) to include an execution of 'jruby.bat.exe' when it should just call jruby.exe For reference, my cucumber.bat looks like this:
#ECHO OFF
IF NOT "%~f0" == "~f0" GOTO :WinNT
#"jruby.exe" "C:/<path to jruby>/bin/cucumber" %1 %2 %3 %4 %5 %6 %7 %8 %9
GOTO :EOF
:WinNT
#"jruby.exe" "%~dpn0" %*

Cruisecontrol.Net reporting incorrectly reporting build status

We've been having some issues with CCnet 1.5.7256.1 recently where some builds are running and failing but being reported as Successful builds. The build logs show the exception/failure status but the dashboard is still displaying green ticks and Success.
Obviously this is a concern as failed builds are going unnoticed.
Has anyone else had this problem?
I've posted on the ccnet-user google group here - http://groups.google.com.ag/group/ccnet-user/browse_thread/thread/4190a19b0fee57b3
give the errorlevel command to your builds.
if its a batch file give a command of finding errorlevel after every build command. This will return the cruise control failed status which will make the CC build status failed.
Command is:
If %Errorlevel% is neq 0 than exit /b errorlevel

Resources