Gradle: using the TestReport task with different XML file - unit-testing

I have a gradle task that produces a test report as XML file.
build
└── test-results
   ├── test // result of the regular unit tests
   │   ├── TEST-SomeTest.xml
   │   └── binary
   │   ├── output.bin
   │   ├── output.bin.idx
  │   └── results.bin
  └── testCustom // result of my custom task
  └── TEST-my-lib-1.0.0.SNAPSHOT.xml
I would like to use the standard TestReport feature of gradle (test reporting) to generate an HTML report for my XML result.
def testCustom = tasks.register('testCustom') {
// This is producing the XML test result.
}
tasks.register('testCustomReport', TestReport) {
dependsOn testCustom
destinationDir = file("$buildDir/reports/tests/testCustom")
testResultDirs.from(file("$buildDir/test-results/testCustom/"))
}
tasks.named('check') {
dependsOn testCustom, testCustomReport
}
With this I get an empty reports/tests/testCustom folder:
build
└── reports
   └── tests
   ├── test
   │   ├── classes
   │   │   └── ... .html
   │   ├── css
   │   │   ├── base-style.css
   │   │   └── style.css
   │   ├── index.html
   │   ├── js
   │   │   └── report.js
   │   └── packages
   │   └── ... .html
   └── testCustom
I guess my custom TestReport task is wrongly configured.

I found the reason and a solution in others StackOverflow posts:
Gradle TestReport task seems to be dependent on the binary output files generated by "test" task
From source
So there is no way it will work with my XML created by my customTest task.
The alternative is to use the ant-junit library to create the report, and it works.

Related

i cannot properly link boost.JSON to my project using CMake

Tree level overview of my project:
├── build
│   ├── build.ninja
│   ├── CMakeCache.txt
│   ├── CMakeFiles
│   │   ├── 3.18.0-rc1
│   │   ├── cmake.check_cache
│   │   ├── CMakeError.log
│   │   ├── CMakeOutput.log
│   │   ├── CMakeTmp
│   │   ├── cmake.verify_globs
│   │   ├── hftbot.dir
│   │   ├── Makefile2
│   │   ├── progress.marks
│   │   ├── rules.ninja
│   │   ├── TargetDirectories.txt
│   │   └── VerifyGlobs.cmake
│   ├── cmake_install.cmake
│   ├── compile_commands.json
│   ├── details.json
│   ├── external
│   │   └── json
│   ├── hftbot
│   ├── Makefile
│   └── src
│   ├── CMakeFiles
│   ├── cmake_install.cmake
│   └── Makefile
├── build.sh
├── CMakeLists.txt
├── configure.sh
├── details.json
├── external
│   ├── asio
│   │   ├── CMakeLists.txt
│   │   ├── doc
│   │   ├── example
│   │   ├── include
│   │   ├── index.html
│   │   ├── meta
│   │   ├── test
│   │   └── tools
│   ├── CMakeLists.txt
│   └── json
│   ├── bench
│   ├── build
│   ├── CHANGELOG.md
│   ├── check
│   ├── cmake
│   ├── CMakeLists.txt
│   ├── CONTRIBUTING.md
│   ├── doc
│   ├── example
│   ├── fuzzing
│   ├── include
│   ├── index.html
│   ├── Jamfile
│   ├── LICENSE_1_0.txt
│   ├── meta
│   ├── README.md
│   ├── src
│   └── test
├── run.sh
└── src
├── CMakeLists.txt
├── httpClient.cpp
└── WebsocketClient.cpp
https://github.com/boostorg/json
i cloned this project to "external/json" directory from root directory.
I added following commands in CMakeLists.txt in the root directory
target_include_directories(${PROJECT_NAME} PUBLIC "external/json/include")
target_link_libraries(${PROJECT_NAME} PUBLIC boost_json)
And when i add this :
#include <boost/json.hpp>
#include <boost/json/src.hpp>
it says that source boost/json.hpp and boost/json/src.hpp is not found.

how to correctly write CmakeLists.txt for third-party library?

I am using CLion to write a Cmake project. here is the tree view of the directory(files are ignored),where lemon-1.3-1 is the third party library.
├── cmake-build-debug
│   ├── CMakeFiles
│   │   ├── 3.15.3
│   │   │   ├── CompilerIdC
│   │   │   │   └── tmp
│   │   │   └── CompilerIdCXX
│   │   │   └── tmp
│   │   ├── CheckTypeSize
│   │   ├── CMakeTmp
│   │   ├── graph_partition_essay.dir
│   │   └── Progress
│   └── lemon-1.3.1
│   ├── cmake
│   ├── CMakeFiles
│   │   ├── check.dir
│   │   └── dist.dir
│   └── lemon
│   └── CMakeFiles
│   └── lemon.dir
│   └── bits
└── lemon-1.3.1
├── cmake
│   └── nsis
├── contrib
├── demo
├── doc
│   ├── html
│   │   └── search
│   └── images
├── lemon
│   ├── bits
│   └── concepts
├── scripts
├── test
└── tools
Also I write the following CMakeLists.txt. Using this file, the auto code completion can function normally.
cmake_minimum_required(VERSION 3.15)
project(graph_partition_essay)
set (LEMON_INCLUDE_PATH ${CMAKE_SOURCE_DIR}/lemon-1.3.1)
add_subdirectory(lemon-1.3.1)
add_executable(graph_partition_essay main.cpp)
and the main.cpp
#include <iostream>
#include "lemon-1.3.1/lemon/list_graph.h"
using namespace lemon;
int main() {
ListDigraph g;
std::cout << "Hello, World!" << std::endl;
return 0;
}
But when I run the main function, I got the following error message.
In file included from F:\xxx\graph_partition_essay\main.cpp:2:
F:\xxx\graph_partition_essay\lemon-1.3.1/lemon/list_graph.h:26:10: fatal error: lemon/core.h: No such file or directory
26 | #include <lemon/core.h>
| ^~~~~~~~~~~~~~
compilation terminated.
How can I fix this problem?

