Re: JUnit Inconsistencies

"Michael Hill [email protected] [junit]" <[email protected]> Tue, 22 Jul 2014 14:21:45 -0400
Newsgroups gmane.comp.java.junit.user
Message-ID <CAOGuBfnkoAXhb_PviP8Gx6MM-mJWHEhyJw2zS3aVC7WO1zu6YA@mail.gmail.com>
.Arshad...

also, is it possible the comparison routine compares "extra" bytes?

test #1 could be loading a buffer to a 1024 characters, and passes.
test #2 could be loading a buffer to a 1023 characters. when run alone it
passes cuz byte[1023] is the same, but run after test #1 it fails because
that byte's different.

i'd prolly start by @ignore-ing tests and re-running until it passes. i
recommend some kinda binary search approach, because 200 is a lot of
candidates. maybe put a macro to replace @Test with @Ignore\n@Test. Or you
could manually run one suite followed by your test until you've localized
it somewhat.

btw, you might be better off, and for sure you'd be faster-running, if you
wrote to streams instead of files during the tests. it's usually a pretty
easy refactor.

good luck, and do let us know how you bust that sucker,
@geepawhill




On Tue, Jul 22, 2014 at 7:18 AM, Charles A Sharp [email protected]
[junit] <[email protected]> wrote:

>
>
>
> As Colin said, it’s difficult to help without more details.
>
> To start with, when the test fails, is it the actual or the expected that
> is not correct?
>
> In other words, is the data being generated failing — or is something
> modifying your expected data in the filesystem?
>
>
> On Jul 22, 2014, at 5:45, Colin Vipurs [email protected] [junit] <
> [email protected]> wrote:
>
>
> My guess would be is that something, somewhere is modifying your system,
> meaning your test isn't completely isolated.   Without knowing more about
> your code it's hard to pinpoint, but things I'd be looking for are static
> state modifiers.
>
> If it's not that, it's possible it's a timing issue.  Do you have anything
> running async anywhere?
>
>
> On Tue, Jul 22, 2014 at 12:20 PM, [email protected] [junit] <
> [email protected]> wrote:
>
>>
>>
>> Hi all,
>> I have written a JUnit test case for the comparison of a data from files.
>> Expected result is present in a file and actual is coming through the
>> execution. Lets call this test case as compareDataTest.
>>
>> I have around 200 unit test cases in the same project.
>>
>> When I run ONLY compareDataTest TEST CASE, IT ALWAYS PASSES.
>>
>> But, when I run all the test cases from the project,  compareDataTest some
>> times passes and some times fails.
>>
>> There is no dependency on other test cases. I tried restarting my IDE and
>> even the system which doesn't look like working.
>>
>> Has anyone faced this ? what might be the possible solution... ?
>>
>> Regards,
>> Arshad
>>
>>
>>
>>
>
>
> --
> Maybe she awoke to see the roommate's boyfriend swinging from the
> chandelier wearing a boar's head.
>
> Something which you, I, and everyone else would call "Tuesday", of course.
>
>
>
> ---
> Charles A Sharp
> 636.293.6574
>
>
>
>  
>