When I was doing unit tests with JUnit, I suddenly got an initializationError with a method that worked normally until the day before. The following is a memorandum of background and solution.
When I run a JUnit test using Eclipse, some test methods get an initializationError. It was working normally until the day before.
--Java: Version 1.8.0 --Junit: Version 4.12.0
To check if there are any omissions in the coverage of additional development content Revert to pre-development commit and test. After that, when I changed to the latest commit and performed the test, an initialization Error like the above capture occurred. ・ ・ Because the development deadline was just around the corner, my head went blank.
After investigating, it seems that it happens when the method with @Test is called in the test method. There is no such place this time.
Reference: [A story that I was addicted to when I got an Initialization Error in JUnit | Isn't it okay for an individual? A memorandum for resident freelance SE](https://freitech.xsrv.jp/hobby/2018/04/07/post-177 /)
As a result of various checks, I found that initializationError occurs only in the newly added test method. That means ... I arrived at the cause safely.
The cause is ... Commit before development → You did not build / deploy after returning to the latest commit. </ b> It's a so-called ordinary mistake. .. After that, it was solved successfully by executing build and deploy.
Don't forget to build and deploy if you change branches or reset commits.
Recommended Posts