Chef::Exceptions::FileNotFound: template[/var/www/html/index.html]

I am new to the chef I could not understand what is an issue. Following is my default script
apt_update 'Update the apt cache daily' do
frequency 86_400
action :periodic
end
package 'apache2'
service 'apache2' do
supports status: true
action [:enable, :start]
end
template '/var/www/html/index.html' do
source 'index.html.erb'
end
this is the error I am getting
[2020-04-25T12:57:00+00:00] FATAL: Stacktrace dumped to /home/vagrant/.chef/local-mode-cache/cache/chef-stacktrace.out
[2020-04-25T12:57:00+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
[2020-04-25T12:57:00+00:00] FATAL: Chef::Exceptions::FileNotFound: template[/var/www/html/index.html] (learn_chef_apache2::default line 18) had an error: Chef::Exceptions::FileNotFound: Cookbook 'learn_chef_apache2' (0.1.0) does not contain a file at any of these locations:
templates/host-vagrant.vm/index.html.erb
templates/ubuntu-18.04/index.html.erb
templates/ubuntu/index.html.erb
templates/default/index.html.erb
templates/index.html.erb
and this is my cookbooks tree
cookbooks
├── learn_chef_apache2
│   ├── Berksfile
│   ├── CHANGELOG.md
│   ├── chefignore
│   ├── LICENSE
│   ├── metadata.rb
│   ├── README.md
│   ├── recipes
│   │   └── default.rb
│   ├── spec
│   │   ├── spec_helper.rb
│   │   └── unit
│   │   └── recipes
│   │   └── default_spec.rb
│   └── test
│   └── integration
│   └── default
│   └── default_test.rb
├── learn_chef_appache2
│   └── templates
│   ├── default
│   └── index.html.erb
└── templates
└── index.html.erb
Can someone please help me what wrong I am doing and it will be great if you can share a link or explain it for my understanding.
what I did wrong was my template was created outside learn_chef_apache2 whereas it should be inside as follwing
cookbooks
└── learn_chef_apache2
├── Berksfile
├── CHANGELOG.md
├── chefignore
├── index.html.erb
├── LICENSE
├── metadata.rb
├── README.md
├── recipes
│   └── default.rb
├── spec
│   ├── spec_helper.rb
│   └── unit
│   └── recipes
│   └── default_spec.rb
├── templates
│   └── index.html.erb
└── test
└── integration
└── default
└── default_test.rb

match everything besides one folder - regex

I'm trying to exclude files form being watched besides folder app in watchOptions in ESLint.
My folder structure looks like:
├── assets
│   ├── assets
│   │   └── fonts
│   │   ├── FeatherIcons
│   │   ├── Icomoon
│   │   └── Montserrat
│   ├── images
│   ├── imagesNotOptimized
│   ├── js
│   │   ├── app
│   │   │   ├── api
│   │   │   │   ├── erpFlex
I would like to include all the files inside app but ignore all other files.
config.watchOptions = {
poll: true,
ignored: [
path.resolve(__dirname, 'node_modules'),
path.resolve(__dirname, 'assets/js/*!(app)'),
]
};
I have tried the following regexes
assets/js/*(!app)
assets/js/(?!app)
Nothing seems to work. Any help would be much appreciated. Thank you
EDIT
I have been able to match the string using the following regex: https://regex101.com/r/hs4lOt/1
but path.resolve(__dirname, 'assets/js/(?!app).*') is not working which makes this question not about regex but why ignored is not working in watchOptions

How I could include external lib in my custom opencart extension?

I'm building a custom opencart payment extension (ocmod installable), I need to use an external payment provider sdk (located in the vendor folder) but i don't know how include this files on my packaged extension
This is my folder structure
..
├── install.xml
└── upload
├── admin
├── catalog
├── composer.json
├── image
└── vendor
To develop a payment extention for opencart, follow this structure
admin
│   ├── controller
│   │   ├── payment
│   │   │   ├── custom_payment.php
language
│   │   └── en-GB
│   │   ├── payment
│   │   │   ├── custom_payment.php
template
├── payment
│   ├── custom_payment.tpl
catalog/
├── controller
│   ├── payment
│   │   ├── custom_payment.php
├── language
│   └── en-GB
│   ├── payment
│   │   ├── custom_payment.php
├── model
│   ├── payment
│   │   ├── custom_payment.php
└── view
└── theme
├── default / your_theme
│   └── template
├── payment
│   ├── custom_payment.tpl