How to use AceUnit? - java

I want to use AceUnit framework for unit test modules. In order to use this framework I have downloaded AceUnit source aceunit-0.3.2-src.tar but found No generator AceUnit.jar in /src/java. So, I used independently downloaded AceUnit-0.12.0.jar to make it work.
To test the framework I executed the example sortTest but Test Program crashed due to segmentation fault.
Is there anybody who have used it already or help me to guide further?

here is a bit of information that hopefully solves the issues for you.
It is normal that the source code does not contain any binaries. You can build the binaries, including the AceUnit.jar, from the source code.
aceunit-0.3.2 is unsupported because it is an old version. Please use the latest version.
Also, the version needs to be consistent. The generator of AceUnit-0.12.0 will not work with aceunit-0.3.2. Please consistently use the same version, i.e. 0.12.0.
For error reports, please include detailed information: What OS do you use, what compiler do you use etc.. Also, a paste of the terminal window contents or log is useful. That can reduce the number of loops we have to take in order to solve your problem.
I hope this helps and after updating you can run the demos and tests. If you still can't, please provide information like OS, compiler and contents of the terminal window.
The very latest version of AceUnit is currently hosted on Github: https://github.com/christianhujer/aceunit it has more features and should be more convenient to use, although support for some exotic compilers like C51, C251, C166 is currently not tested. But it should work perfectly well with GCC, armcc and clang. Practically, there's currently a segfault on clang which will probably be removed by next week.

Related

Can I force my java program to specifically execute using the jdk instead of the jre?

I've been looking around for an answer to this but haven't had much luck.
I've been working on a game in java that uses the javax.util.JavaCompiler class. I've discovered that this does not work with the JRE as I'll get a Null Pointer exception when I call the compiler run method (I'm assuming they simply don't ship a compiler with the JRE which is totally understandable).
My problem now is that my game inherently is dependent on the JDK. Is it possible to force my game to somehow search for the system environment variables and rather execute itself using the jdk?
I've tried using a separate launcher that then searches for the jdk and executes the game through that but that feels messy and I'm concerned there could be factors I'm missing.
It is technically possible, but it would make your application slow to start up to go an exhaustive search. AFAIK, there is no supported way to do this.
It is up to the user to choose how he / she runs a Java application. Doing clever things like searching for a JDK installation is potentially dangerous. (You could end up choosing an old insecure JDK that the user doesn't know about, or that they forgot to uninstall. That could open up the user to security breaches, etcetera.)
I would advise limiting yourself to a friendly message to the user explaining that they need to install and/or use a JDK.
You have the following options:
Check for the existence of that class during startup of your application; and if not found give your user a clear error message that he needs to run with a JDK (you would also specify that somehow as "prerequesites" on the site where people download your application).
Step back and carefully analyse which classes exactly your solution depends upon. And then you either repackage exactly those classes; or maybe you simply ship the corresponding JAR file with your application.
You see, asking your users to install a JDK is a big burden for them. Even when you are talking about some "inter-company" product where people have to use it ... few people are willing to install a JDK. And you absolutely should not expect that many users have a JDK installed.
On the other hand, when you consider re-packaging that stuff; you also have to look into the legal aspects; you don't want to violate any licence rules by simply handing out JDK related JARs to your customers.
You can simply put a try/catch block for the NPE around your use of the compiler API, and, in the event of the error, inform the user in no uncertain terms of the requirement.
Or, you can use asm or some other code generator package to avoid the need for the compiler.
Well I found the solution to the problem. Thank you to everyone who said I should package my game with a compiler. I found this post where the author describes rather using the eclipse compiler. Apparently javax.tools.JavaCompiler is just a common interface provided, I really should learnt the API in more detail.
You don't need to run your app with JDK. You can still run it with JRE. All you need to do is to make sure that a jar (from JDK or from anywhere else) that contains needed classes for your app is in your classpath. You can achieve it by including needed JAR(s) into your installation or by including the path to needed jars in your classpath parameter (-cp) when you run your app. If you want your app to run on computer where only JRE is installed you will have to include needed JAR(s) into your installation. think of it as any other third party library that you use and thus you have to package those libraries JARs into your application JAR/WAR

IDEA - Custom Errors

While working on my code I was reminded of just how much IDEA does for me. This gave me the idea, what if I could add some custom compile time processing. In which, if my code is invalid it will prompt me with an error. Say for example I left a return type as a null when it should never be null. Basically framework and API checks to reduce production errors.
The problem is I have no clue where to start on doing this. I assume I need to develop a plugin but am having issues finding documentation. If someone would be so kind as to help me get started. As well maybe even provide links to example projects or existing projects (github if possible).
As well I plan to release this plugin as part of a few APIs I develop. So helping me will help others in the long run :)
You can create an intellij plugin that implements custom inspections.
Example here:
https://confluence.jetbrains.com/display/IDEADEV/Inspection+of+Code+Source
The inspections that you create can highlight code red, allow the user to disable them, and also prompt for fixes. Please see intellij plugin development API's for more details.
You can use standard java assertions for this:
https://docs.oracle.com/javase/8/docs/technotes/guides/language/assert.html

