Intelliji IDEA cannot run single test unless all tests are built successfully - java

Using Intelliji Community Edition 2022.03 on windows 11, working with Maven 3.6.3 and Java-8.
Been experiencing strange issue: I cannot run single Junit||Blueprint test if that test has problem, the IDE always try to build the whole test file and then failed at that single problematic test. So the situation end up being I have to run all the test successfully in order to run single test. I am sure it is related to my local environment, because my colleges have no such problem we have everything the same. and I also have no such problem in linux VM.
I have tried
install unintall different versions of IDE
Modify test to not build before run, works, but if I change code, no auto detection, so barely
Any wise men got some ideas please ?

Related

Unexpected Format on output of Cucumber HTML Report

Using: Java, IntelliJ Community Edition, Azure DevOps, Ubuntu agent
Goal: To see accurate charted results of tests run either automatically when a pipeline is triggered, manually, or locally if a test is run locally in IDE
Steps so far:
tried in-built vs test as there was tons of documentation on it but it seems that's only for windows agents (and possibly only .net?) neither of which is an option. Link1. Link2.
installed cucumber-html-report app to azure devops
added cucumber dependencies to pom.xml and added the following code main runner
#CucumberOptions(features="classpath:LoginTest.feature", plugin={"pretty", "html:target/cucumber-html-report", "json:target/cucumber.json", "junit:target/cucumber.xml", "rerun:target/rerun.txt"})
tests run and output but when you open the file, there's no formatting (just raw js, html, etc)
I've spent so long on what seems like such a simple task. I suspect it's at least in part due to the fact that I'm still familiarising myself with Cucumber and Azure DevOps so I'm hoping someone will see something I've missed. At this point I've thrown everything I could find on Google at it and nothing has worked successfully. Any and all help is very much appreciated
I got the answer. It was this section:
"html:target/cucumber-html-report",
It was missing the .html at the end which is why I seemed to be following the instructions, getting some output, but not producing the expected result

IntelliJ - How to run current program regardless of errors in unrelative files

I am start learning Scala, I am using
Java 7 and
IntelliJ IDEA 2016.1.4
Build #IC-145.2070, built on August 2, 2016
JRE: 1.8.0_77-b03 x86 JVM: Java HotSpot(TM) Server VM by Oracle Corporation
I got some sample code programs online and trying to run one by one.
But not working, while I try to run, it showing errors in other files but there is no relationship with them, all most all are independent Scala classes only.
IntelliJ Idea, run code regardless of errors in unrelated project files
I followed this similar issue, but I am not able to find options they suggested. like "Make before launch" and other might be very old post.
The option is still there, you just need to look for it in your run configuration window.
As you can see in the below GIF, when you create a run configuration it will implicitly run make before running, and initially it will fail.
The, you edit the run configuration and replace make with make, no error check. If you get a ClassNotFoundException when launching it right after, just re-run it again. I haven't figured out why this happens, it's probably related to how IJ cleans and compiles the classes in this particular case.

IDEA Play 2.4 junit test without full sbt build

I want to run JUnit tests for my Play 2.4 application within Intellij IDEA 14.1.4 to leverage full JUnit integration.
The tests are executed fine when I create a new JUnit run configuration. However on every test run a full SBT build is executed delaying the tests for around 30 seconds.
If I remove Make form the pre-launch steps in the JUnit run configuration the tests are executed directly without a full sbt build but then any code changes in test and application code are not picked up by IDEA. Even when the play is running with auto-compile on file changes IDEA doesn't pick them up for the tests.
Edit 07/09/2015
I've also exchanged Make with an SBT Action test:compile which only opens up a SBT console loading the project and stops with a prompt. It's not executing the action test:compile and therefore not starting the test at all.
What do I have to change in run configuration and/or project settings to get a fast and seamless JUnit integration for Play projects in IDEA?
Finally found the answer myself when digging through issue tickets of idea-sbt-plugin.
Exchanging Pre launch Step Make with SBT Action test:compile was the right way to go. However the SBT Plugin expects the default sbt shellPromt >. Play projects however define their own custom promt as [projectname] $.
I had to add the following line to build.sbt to get the SBT action to work.
shellPrompt := (_ => "> ")

