-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add support for NetBeans projects with existing source code #7
Comments
This is already on my todo-list, since it would be very useful eg. for CMake based projects. Unfortunately I have to figure out how this works first. I'll post an update if there's something new. |
I figured out how to enable it:
The make targets are difficult to add through code, since they may conflict with the user defined or generated; eg. I was able to get both working - Test button and result output - using a Cmake based project. The (modified) plugin ensured (1) while I had to manually fix (2). I'll provide a appropriate dev-version of the plugin for testing. |
project settings; if there's none it is created (issue #7).
Finally here's a updated build _for testing_, which addresses this issue: Sha 256: You can also check the WarningThis updated plugin is for testing only since it will modify the configuration of the NB project. Do NOT use it for projects which your live belongs to or are otherwise important. Best make a Backup of What's newThe new file wizard ( You should get a Test Files Folder after adding a new Unit Test File through the wizard. There's no new directory created at filelevel btw. - only the configurations.xml is updated. Projects requirementsExisting projects are required to have these two Maketargets:
Both (Maketargets and Test folder) together should enable the Test-Button and Result window. Again, please keep in mind: The version linked above is for testing purposes only. Please report any issues. |
@bitrunner any news on this? |
wizards (#7). The option is default Off; if selected it will add the test file folder (enables testing) – doing this more than once has no effect.
I have merged this into the development branch. There's also an UI option in the wizards now. |
Btw. CMake may require an |
Support for existing projects is added into v0.7.3. I have just released that version, so it's already available through the Plugins Portal. After verification (usually some days) it'll be available a through the updater too. |
Offa, Thank you for working on this feature. I finally had a chance to try it. Unfortunately, I've found it to still be completely useless. The first reason is the build target requirements. I'm using the waf build system (http://waf.io) which is written in python. The requirement that there must be a "build-tests" target is impossible to accommodate as python, like many other languages, doesn't allow hyphens in function names and build targets map directly to function names in waf. I figure this is a limitation of netbeans core or CND and as such I'm not sure if the NBCndUnit plugin can do anything about it, but it would be nice if I could configure the required build targets in my netbeans project properties similar to how the build and clean commands are currently. Also, I find it very awkward to go to the "new file wizard" to add the unit test capability to my project especially because I've already got dozens of unit test files and I don't want to add another one, I just want the unit test feature in netbeans to work. This is a one time requirement. It could be button somewhere in project properties that gets hidden in the event that it's already done. Another thing I noticed is that the "Test" right click context menu item for existing unit test files and new ones added through the wizard is still missing. Perhaps this is due to my project missing the build-tests target, I'm not sure. I don't know how it detects which files are actually unit tests. If that's based on what directory files are in on the file system, it would be nice if this was also configurable in the project properties somewhere. Anyhow, thanks again for making this plugin and working on my bug report. Cheers, -----Original Message----- Support for existing projects is added into v0.7.3. I have just released that version, so it's already available through the Plugins Portal. After verification (usually some days) it'll be available a through the updater too. |
I know, the solution is far away from being perfect. Unfortunately the project requirements – like make targets and test folder – are coded deep into the cnd module. Changing this would require a rewrite of basic Cnd Testrunner parts. I agree, more control of how testing is done, would be really nice. This could also make the ugly cmake workaround unnecessary. But that's far away from the current api's capabilities. Using the new file wizard is a workaround to this issue. Btw. you dont have to keep the newly created file. The best way to handle this is automatically by the new project wizard, but that's another thing.
Have you created a "New Test Folder" within "Test Files"? Netbeans doesn't detect what's a unit test, it just takes the source files of each "test folder" and compiles it into an executable. These test folders aren't filesystem based, they are just created within the projects configuration (in a xml file). Compilation / execution is done through the two defined make targets. At the moment the things this plugin can do are very limited. Basically it parses the output of the unit tests and displays the results into netbeans (plus some new file wizards). For default project the test handling works fine, since every aspect is handled by netbeans. Working with custom projects, the situation is more complex indeed … |
Yeah, makes sense. I'll take a look if there's better way to do this then the current one. |
I see what you're saying about NB native projects vs. not. I appreciate this plugin and thank you for the time you've taken address the existing projects feature request and responding to my dopey e-mail. This plugin is definitely a step in the right direction. I was able to get my waf based build project to work by making a really basic makefile that NB uses to invoke my real build system. In so doing, the makefile provides the build-tests target and it works. I noticed a few things now that it actually works:
I'd say that last item has significant value added so that may be the only thing worth addressing at this point, if possible. It sounds like we need to petition the CND developers to improve the core C++ unit test support in NB. Thanks again! Cheers, -----Original Message----- I know, the solution is far away from being perfect. Unfortunately the project requirements – like make targets and test folder – are coded deep into the cnd module. Changing this would require a rewrite of basic Cnd Testrunner parts. Another thing I noticed is that the "Test" right click context menu item for existing unit test files and new ones added through the wizard is still missing. Perhaps this is due to my project missing the build-tests target, I'm not sure. I don't know how it detects which files are actually unit tests. If that's based on what directory files are in on the file system, it would be nice if this was also configurable in the project properties somewhere. Have you created a "New Test Folder" within "Test Files"? Netbeans doesn't detect what's a unit test, it just takes the source files of each "test folder" and compiles it into an executable. These test folders aren't filesystem based, they are just created within the projects configuration (in a xml file). Compilation / execution is done through the two defined make targets. |
Nice to hear, thanks! 😄 Getting such helpful feedback is really great!
Test Folder (should) provide a way to run at least a group of tests (= all within) so you don't have to run all tests of the project. I'll have a look at this.
Hmm, this shouldn't happen … I'm using coloured Gtest output too and that's working. But maybe the colour escape sequences differ between systems. Do you have any additional parameters added to gtest? What OS are you using?
I'll check this.
True! 👍 |
This plugin doesn't currently work with NetBeans projects that are created from existing source code.
Steps to reproduce:
It would be great if the plugin could be taught how to work with unit tests in these kinds of NetBeans projects through manual configuration of project settings.
The text was updated successfully, but these errors were encountered: