Jenkins with the Measurement Plots plugin does not plot measurements - plugins

Is there anyone who was successful in getting a plot using Jenkins with the Measurement Plots plugin and a xUnit test results file with the tags?
If yes, I'd like to see a sample of a working xUnit file and get from you any tips you may have about configuring Jenkins and the appropriate Jenkins job to accomplish this feat.

I just figured it out with some help from the author. The trick is to escape the XML inside the XML and use <system-out>to feed the Measurements Plot plugin. The steps below shows how to use it and feed various values into the plugin:
Create a New Job in Jenkins "free-style software project"
Add String Parameter VALUETEST
Add Build step Execute Shell Command is the code below.
Add Post-build Action: Publish JUnit
Test report XMLs: testdetail-*.xml
Check Retain long staandard output
Check Measurement Plots
Save and Build Now.
Plot will appear under Test Results. You need more than one run for the plot appear.
Execute Shell Command:
echo '<?xml version="1.0" encoding="UTF-8"?>' > testdetail-lcov.xml
echo '<testsuites name="CodeAnalysis" tests="2" failures="0" disabled="0" errors="0" time="0">' >> testdetail-lcov.xml
echo '<testsuite name="Suite" tests="1" >' >> testdetail-lcov.xml
echo '<testcase name="Case" status="run" time="0" classname="Suite">' >> testdetail-lcov.xml
echo '</testcase></testsuite>' >> testdetail-lcov.xml
echo '<testsuite tests="1" >' >> testdetail-lcov.xml
echo '<testcase name="Lcov" status="run" time="0" classname="CodeAnalysis.Coverage">' >> testdetail-lcov.xml
echo '<system-out>' >> testdetail-lcov.xml
echo "<measurement><name>Line Coverage</name><value>$VALUETEST</value></measurement>" >> testdetail-lcov.xml
echo '</system-out>' >> testdetail-lcov.xml
echo '</testcase></testsuite></testsuites>' >> testdetail-lcov.xml

The Measurement Plots plugin is designed to take values out of standard output and error buffer and should not be used to plot stats and details of test frameworks.
For xUnit there is a xUnit plugin that does the job quite nicely. Unless you want to handle some very specific type of data/information used by xUnit, this should the trick of nicely showing the tests results.

Related

pytest coverage output is cut

Running pytest with coverage in a larger project, the output is strangely cut (note the datam at the end, many files are still missed here).
I'm not aware of further configuration—no pytest.ini, no pyproject.toml, no related environment variable.
How can I overcome this, given I want the simple terminal output, not an extra report?
Only if needed: How could I print the results written to .coverage sqlite database to terminal?
> pytest tests/ --cov
...
---------- coverage: platform win32, python 3.10.4-final-0 -----------
Name Stmts Miss Cover
--------------------------------------------------------------------------------
...
datamodel\model\gis\topology\edge.py 26 3 88%
datamodel\model\gis\version.py 0 0 100%
datam
============================== 45 passed in 6.44s ==============================
This looks like a bug of the coverage package, maybe from too many files (>400 in my case), maybe interference with pytest-xdist.
In such a case ignore the pytest output and print the results written to the .coverage sqlite database to terminal, like
> pytest tests --cov -n 12
...
> coverage report
...

AWS Lambda deployment

I'm trying to deploy my lambdas (.NET Core 2.0) into AWS by using AWS CLI + TeamCity + Powershell script. I have some steps , including deploy step and applying new aliase number step.
While deploy step I don't get alias number (lambda version). A script returns me something like "function = ", but it should be like "result = 44 (or any other lambda version)".
Here's a script (mix of Powershell + AWS CLI commands).
FOR ( /F "tokens=* delims=" %%%A IN ('dotnet lambda deploy-function MyLambda --profile default --region my-server-region --configuration Release --function-publish true') DO ( set result=%%%A )){
FOR ( /F "tokens=1,2,3,4,5,6 delims= " %%%A IN ('echo %%%result%%%') DO ( set result=%%%F )){
#echo on
echo %env.MyLambdaVersion%
#echo off
echo "##teamcity[setParameter name='env.MyLambdaVersion' value='%%result%%']"
}
}
I actually don't know what I do wrong, actually this script was written before I started to work on this project. Any advice or any link will be helpfull, thanks :)
EDIT
I expect this kind of respinse, where i can get MyLambda version
Succesfull build scrinshot1: https://i.stack.imgur.com/bOIGr.jpg
But instead of it I'm getting this result.
Invalid response
EDIT 2
Output of the script in text format
Step 17/36: Deploying new version of Lambda "MyLambda" (Command Line) (3m:16s)
[13:27:03][Step 17/36] Starting: C:\BuildAgent\temp\agentTmp\custom_script1964828788270486366.cmd
[13:27:03][Step 17/36] in directory: C:\BuildAgent\work\3f3a1ea85ff2ff09
[13:30:10][Step 17/36]
[13:30:11][Step 17/36] C:\BuildAgent\work\3f3a1ea85ff2ff09\Proj\Lambda\Proj.Lambda.MyLambda>echo
[13:30:12][Step 17/36] ECHO is on.
[13:30:16][Step 17/36] "
[13:30:16][Step 17/36] ##teamcity[setParameter name='env.MyLambdaVersion' value='function: ']
[13:30:16][Step 17/36] "
[13:30:20][Step 17/36] Process exited with code 0

