Page 1 of 1
JUnit 3 or 4?

Posted:
22 Jun 2011, 22:30
by Braids
Does anyone have a preference of using JUnit 3 over JUnit 4? I have to update the project's preferences to use one or the other.
Re: JUnit 3 or 4?

Posted:
22 Jun 2011, 23:11
by DennisBergkamp
Welcome!
I've never used either, so it's fine for me either way. 4 I guess (since it's newer, and maybe better?).
Re: JUnit 3 or 4?

Posted:
23 Jun 2011, 13:49
by Rob Cashwalker
What is it and what did we use it for previously?
Re: JUnit 3 or 4?

Posted:
23 Jun 2011, 14:17
by friarsol
Rob Cashwalker wrote:What is it and what did we use it for previously?
Java's standard Unit Testing, and we didn't use it at all before.
Braids, I'm sure using 4 should be just fine.
Re: JUnit 3 or 4?

Posted:
23 Jun 2011, 16:23
by Braids
thanks for the feed back. version 4 it is.
Re: JUnit 3 or 4?

Posted:
01 Jul 2011, 01:26
by Braids
it turns out the correct answer to this question is neither. Dave (jendave) strongly prefers TestNG over JUnit. i believe that at present, the maven build freaks out when it encounters something that needs JUnit.
Re: JUnit 3 or 4?

Posted:
13 Jul 2011, 14:07
by Braids
just another note about writing unit tests. some tests need to bootstrap most of the game in order to run. this includes constructing a { new CardFactory(ForgeProps.getFile(CARDSFOLDER)) } and calling { Gui_NewGame.loadDynamicGamedata() }. these operations can take a long time. on my least powerful computer, they take over 80 sec. during that time, it looks like TestNG is frozen. the problem is definitely not in TestNG, because i can run test/java/TinyTest.java very quickly.
Dave suggest that we need "mocks" and "dependency injectors" to make unit testing more feasible, and i agree. a mock is a simpler version of a class that that mimics some of its behaviors. a dependency injector is a means to tell the code to use a mock instead of the real thing. i suspect we'll be creating some alternative constructors for dependency injection; anything more fancy than that becomes difficult to understand.
earlier i was trying to avoid using a mock CardFactory by making CardFactory load its cards lazily. i will probably end up creating one that loads a few actual cards to avoid changing CardFactory.
anyway, this is the sort of thing i plan to be working on now. it will give me a better idea of how to set up the game state properly.