'Class not found' when running JUnit test

I've got a project setup in IntelliJ 13.1.4 which always worked fine (including tests), but suddenly I can't run tests anymore. No project settings have been changed since last tests ran, no additional tests have been added, all references in the tests work, the rest of the project runs fine and all tests compile successfully. I am kind of dry on ideas what the issue might be.
Class not found: "models.utils.ArrangementModelTest"
EDIT
I tried a checkout of an older version of which I am sure the tests worked (since I just committed a new test). But that version also doesn't work anymore :S
In the end the issue was fixed by a couple of steps:
Exit Intellij
Delete .IntelliJIdea13 and .IdealC13
I am using typesafe activator, run activator clean on project level
Delete intellij related files in project
Run activator idea on project level
Start IntelliJ
Re-install plugins, setup project, enz.
The culprit seemed to be the Play 2.0 plugin for IntelliJ
Try rebuilding the project and in eclipse i know, "clean project" it should help.

What's the fastest way to get all build errors in a Java project?

Currently I'm looking at integrating some build processes into my source control (Git hooks specifically). I'm trying to write a pre-commit hook that checks for build errors in my Java project (a medium-large test development project) and fails to allow commits that contain errors in the build. This is turning out to be rather challenging.
The approach here uses a command-line Eclipse tool to build and output warnings and errors. This does technically work, but it's slow and may cause problems with the Eclipse IDE (I've already had heap allocation errors). I've also looked at solutions using ant but these approaches don't seem to be a simple one-line solution, and may still be slow.
My main question: what's the fastest (run-time compilation speed) way to build and validate a Java project, by command line? I'd like a solution that returns 0 with no errors and something else if errors are present, but I'm willing to look at other things.
Let's start with some basics:
pre-commit hooks run on the server and not the client. There is no working directory by default. You have to make sure that javac is available, and is the correct version.
Your pre-commit hook will freeze up the user's terminal until completion.
Now, how long will it take to checkout a fresh copy of your Java project, run Ant, wait for it to compile, and then process the output of the compile? a minute or two? 20 seconds? 10 seconds? Even 10 seconds will feel like forever as you wait for the Git push to complete. And, if other users want to commit code, they have to also wait.
A better, and easier approach is to use a Continuous Build Server like Jenkins. Jenkins is easy to setup. (It comes with its own application server built in) and has hundreds of plugins that you can use to help report the health of your project. If a compile cannot happen, Jenkins will email the culprit and whomever else you mention.
We have our Jenkins setup to do Ant builds, Maven builds, and use either Git or Subversion as our repository (depending upon the project). Jenkins builds the project, keeps the console log, and will fail the build if build.xml fails. At our place, this means I start pestering the developer to fix the problem or to undo their changes. At my last workplace, developers were given 10 minutes to fix the build, or I would undo their changes.
Not only can Jenkins let you know when a build fails, but has plugins that can report on the Java compiler warnings, Javadoc warnings, run Findbugs, PMD, find duplicate lines of code (via CPD that comes with PMD), and then report everything in a series of graphs. You can also mark builds as unstable (build completes, but is problematic) or simply fail the build based upon the number of issues found with these tools.
Jenkins can also run Unit tests, and again graph the results, then run coverage analysis with JaCoCo or Cobertura or Emma.
So, take a look at Jenkins. It's easy to setup and will do exactly what you want and more.
Ant. There isn't going to be a "one-line-solution". Write an ANT script that compiles the code, and fails if there are any errors. It's not easy, but it's the best option.
Out of the choices you mention, Ant is the best. But let's face it, writing XML sucks. My guess is that any build tool will fail and return an error code when compilation fails. My favorite is sbt, but there's a bit of a learning curve if you aren't into Scala (and even those in Scala like to complain about sbt). Another great option IMO is Gradle. You write your scripts in Groovy which is a dynamically-typed superset of Java.
Jenkins may be a something you could look at

Categories