Neil
Neil

Reputation: 1

Junit cannot read the updated code

i'm having a trouble with Junit where when I run my test case after changing something in the code, junit does not read through the updated code but instead reads from the original code. For eg: if I change a parameter from "xxx" to "yyy", Junit is going to run with "xxx" as parameter even after i save it with "yyy".

One solution I found to it was to go to the pom.xml file and remove all the dependencies, do the maven update, let the error show up and then put back the dependencies back in and then by saving it. I'm not sure why is this happening, if its Junit or Maven I'm having trouble with.

Anyone know anything about this????

Upvotes: 0

Views: 4325

Answers (2)

Neil
Neil

Reputation: 1

Finally after a very long process of finding the error I was able to make it work. The problem that I had was that I had cyclic maven dependency in the pom file and also I had build path as a dependency too besides the maven depeendency. I had to remove the eclipse dependency and update the cyclic dependency along with correct artifact id name and it worked.

Upvotes: 0

Luke SpringWalker
Luke SpringWalker

Reputation: 1592

Assuming that you are using Eclipse, try this:

1 - Right click the src/test/java folder in the Package Explorer

2 - Select Build Path -> Configure Output Folder

3 - Enter target/test-classes, click OK

If no luck, check this answer: Eclipse/Maven: JUnit tests not compiled when running them

Upvotes: 3

Related Questions