I recently moved out of nunit tag and moved to exec tag to run nunit console for running unit tests.
Here is what i have in my build script:
exec program="nunit-console.exe" verbose="true" failonerror="true">
arg file="../abc.dll"/>
exec>
Here is what I see in output:
task name="exec">250.0064250.0064
As you can see it did run from the duration and I know that my tests are currently failing but my build didn't fail.
Any ideas?
To be honest: I'm clueless. We're executing NUnit console through NAnt's <exec> task, we're getting meaningful output and we're absolutely not doing anything fancy:
<exec program="C:\dev\tools\NUnit\2.5.9\bin\net-2.0\nunit-console.exe">
<arg file="C:\foo\bar.dll" />
</exec>
Related
I am trying to add a custom command which in turn calls a python script, as per example here https://support.thoughtworks.com/hc/en-us/articles/213253646-Go-s-custom-command,
<exec command="myecho.sh">
</exec>
In my case,
<exec command="/usr/bin/python cd_dashboard.py">
<arg>-v</arg>
</exec>
But when I execute the pipeline it fails with following error,
[go] Task: "/usr/bin/python cd_dashboard.py" -vtook: 0.2s
Error happened while attempting to execute '/usr/bin/python cd_dashboard.py -v'.
Please make sure [/usr/bin/python cd_dashboard.py] can be executed on this agent.
So the question is where should the python script reside to be accessible to agent? Should be in agent's PATH.
Is this correct understanding?
The command should be /usr/bin/python, please move cd_dashboard.py to the args. Right now GoCD trying to run executable /usr/bin/python cd_dashboard.py, which of course doesn't exist. You should have something like this:
<exec command="/usr/bin/python">
<arg>-v</arg>
<arg>cd_dashboard.py</arg>
</exec>
I have created an React+Redux using the .Net Core 2.0 template. I didn't change anything yet it's not buildind.
Severity Code Description Project File Line Suppression State
Warning MSB3073 The command "node --version" exited with code
1. WebApplication2 C:\Tests\WebApplication2\WebApplication2\WebApplication2.csproj 25
Yet, node is properly installed, when I run "node --version" in a prompt (from any drive/directory) I get v8.4.0 and no error code (the expected behaviour).
I tried using the full path in the .csproj file.
<Exec Command=""C:\Program Files\nodejs\node" --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
And I'm still getting the same error
Severity Code Description Project File Line Suppression State
Warning MSB3073 The command ""C:\Program Files\nodejs\node" --version"
exited with code
1. WebApplication2 C:\Tests\WebApplication2\WebApplication2\WebApplication2.csproj 25
I reinstalled NodeJS, with the same results.
Then I even tried a dummy task calling dos echo 0 and it still fails.
Severity Code Description Project File Line Suppression State
Warning MSB3073 The command "echo 0" exited with code
1. WebApplication2 C:\Tests\WebApplication2\WebApplication2\WebApplication2.csproj 25
What's going on?
Here's the whole segment which does the check:
<Target Name="DebugRunWebpack" BeforeTargets="Build" Condition=" '$(Configuration)' == 'Debug' And !Exists('wwwroot\dist') ">
<!-- Ensure Node.js is installed -->
<Exec Command=""C:\Program Files\nodejs\node" --version" ContinueOnError="true">
<Output TaskParameter="ExitCode" PropertyName="ErrorCode" />
</Exec>
<Error Condition="'$(ErrorCode)' != '0'" Text="Node.js is required to build and run this project. To continue, please install Node.js from https://nodejs.org/, and then restart your command prompt or IDE." />
<!-- In development, the dist files won't exist on the first run or when cloning to
a different machine, so rebuild them if not already present. -->
<Message Importance="high" Text="Performing first-run Webpack build..." />
<Exec Command="node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js" />
<Exec Command="node node_modules/webpack/bin/webpack.js" />
</Target>
This had been related to security issue of some sort.
Running "dotnet run" from a command prompt run with admin rights "fixed" the issue.
I ran into this issue (I realized that my node_modules folder wasn't there) so I upgraded my .Net Core app to 2.1 and ran npm i and that worked.
Doesn't hurt to just try npm i and try again
I am new to unit testing (and would really like to learn). I tried pulling down this repository (https://github.com/serbanghita/Mobile-Detect) and have been trying to run their unit tests they already have set up. I have it to the point where phpunit is running but when I run
phpunit tests
from the root directory I get:
Tests: 1411, Assertions: 0, Errors: 1411
I have tried running
phpunit --configuration tests/phpunit.xml
but then I get the error:
Class "JohnKary\PHPUnit\Listener\SpeedTrapListener" does not exist
They have something in their documentation about running:
php phpunit.phar -c tests/phpunit.xml
but I get the error
Could not open input file: phpunit.phar
which is because of the way I have phpunit set up I'm sure...
Any suggestions on how to further trouble shoot this?
It appears you have configured https://github.com/johnkary/phpunit-speedtrap to be used as a test listener in your phpunit.xml but have not (properly) installed this extension.
And if your PHP cannot find phpunit.phar then you are either not pointing it to the correct path or you have not downloaded / installed the PHPUnit PHAR, maybe because you chose to install PHPUnit via Composer. In that case the correct path would be vendor/bin/phpunit, of course.
I have a python script that is doing some deployment.
I want to run that script from msbuild and get the output in case it pass, or failed.
So, how can I communicate to msbuild of the status , and the error text?
I want to show the result on the build server.
I have to use python 2.7, and cannot use 3.x
Run the command using the Exec task and capture it's output. For example:
<Target Name="GetPythonOutput">
<PropertyGroup>
<PyCommand>/path/to/python.exe -a /path/to/pthonfile</PyCommand>
<TempFile>ExecTempFile</TempFile>
</PropertyGroup>
<Exec Command="$(PyCommand) > $(TempFile)" />
<ReadLinesFromFile File="$(TempFile)">
<Output TaskParameter="Lines" ItemName="PyOutput"/>
</ReadLinesFromFile>
<Delete Files="$(TempFile)" />
<Message Text="Python command output was: #(PyOutput)" />
</Target>
If you are using .Net 4.5 things are better since Exec can do most of the work for you
I'm in the middle of my first ever stab at setting up Jenkins to build and run unit tests /code coverage with my CakePHP project. So far I have successfully got Jenkins fetching and building automatically from my BitBucket repository - a small victory in itself.
Next thing I want to happen is for the unit tests to run and code coverage reports to be populated.
Here is my build.xml, which is being executed in Jenkins with the (only) build command phing -f $WORKSPACE/build.xml
<?xml version="1.0" encoding="UTF-8"?>
<project name="Consumer Love" default="phpunit">
<target name="phpunit">
<exec command="cake test app --coverage-clover logs/reports/clover.xml"></exec>
</target>
</project>
I think the issue is that when you run cake test app it asks for a prompt of which specific tests you want to run, I have been unable to figure out a method to run all of my CakePHP app unit tests.
The solution was to create a custom CakePHP Test suite which adds specific files/directories to be tested, then run that suite with the command cake test app AllTests.
For example, here is my Test/Case/AllTests.php:
/*
* Custom test suite to execute all tests
*/
class AllTestsTest extends PHPUnit_Framework_TestSuite {
public static function suite() {
$path = APP . 'Test' . DS . 'Case' . DS;
$suite = new CakeTestSuite('All tests');
$suite->addTestDirectory($path . 'Model' . DS);
return $suite;
}
}
This testsuite simply adds the Models directory to the testing environment, so all my model tests now get executed. As you can see it can be extended to run more/all tests as seen fit.
Try cake test app all. I can't confirm this makes the difference just now, but I've pulled this out of a phing build file where I'm doing the same thing as you so it should be good.