Author           |
Message |
Magic Juandering Merchant
(Thu Jan 25, 2007 2:04 am) Reply
|
Math/Comp Sci |
|
|
My world famous thread has returned. |
|
Magic Juandering Merchant
(Thu Jan 25, 2007 2:08 am) Reply
|
Re: Math/Comp Sci |
|
|
So has anybody used JUnit before?
It is pretty useful but I don't really understand what you do with the teardown method. I use setUp(), it's great, but I don't seem to need tearDown() for my tests to run properly. |
|
Theldorrin Joined: 04 Jan 2007 Posts: 19724 (Thu Jan 25, 2007 2:15 am) Reply
|
Re: Math/Comp Sci |
|
|
I haven't used JUnit, because I don't really do proper testing (don't tell!). |
|
Magic Juandering Merchant
(Thu Jan 25, 2007 2:17 am) Reply
|
Re: Math/Comp Sci |
|
|
It's pretty easy to learn. You should try it, it might be helpful. |
|
Theldorrin Joined: 04 Jan 2007 Posts: 19724 (Thu Jan 25, 2007 2:19 am) Reply
|
Re: Math/Comp Sci |
|
|
Can you give me a very short overview of how it works? |
|
Magic Juandering Merchant
(Thu Jan 25, 2007 2:32 am) Reply
|
Re: Math/Comp Sci |
|
|
You write a test class for the class you are testing by highlighting the class in eclipse and going new->JUnitTest. You write the tests in the form of methods. I just learning, so I'm not exactly sure what exactly is going on behind the scenes. Eclipse seems to take of things nicely.
A simple example that you probably wouldn't need to test anyways. Say you have a integer x, and a method called add(y).
public void testAdd()
{
Integer x = new Ineteger(6);
x.add(5);
assertEquals(11, x); //if this is true, then the test passes
}
you can use assertTrue and assertFalse as well.
You should test the methods boundaries, areas in the domain and areas outside the domain. |
|
Stupid Fucking Faggot Stupid 30 fuckbag who likes DBZ Joined: 20 Jan 2007 Posts: 7037 (Thu Jan 25, 2007 2:33 am) Reply
|
Re: Math/Comp Sci |
|
|
Get PP's, faggots! |
|
Theldorrin Joined: 04 Jan 2007 Posts: 19724 (Thu Jan 25, 2007 2:37 am) Reply
|
Re: Math/Comp Sci |
|
|
So testAdd() would test the add() method?
And testBlah() would test the blah() method? |
|
Magic Juandering Merchant
(Thu Jan 25, 2007 2:39 am) Reply
|
Re: Math/Comp Sci |
|
|
yeah, well you can name them whatever you want. |
|
Theldorrin Joined: 04 Jan 2007 Posts: 19724 (Thu Jan 25, 2007 2:41 am) Reply
|
Re: Math/Comp Sci |
|
|
Oh. Then I don't get how it's any different than a normal object with a method like that. |
|
Theldorrin Joined: 04 Jan 2007 Posts: 19724 (Thu Jan 25, 2007 2:42 am) Reply
|
Re: Math/Comp Sci |
|
|
OH, I guess those assertions aren't normal assertions, but instead methods of the JUnit class or whatever. |
|
Magic Juandering Merchant
(Thu Jan 25, 2007 2:44 am) Reply
|
Re: Math/Comp Sci |
|
|
What do mean? It is a normal object. |
|
Theldorrin Joined: 04 Jan 2007 Posts: 19724 (Thu Jan 25, 2007 2:49 am) Reply
|
Re: Math/Comp Sci |
|
|
Something is amiss! |
|
Nickass Joined: 22 Jan 2007 Posts: 992 (Thu Jan 25, 2007 5:11 pm) Reply
|
Re: Math/Comp Sci |
|
|
Sorry, but the left cell column really needs to be stretched out a bit.
There we go.
Oh, so big. |
|
Ryoko's Biatch Joined: 04 Jan 2007 Posts: 9255 (Thu Jan 25, 2007 5:43 pm) Reply
|
Re: Math/Comp Sci |
|
|
I really hate these threads because I don't know shit about coding besides simple HTML, but I end up reading them anyway and getting angry at the people who post in them. |
|
Theldorrin Joined: 04 Jan 2007 Posts: 19724 (Thu Jan 25, 2007 6:16 pm) Reply
|
Re: Math/Comp Sci |
|
|
You should learn! Maybe it'd help you in wooing Morgan. |
|
Ryoko's Biatch Joined: 04 Jan 2007 Posts: 9255 (Thu Jan 25, 2007 6:36 pm) Reply
|
Re: Math/Comp Sci |
|
|
Sorry, I'm not going to be a nerd. |
|
Theldorrin Joined: 04 Jan 2007 Posts: 19724 (Thu Jan 25, 2007 6:37 pm) Reply
|
Re: Math/Comp Sci |
|
|
Too late! |
|
Ryoko's Biatch Joined: 04 Jan 2007 Posts: 9255 (Thu Jan 25, 2007 6:40 pm) Reply
|
Re: Math/Comp Sci |
|
|
oh shit |
|
Stupid Fucking Faggot Stupid 30 fuckbag who likes DBZ Joined: 20 Jan 2007 Posts: 7037 (Thu Jan 25, 2007 6:46 pm) Reply
|
Re: Math/Comp Sci |
|
|
I used to not want to be a nerd, very desperately, until I learned that I actually wasn't a nerd anyway because I'm not smart enough.
But then, realizing that, I began to wish I WAS a nerd! |
|
|