xunit.runner.dnx set configuration to use for running tests - xunit

I have noticed that when I use powershell to run my tests with the dnx runner it defaults to using the Debug configuration. Is there any way to tell it to use a different configuration?
Something like
"commands": {
"test": "xunit.runner.dnx -xml TestResults.xml -config Publish"
},

This is a DNX setting (and is passed on the DNX command line), not an xUnit.net command option.
dnx --configuration Release test

Related

How do I use Gradle bootRun with --args in Intellij

Gradle 4.9 introduced the --args parameter to bootRun, which I can use easily from the command-line, but how do I use this from a Run/Debug configuration in Intellij 2018?
With a Gradle build set to run the bootRun task on my project in Intellij, I've tried the following arguments in the Run/Debug Configurations screen without any success:
--args 'foo'
--args='foo'
--args=foo
Output from Intellij:
9:18:56 AM: Executing task 'bootRun --args='foo''...
Unknown command-line option '--args'.
9:18:57 AM: Task execution finished 'bootRun --args='foo''.
A similar question documents the older syntax for doing this.
Maybe you can add your args to Tasks as bootRun --args='foo' in IDEA's Run/Debug Configurations.
My task is run --args='-h' and it works for me
Unfortunately, #Linsama's workaround will not work with multiple arguments. For example, run --args='--arg1 --arg2' will not work.
For multiple arguments, you have to move the entire thing in the Arguments field and leave the Tasks field blank.
This will work:
Tasks:
Arguments: run --args='--arg1 --arg2'
As a workaround you can use gradle properties.
In intellij Arguments field add -Pargs=--myArg=value
Then in your build.gradle add
bootRun {
if (project.hasProperty('args')) {
args project.args.split(',')
}
}
They should be now accesible using ApplicationArguments inside your application.

intellij mocha plugin doesn't always use mocha

Normally from the IntelliJ's 'projects' pane, I can right click on a test file and choose 'debug' or 'run' and the Mocha Plugin intercepts it and automatically creates run/debug configurations for the file. This causes IntelliJ to use the following command: (note presence of mocha)
/usr/local/bin/node --debug-brk=57425 /projects/my_project/node_modules/mocha/bin/_mocha --timeout 3600000 --ui bdd --reporter "/Users/shared/Library/Application Support/IntelliJIdea2016.1/NodeJS/js/mocha-intellij/lib/mochaIntellijReporter.js" /projects/my_project/tests/src/scripts/my-other-test.js
Other times (for nearly identical files in the same folder) it doesn't: (note mocha is absent)
/usr/local/bin/node --debug-brk=57068 my-test.js
The only way I've been able to run the test file is to manually create a Run Configuration specific to that file.
What do I have to do to encourage the Mocha Plugin to automatically create a run/debug configuration?
You need to make sure that mocha package is installed locally in your project. Mocha plugin checks that and creates mocha-command instead of node-command.

Launched gradle with a test with the --no-daemon parameter but the daemon is launched anyway

I'm trying to debug some unit tests I've written but the gradle daemon seems to always launch, ignoring any options I've set.
Using Mac OS X 10.9.5, Java 1.7, Gradle 2.2.1 and robolectric-gradle-plugin 0.14.1
Launching gradle with:
GRADLE_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5006"
./gradlew test --no-daemon -Dorg.gradle.debug=true
causes the following line to appear
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: http://gradle.org/docs/2.2.1/userguid....
I've also tried setting the -Xdebug and Xrunjdwp as jvmArgs in build.gradle.
Nothing else happens but if I add -d and rerun, it turns out that the daemon has launched and is waiting on port 5005 for a debugger: http://pastebin.com/TqaXubmr
Finally, if I then launch a debugger attaching to port 5005 the tests run but none of the breakpoints are hit.
The gradle.properties is empty, I haven't set org.gradle.jvmargs.
You might have configure memory settings in your gradle.properties? these can force gradle to launch a new jvm as these settings cannot be applied dynamically.
Keep in mind that unit tests are always executed in a separate jvm. The easiest way to debug tests executed by gradle is to run
>gradle :test --debug-jvm
this will automatically configure your test task to run with debug enabled.

How to import into jenkins Msbuild result

I use build on with the following chain to build several dotnet solution:
Jenkins -> batch (cmd) -> MsBuild
How to retrieve build result and failure on MsBuild compilation into jenkins and/or Rational team concert build result ?
I have found jenkins plugin to import trx files (tests results) of MSTest.
I expect to find some think equivalent for MSBuild but i don't want to have to define each solution into jenkins.
The warnings ng plugin will do it for you. Install the plugin and then use the following in your publish step :
recordIssues enabledForFailure: true, tools:[msBuild()]
https://github.com/jenkinsci/warnings-ng-plugin/blob/master/doc/Documentation.md
The solution to see the MSBuild output in Jenkins is to install
MSBuild Plugin(https://wiki.jenkins.io/display/JENKINS/MSBuild+Plugin)
Then, you just need to create a call to it from your pipeline
bat "\"${tool 'MSBuild'}\" \"%WORKSPACE%\\Example.sln\" /t:Clean,Build /p:Configuration=Release /p:OutDir=\"%WORKSPACE%\\Example\\Example.sln\" /p:BuildingProject=true"
This will show the MSBuild process in the Jenkins console output.

Build are not tagged as unstable when unit test fails

I have added a new job in my hudson server which builds the project with a makefile.
Execute shell command:
#!/bin/bash
cd $JOB_NAME
make
My makefile looks like this
SDK_31 = iphonesimulator3.1
TARGET_DEV = myProject
TARGET_TEST = unitTest
all: debug
debug:
xcodebuild -sdk ${SDK_31} -target "${TARGET_DEV}" -configuration Debug
xcodebuild -sdk ${SDK_31} -target "${TARGET_TEST}" -configuration Debug
clean:
xcodebuild -alltargets clean
rm -rf build
But when hudson build the projects, some unit tests fail but the build is tagged as successful.
What should I have to do to have an "unstable project" ?
Best regards,
You should configure Hudson to record unit test results, by enabling the 'Publish Junit test result report' post-build action.
post-build actions http://img141.imageshack.us/img141/5136/hudsonjunit.png
Update: If you can't get JUnit XML output, you should be able to use the Text-finder plugin to change the build status:
This plugin lets you search keywords in the files you specified and use that to mark the build as success or a failure.
I found this handy ruby script by Christian Hedin that converts the output of OCUnit tests (the format used by Xcode) into JUnit xml files (the format used by Hudson).
You can grab the script on github:
http://github.com/ciryon/OCUnit2JUnit
and for an explanation of how to use it, here's his blog post about it:
http://blog.jayway.com/2010/01/31/continuos-integration-for-xcode-projects/
Basically, you pipe xcodebuild into ocunit2junit.rb with a command like this:
/usr/bin/xcodebuild -target UnitTests | /usr/local/bin/ocunit2junit.rb
and it places the xml files into a test-reports folder that it creates at the root of your project folder. Then tell Hudson to copy the test-reports/*.xml artifacts as the JUnit results and you're set.
This setup will allow Hudson to correctly identify if a unit test has passed or failed and correctly mark the stability of the build.
I've been using it for a month now and it works great. The setup was very simple.

Resources