How to generate test overview in Frisby

As mentioned in frisby official document (http://frisbyjs.com/) , I am using --junitreport something like following
jasmine-node ./demo/validation_spec.js/ --junitreport --output
C:\Users\Administrator\Documents\script/Reports
which is generating 15 xml files. As I am calling 15 time post using for loop. File contains data like following
<?xml version="1.0" encoding="UTF-8" ?>
<testsuites>
<testsuite name="Frisby Test:blank action " errors="0" tests="1" failures="0" time="0.284" timestamp="2017-03-21T13:55:15">
<testcase classname="Frisby Test: blank action " name="
[ POST https://localhost:8443/api/v2/settings/pointwise ]" time="0.282"></testcase>
</testsuite>
</testsuites>
so my difficulty is that I need to read each and every file to check if tests is pass or not. I want some kind of overview page like http://maven.apache.org/surefire/maven-surefire-report-plugin/surefire-report.html
which contain information how many test passed, fail etc. Is it possible to get that.

Error while using Matlab System commnad

i am extracting dense video feature. The problem i am facing is that when i run in linux terminal.
./release/DenseTrackStab /home/shashank/Documents/MATLAB/stip_fisher-master/UCF50/BaseballPitch/v_BaseballPitch_g08_c07.avi | tee > /home/shashank/Documents/MATLAB/stip_fisher-master/data/ucf-50/BaseballPitch/v_BaseballPitch_g08_c07.stip
it works perfectly fine .
when i do same in matlab using system command
>> system('./release/DenseTrackStab /home/shashank/Documents/MATLAB/stip_fisher-master/UCF50/BaseballPitch/v_BaseballPitch_g08_c07.avi | tee > /home/shashank/Documents/MATLAB/stip_fisher-master/data/ucf-50/BaseballPitch/v_BaseballPitch_g08_c07.stip')
the result i get is
Could not initialize capturing..
ans =
0
Why is this happing i am not able to understand.
I get same error and solved this problem by adding OpenCV include and library path before my command.
For example, in my case I did as follows:
system('PATH=/usr/include/opencv2/:$PATH LD_LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH /misc/lmbraid17/zolfagha/optical_flow/twinFlow /misc/lmbraid17/zolfagha/UCF50/BaseballPitch/v_BaseballPitch_g08_c07.avi -f 1 ...')
Best,

Nagios Custom Plug-in(https authentication) not working as expected

I am writing a plugin to check authentication to a https site and then search for a text in the response html,body to confirm successful login. I have created the following plugin
#!/bin/bash
add_uri='--no-check-certificate https://'
end_uri='/'
result=$(wget -O- $add_uri$1$end_uri --post-data=$2)
flag=`echo $result|awk '{print match($0,"QC Domain")}'`;
echo $flag
echo "Nagios refreshes properly1"
if [[ $flag -gt 0 ]] ; then
echo 'ALL SEEMS FINE!!'
exit 0
else
echo 'Some Problem'
exit 2
fi;
When I execute this plugin directly from command line
./check_nhttps <url here> '<very long post data with credential information>'
The plugin works as expected(For both + & - test cases) and there seems to be no issues.
But when the plugin runs from Nagios,
check_command check_nhttps! <url here> '<very long post data with credential information>'
It always shows critical error(Prints else condition text "Some Problem" too).
P.S : Tried sending the post data with double quotes also.
Please help!!!
I'd think its very probable that your post data contains some characters that confuse nagios, maybe a space, or even a !. Better put the post data into some file and use --post-file. Also, you might insert echo "$2" > /tmp/this_is_my_post_data_when_executed_by_nagios into your script and check if the post data is ok.