Git Product home page Git Product logo

Comments (9)

bjhargrave avatar bjhargrave commented on June 12, 2024

There is nothing specific in osgi-test for code coverage. I assume you would need to use some existing test coverage tool like jacoco or something. @kriegfrj may be know more here.

As for interactive debugging, I use Bndtools which has a "Bnd OSGi Test Launcher" Run/Debug option which you can use on the bndrun files and then run/debug your tests.

image

from osgi-test.

catshow avatar catshow commented on June 12, 2024

Unfortunately bndtools is an eclipse only thing. I am currently running the debugger with this in my test-debug.bndrun file:

-include=./test.bndrun
-runjdb: 10001

then I have to fire up the remote JVM debugger in intellij. This is not a convenient workflow.

I think that what is needed is an implementation of a gradle TestFramework, that could be configured with a bndrun file.

I think this would also allow one to run a specific test method and not the entire test suite. Additionally, I believe it would solve the problem of having to create a whole separate integration project, because the TestFramework should receive the actual classes and methods that it needs to run.

Thanks for your consideration.

from osgi-test.

bjhargrave avatar bjhargrave commented on June 12, 2024

I think that what is needed is an implementation of a gradle TestFramework, that could be configured with a bndrun file.

Why not use the TestOSGi gradle task type? https://github.com/bndtools/bnd/tree/master/gradle-plugins#create-a-task-of-the-testosgi-type

As TestFramework is an internal Gradle type, I don't see Bnd Gradle plugins making use of it.

from osgi-test.

catshow avatar catshow commented on June 12, 2024

I do use the TestOSGi like this:

I have a separate debug task that use the -jdb, otherwise it will get hung up in CI builds.

val resolveTask = tasks.register<aQute.bnd.gradle.Resolve>("resolve") {
    dependsOn(tasks.compileTestJava)
    description = "Resolve test.bndrun"
    group = "test"
    bundles.from(configurations.testRuntimeClasspath)
    bndrun.set(file("test.bndrun"))
    outputBndrun.set(layout.buildDirectory.file("test.bndrun"))
}

val testOSGiTask = tasks.register<aQute.bnd.gradle.TestOSGi>("testOSGi") {
    dependsOn(resolveTask)

    description = "OSGi Test test.bndrun"
    group = "test"
    bndrun.set(resolveTask.flatMap { it.outputBndrun })
}

val debugResolveTask = tasks.register<aQute.bnd.gradle.Resolve>("debugResolve") {
    dependsOn(resolveTask)

    description = "Resolve test.bndrun"
    group = "test"
    bndrun.set(file("test-debug.bndrun"))
    outputBndrun.set(layout.buildDirectory.file("test-debug.bndrun"))
}

val debugTestOSGiTask = tasks.register<aQute.bnd.gradle.TestOSGi>("debugTestOSGi") {
    println("to find an existing java debug listening on a port use the following command")
    println("netstat -vanp tcp | grep 10001")

    dependsOn(debugResolveTask)

    // always run
    outputs.upToDateWhen { false }
    description = "OSGi Test test-debug.bndrun"
    group = "test"
    bndrun.set(debugResolveTask.flatMap { it.outputBndrun })
}

It is unfortunate that it is an internal type. :-(.

I guess I will look at maybe implementing an intellij plugin that can provide a junit platform launcher.

@bjhargrave is there a bnd gradle task that will generate a workspace, that will take a configuration. Also is there a way to specify a workspace within the bndrun file?

from osgi-test.

bjhargrave avatar bjhargrave commented on June 12, 2024

is there a bnd gradle task that will generate a workspace, that will take a configuration.

No.

Also is there a way to specify a workspace within the bndrun file?

Normally, in a non-Bnd workspace model build like gradle, there is no Bnd Workspace and the bndrun file will be provisioned with a "standalone" workspace. What do you need from a Bnd Workspace?

from osgi-test.

catshow avatar catshow commented on June 12, 2024

@bjhargrave

Also is there a way to specify a workspace within the bndrun file?

Normally, in a non-Bnd workspace model build like gradle, there is no Bnd Workspace and the bndrun file will be provisioned with a "standalone" workspace. What do you need from a Bnd Workspace?

I am trying to use eclipse, now. The right click run BND OSGi test launcher fails, because I don't have a workspace. I would like to generate one based on the gradle configurations, instead of manually building one.

from osgi-test.

bjhargrave avatar bjhargrave commented on June 12, 2024

So I imported the gradle example project in this repo into an Eclipse workspace and Bnd launcher fails. Bndtools need more work to support launching bndrun files in a plain gradle project. We did work for maven support in the Bndtools m2e feature. I guess we need to do similar work for gradle to integrate with Buildship. You can open an issue in the bndtools/bnd repo to note this missing support.

from osgi-test.

github-actions avatar github-actions commented on June 12, 2024

This issue has been automatically marked as stale because it has not had recent activity. Given the limited bandwidth of the team, it will be automatically closed if no further activity occurs. If you feel this is something you could contribute, please have a look at our Contributor Guide. Thank you for your contribution.

from osgi-test.

github-actions avatar github-actions commented on June 12, 2024

This issue has been automatically closed due to inactivity. If you can reproduce this or if you have a good use case for this feature, please feel free to reopen the issue with steps to reproduce, a quick explanation of your use case or a high-quality pull request.

from osgi-test.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.