unit testing for proprietary ide [closed] - java

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I would like to add some sort of unit testing to an IDE known as "IBS Integrator".
how the IDE works:
I write "java-ish" code in .itr files.
when I press the run button these files are compiled into .class and .java files.
I have no idea what happens next.
Does anyone have advise on how I could make unit testing work in a setup like this?
I was hopping for a framework like phpunit or rspec. I know they are for different langagues but a similar tool for java would be nice. I'm not sure what (if anything) can interact with .class/.java files.
I would prefer something open-source if possible.

Since IBS Integrator compiles to .class files, you should be able to write JUnit tests in Java against those classes, and run them however you'd normally run JUnit tests (kick off Ant or Maven, open Eclipse and run them from there, etc.). And I can't think of any reason to use another technology (phpunit, rspec, etc.) for writing tests of Java code; JUnit seems like the clear winner here.

Related

How can I make project in java [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 months ago.
Improve this question
We have to do java project like a management system and we have source code but the question is how to run it and where? anyone knows?
Queries
IDE
How to run it?
If you already have the source code,
Open a command prompt window then cd to the directory where you saved the java program.
For example, JavaProgram.java is in C:/
Type 'javac JavaProgram.java' and enter to compile your code.
Now type 'java JavaProgram' to run your program.
You will be able to see the result printed on the window.
Good luck :)
we have source code
You'll need to compile it.
Then you need to execute it. That could involve web containers with WAR or standalone, executable Java JARs, or directly execute a class file. Without seeing your code it's hard to answer that, but you wouldn't use an IDE to actually deploy/run your code outside of individual development.
You'll also need some server to run it on. That's not unique to Java.
Regarding the original question: "Make a project" - you could use Maven Archetypes or Spring and Quarkus have project starter websites, for example...

Is it possible to run a java program inside a Junit test? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Context:
My company has a tool written in Java, that is run on the command line interface. To run this tool on the command line:
gradle clean
gradle build
cd multiple times
unpack rar files
./run_tool.sh parameter1 parameter2 parameter3
My company also has an automation test codebase that consists of JUnit tests. I have to write an automated test that runs the tool.
I know it is possible to run a script inside a Java program. However, the examples I saw did not show how to run a script with parameters. Furthermore, the examples I saw were simple scripts, not full Java programs.
I do not know if what I am trying to do is even possible. Can anyone please suggest potential approaches?
If the tool is written in Java, it may make more sense to use its classes directly in JUnit tests. You'd have to publish the tool as JAR files in your corporate Maven repository (Nexus, Artifactory, etc), and hook it up in your tests as Maven/Gradle dependency.
Executing a shell command from Java is certainly possible, but it's much more complicated.

How to inject and run Scala code in a running JVM [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Is it possible to compile & run scala code dynamically within Java code.
It is possible to achieve a similar result with JS using mozilla rhino. But, I wonder if it is possible with scala?
Theoretically, yes. But you will need to do a lot of things:
ensure the user entered valid scala code
transfer that source code to the server
compile the scala code
run it from within your server (catch errors, deal with resource leaks, ...)
So, possible: yes. Reasonable: not so much.
Obviously: a lot of work
getting to a decent user experience: even more work (like: telling the user exactly where in his source code input your compilation step found a bug ... hard)
And of course: opens your system for a ton of attack vectors.
If you want your users to be able to run code on the backend server, one wonders: why don't they have admin access to that machine already, and are able to deploy there code right there on the server themselves?!
Sure, Scala has its REPL, and as that one comment pointing to an existing answer implies: it is definitely possible to do that.
But as said: we don't do things because we can, but because it makes sense doing it!
twitter util-eval library seems provide what I need, but it is discontinued.
Here is an old fork:
https://github.com/m3dev/twitter-util-eval

How to write Junit test case for old java project? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I am working on a very old application built using strut 1.1 in 2004. The complete application is made by combining three projects(common, web, and EJB) in Eclipse and all these three are packaged as.EAR file. So here the confusion where to fit the JUnit test cases for this type of structure.
Whether I should create a separate project for writing the test cases. If I create the separate project, I would add the above projects in the build path.
So what is the right way? Any suggestion would be appreciated.
Also, tell me about the way I can check the results on GUI that how many cases are passed and how many are failed.
First of all: in case you intend to write real JUnit unit tests for 14 year old code, the answer is: do not do that.
If at all, you should be using JUnit as environment to automate test case execution, which in this case should be "integration" or "functional" tests.
You see: the only reasonable argument to invest money in old, existing source code is: you intend to refactor/replace that solution with a new implementation. Then your one and only concern is that your new code behaves like the old one. From a functional point of view. It doesn't make sense to invest time/energy into unit testing units you intend to throw away soon.
Beyond that: do whatever works for you. Typically, it would be better to have a complete new project to avoid tampering anything existing.

When do we need to attach source to a jar [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
When do we need to attach source to a jar?
Can we debug without attaching the source code?
Can we see the stacktrace line numbers without the source (AFIAK we can't)?
What is the best practice for local builds? Do we need the source code?
What about CI?
Can we leave the source code only for production release?
Thanks,
Omer
It's good practice to also publish the sources jar along with your binary jar in your internal (or external) Maven repository. It makes life of the developer that is working with your code much easier since they can see your comments / browse the codebase and be able to have all that at debug time. Now as you are saying even if the sources jar is not published, developers have ways around it primarily relying on their IDE. In Eclipse for instance you can install the Java Decompile plugin that would give you access to the code during debug time or on IntelliJ there is something similar without the need of installing a plugin.

Categories

Resources