bazel - JUnit4Runner inside bazel could be use with junit `Category`? - bazel-java

Bazel has their JUnit4Runner in com.google.testing.junit package which seems to be based on junit4.
I tried to use Bazel JUnit4Runner with Categroy Annotation. But not worked for me.
And 1 seems to support testIncludeFilterRegexp but not junit's Categroy.
So does JUnit4Runner from Bazel not support Category?
I am not sure. any help would be appreciated.

When structuring TestSuite with Category, I had to use #RunWith(Categories::class)
Following code worked for me.
#RunWith(Categories::class)
#Suite.SuiteClasses(AllTests::class)
#Categories.IncludeCategory(EnormousTest::class)
class AllEnormousTests
#RunWith(ClasspathSuite::class)
class AllTests

Related

How can I parse info from kotlin docs to swagger-ui?

I need to parse kotlin docs (not swagger annotation) for swagger-ui.
I tried this, but it don't work.
Here my springdoc dependencies (springdocVersion = "1.6.6"). By the way, I can't use therapi version 0.13.0 if it's important.
runtimeOnly("org.springdoc:springdoc-openapi-kotlin:$springdocVersion")
implementation("org.springdoc:springdoc-openapi-ui:$springdocVersion")
implementation("org.springdoc:springdoc-openapi-webflux-ui:$springdocVersion")
implementation("org.springdoc:springdoc-openapi-javadoc:$springdocVersion")
annotationProcessor("com.github.therapi:therapi-runtime-javadoc-scribe:0.12.0")
implementation("com.github.therapi:therapi-runtime-javadoc:0.12.0")
After I replaced annotationProcessor("com.github.therapi:therapi-runtime-javadoc-scribe:0.12.0") with kapt("com.github.therapi:therapi-runtime-javadoc-scribe:0.12.0"), all worked well!
An example of the build file can be found here

Missing Template Arguments for pcl::gpu::EuclideanClusterExtraction in PCL-1.12

I am trying this example to use PCL with GPU and get the error
~/gpu-pcl/main.cpp:85: error: missing template arguments before ‘gec’
pcl::gpu::EuclideanClusterExtraction gec;
I have tried that example with pcl-1.11.1 and it worked well .But when updated to pcl-1.12.1, I get that error.
My work environment:
Ubuntu 18.04,
with Cmake version 3.20,
Is there anything that I have missed out??
In the documentation of pcl1.12:
template
class pcl::gpu::EuclideanClusterExtraction< PointT >
EuclideanClusterExtraction is a template class, thus the type of point of the point cloud is needed in the position of PointT, for example, PointXYZ.[https://pointclouds.org/documentation/classpcl_1_1gpu_1_1_euclidean_cluster_extraction.html#details]

Using sun.reflect package with openjdk11

Is there a way to use sun.reflect in OpenJDK11, by maybe adding something in "--add-exports"? Our code fails since a jide pkg internally uses sun.reflect package and I'm trying to see if there's a way to make it work.
I've already tried with the below but that doesn't help.
"--add-exports jdk.unsupported/sun.reflect=ALL-UNNAMED"
Here's the exception, where the underlying class references sun.reflect.Reflection
java.lang.NoClassDefFoundError: sun/reflect/Reflection
I had this problem and fixed it by using a newer version of jide. Changing from jide-whatever:3.2.3 to jide-whatever:3.7.6 was enough to make it work in my case.
If you cannot migrate to newer versions, the solution is to make a wrapper around Throwable().getStackTrace()[n].getClass() and put it in WEB-INF/classes folder
This is simple workaround. It works in many cases.
package sun.reflect;
public class Reflection {
public static Class<?> getCallerClass(int n){
StackTraceElement[] elements = new Throwable().getStackTrace();
return elements[n].getClass() ;
}
}
https://github.com/rafaljot/NoClassDefFoundError-sun-reflect-Reflection
It can be fixed when you update the version of the jars.

vstest.console.exe with ClassName as /testcasefilter

I am looking for executing the unit test by ClassName using vstes.console.exe, any help
I tried like
/TestCaseFilter:"ClassName=ProgressTests"
but that throws this error:
Error: No tests matched the filter because it contains one or more
properties that are not valid (ClassName). Specify filter expression
containing valid properties (TestCategory, Priority,
FullyQualifiedName, Name) and try again.
Thanks
You can run the tests by specifying the fully qualified class name:
vstest.console MyBusinessDomain.Tests.dll /testcasefilter:FullyQualifiedName~MyBusinessDomain.Tests.Shopping.Cart
where:
MyBusinessDomain.Tests.dll is the test dll
MyBusinessDomain.Tests.Shopping.Cart is the fully qualified class name
Or you can run the tests classes by namespace:
vstest.console MyBusinessDomain.Tests.dll /testcasefilter:FullyQualifiedName~MyBusinessDomain.Tests.Shopping
This command will run all the tests under MyBusinessDomain.Tests.Shopping namespace.
NOTE: FYI, vstest.console is newer than mstest and is preferred for running via the command line. It can be added to the environment path with this location(for VS2015) :
C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow
According to https://blogs.msdn.microsoft.com/vikramagrawal/2012/07/23/running-selective-unit-tests-in-vs-2012-rc-using-testcasefilter/ - "ClassName is only valid for unit tests for Windows store apps, currently not available for classic MSTest" although that blog post is from years ago now though.
You could just use the FullyQualifiedName filter type as in /testcasefilter:FullyQualifiedName~NameSpace.Class
The tilda ~ means "contains", so if Foobar is the name of your class:
vstest.console bin\Debug\MyTests.dll /TestCaseFilter:FullyQualifiedName~Foobar
See https://msdn.microsoft.com/en-us/library/jj155800.aspx

extra-paths not added to python path with zc.recipe.testrunner

I am trying to run tests by adding a version of tornado downloaded from github.com in the sys.path.
[tests]
recipe = zc.recipe.testrunner
extra-paths = ${buildout:directory}/parts/tornado/
defaults = ['--auto-color', '--auto-progress', '-v']
But when I run bin/tests I get the following error :
ImportError: No module named tornado
Am I not understanding how to use extra-paths ?
Martin
Have you tried looking into generated bin/tests script if it contains your path? It will tell definitely if your buildout.cfg is correct or not. Maybe problem is elsewhere. Because it seem that your code is ok.
If you happen to regularly include various branches from git/mercurial or elsewhere to buildout, you might be interested in mr.developer. mr.developer can download and add package to develop =. You wont need to set extra-path in every section.