Is there an open source plugin to mark issue in JIRA based on Findbugs Report?

I am looking for a tool/plugin for JIRA/Eclipse that can,
Execute FindBugs over the code.
Based on generated report, provide a UI to mark bug or improvement in JIRA depending on the case. Note that the text should be copied directly from report to marked issue in JIRA.
Looked around on internet but could not find one. Please suggest if such a requirement is fulfilled by any other tool like PMD, etc.
Other answers have suggested that you should create a single task to deal with fixing FindBugs warnings. I'm not even sure that you should do that. The problems identified by FindBugs might not even be problems, and even if they are problems, might have little to no impact on the quality of the system under development. They really should be reviewed by a human instead of blindly added to a bug tracker as something to fix.
My suggestion would be to incorporate FindBugs (and any other static analysis tools) into your build process as well as your code review process. As part of your build process, it would generate reports after every build. As developers work on modules, they would be able to consult the FindBugs reports for those modules and address them as-needed. As part of the code review process, a developer (either the author or a reviewer) can manually launch FindBugs over the code under review, analyze the reports, and include specific issues as action items to handle coming out of the code review using your team's methodology.
That said, if you are using FindBugs 2.0, there appears to be a JIRA plugin to facilitate what you want to do. It appears to have limited support and must be built from source, but it might be something to look at. As I mentioned above, though, I wouldn't recommend it.
Does this really make sense? I mean, creating one JIRA issue for every FindBugs marker will take more time as fixing it immediately in most cases. Not to mention the huge amount of issues in which this will result. The developer will have to spend more time in closing JIRA issues than in fixing them.
I would create exactly one issue for this: "Fix FindBugs warnings before release".
I think I'd use one JIRA Task that says:
"Run FindBugs. Record the report somewhere. Fix the most obvious problems. Run FindBugs again and record the final report." That way everyone can see that work was done, and what work it was.
Storing information about each problem found by FindBugs in a JIRA issue would lead to a large number of issues, and many of them would quickly become outdated.
For the first part you can write a script in any language (I would have used python) to Execute FindBugs and manipulate the generated report in any way you wish and than implement the secod part by using the Jira remote API to create issues or a single issue as others suggested. To pick an API most suited check the manual for your Jira's version to see the full API capabilities.

Test suite control repositories and change

I'm trying to find some java code with it's test suites, which includes all changes happen to test cases overtime(adding updating and deleting) after updating the code. Where do you think I could find this kind of repository that track changes to the source code and it's test cases over time.
Thanks in advance folks.
It is best to divide your needs into separate categories, and then find tools that cover the category.
I'm trying to find some java code with it's test suites, which includes all changes happen
to test cases overtime(adding updating and deleting) after updating the code.
A source code control system tracks changes to all revisioned files over time. There are many different source code control systems, but if you are starting out in source code control the documentation is more important than the specific system. I suggest subversion, which has excellent documentation here.
Under such a system, source code is checked in, which allows tracking of changes over time. Typically test cases are also checked in (usually in a different directory) and changes in test cases are also tracked over time.
Subversion is not the only solution, almost any source code control system will do this task. I recommend subversion because you are likely to see it again, it has excellent documentation, and some of the most advertised features of other systems are not understood until some mastery of source code control is obtained.
The actual source code is another matter. I think you want to write your own, but if you are looking for someone else's source code, there are many projects at apache.org or sourceforge which give some examples of how other people solved their problems using a source code control system.
Where do you think I could find this kind of repository that track changes to the source
code and it's test cases over time.
You can find subversion at http://subversion.apache.org/, and if you don't want to install your own private subversion server, you can find hosting providers which will install and run your subversion server (for a fee). I recommend you install your own server at least once, and to start I would also recommend the svnserve version of the server. After you get a feel for how source code control works under subversion, you might consider a https installation.

Which javac compiler settings would you expect as default when using an open source library?

I have recently had feedback about my open source library jOOQ's binaries not being delivered with debug information. That was good feedback. I never noticed this, because I never debugged the binaries when running integration tests.
This incident led me to an interesting question:
Which javac compiler settings and options would you choose / expect as default when using an open source library?
Note:
I'm using ant to build, so please refer to the ant javac task API.
I know how the options work. No need to explain me. I'm curious about which ones to choose.
The source is available to my users, and the deliverable can easily be rebuilt, so the user can change their settings if they need to optimise for a special case.
EDIT: I especially appreciate concrete answers referencing concrete options. I know that good work is expected :-)
Enable as much debug info as you possibly can, do not obfuscate, and have a source download corresponding to your binary.
Essentially you should give the best possible conditions for single-stepping through your code in case of problems. A developer may have to identify failing conditions to avoid triggering some code or similar, and in that situation you need all the help you can get.
Well, if one of your library's users encounters a problem, would you prefer a bug report with a stacktrace with line numbers or without? I know which one i would prefer.
I've used lots of java libraries, mainly open source, but a few closed as well. about the only libraries which don't include debug info are the closed source libraries which have been run through an obfuscator.

Categories

Resources