It is currently 12 Sep 2025, 08:35
   
Text Size

JUnit 3 or 4?

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

JUnit 3 or 4?

Postby Braids » 22 Jun 2011, 22:30

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.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. ;)
User avatar
Braids
Programmer
 
Posts: 556
Joined: 22 Jun 2011, 00:39
Location: Unknown. Hobby: Driving myself and others to constructive madness.
Has thanked: 1 time
Been thanked: 1 time

Re: JUnit 3 or 4?

Postby DennisBergkamp » 22 Jun 2011, 23:11

Welcome!
I've never used either, so it's fine for me either way. 4 I guess (since it's newer, and maybe better?).
User avatar
DennisBergkamp
AI Programmer
 
Posts: 2602
Joined: 09 Sep 2008, 15:46
Has thanked: 0 time
Been thanked: 0 time

Re: JUnit 3 or 4?

Postby Rob Cashwalker » 23 Jun 2011, 13:49

What is it and what did we use it for previously?
The Force will be with you, Always.
User avatar
Rob Cashwalker
Programmer
 
Posts: 2167
Joined: 09 Sep 2008, 15:09
Location: New York
Has thanked: 5 times
Been thanked: 40 times

Re: JUnit 3 or 4?

Postby friarsol » 23 Jun 2011, 14:17

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.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: JUnit 3 or 4?

Postby Braids » 23 Jun 2011, 16:23

thanks for the feed back. version 4 it is.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. ;)
User avatar
Braids
Programmer
 
Posts: 556
Joined: 22 Jun 2011, 00:39
Location: Unknown. Hobby: Driving myself and others to constructive madness.
Has thanked: 1 time
Been thanked: 1 time

Re: JUnit 3 or 4?

Postby Braids » 01 Jul 2011, 01:26

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.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. ;)
User avatar
Braids
Programmer
 
Posts: 556
Joined: 22 Jun 2011, 00:39
Location: Unknown. Hobby: Driving myself and others to constructive madness.
Has thanked: 1 time
Been thanked: 1 time

Re: JUnit 3 or 4?

Postby Braids » 13 Jul 2011, 14:07

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.
"That is the dumbest thing I've ever seen." --Rob Cashwalker, regarding Innistrad double-sided cards. One of the first times he and I have ever agreed on something. ;)
User avatar
Braids
Programmer
 
Posts: 556
Joined: 22 Jun 2011, 00:39
Location: Unknown. Hobby: Driving myself and others to constructive madness.
Has thanked: 1 time
Been thanked: 1 time


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 27 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 27 users online :: 0 registered, 0 hidden and 27 guests (based on users active over the past 10 minutes)
Most users ever online was 7967 on 09 Sep 2025, 23:08

Users browsing this forum: No registered users and 27 guests

Login Form