Re: problem with JUnit test
What does the testing software require? What are the 50% of cases that the code fails?
Re: problem with JUnit test
Which test fails, and why?
Re: problem with JUnit test
What are the possible values of this?
getThisElement = pseudoNumber.nextInt(generate.size());
Re: problem with JUnit test
Output is string with lenght = 6. Is created by 6 random nonrecurring chars connected together to one string. posslible values can be for example : abcdef, bfdace,efbcad,....... My problem is, that Test public void testVratKlic() fail sometime. For example: when I start tests, then testVratKlic() pass, i try it next time and void pass again, but when i try it several times the test will fail some times... Test is testing only if output of class matches to reguar expression. Thats why Iam afraid that my class does not work correctly. Sorry for my bad eng.
Re: problem with JUnit test
Would it help if you actually printed out the value of "result" on a failure?
Then you might actually see what it is that's being failed...at the moment you;re simply guessing.
Re: problem with JUnit test
problem is, that result is string.matech([a-f][a-f][a-f][a-f][a-f][a-f]) most of time...but sometimes imput value for test is empy...I dont know why :(((
Re: problem with JUnit test
getThisElement = pseudoNumber.nextInt(generate.size());
is selecting numbers from 0 to hex F, not A to F
Re: problem with JUnit test
Quote:
Originally Posted by
2by4
getThisElement = pseudoNumber.nextInt(generate.size());
is selecting numbers from 0 to hex F, not A to F
Y but "generate" contins only numbers 10-15 and it is a-f in hex
Re: problem with JUnit test
Quote:
Originally Posted by
exltus
Y but "generate" contins only numbers 10-15 and it is a-f in hex
ok I see. I agree with Tolls. Why not print out result?
Re: problem with JUnit test
Quote:
Originally Posted by
2by4
ok I see. I agree with Tolls. Why not print out result?
This is problem...I dont know why...And i dont see any error :(
Re: problem with JUnit test
That is often the way it is until you find out why.
Printing out details as the code executes will often show you what is happening.
Re: problem with JUnit test
I think it may be because you are using static methods to initialize your data.
Is JUnit reloading your class between each test? What is the garbage collector doing???
Have you tried calling randomGenerator() in your test, just before you call vratKlic()?