You are viewing a plain text version of this content. The canonical link for it is here.
Posted to regexp-dev@jakarta.apache.org by sp...@haenchen.softwarezentrum.de on 2004/03/03 10:28:09 UTC
Re: Tests with JUnit
> RETest is a framework for the testing already and it's simplier than
> JUnit.
Yes, that is true.
But we have plenty of JUnit Tests for our common code. So we would like to
run JUnit for regex as well.
> I agree with Vadim that it should be easy to convert RETest to JUnit.
Of course that is easy, but I hate duplicated code. How about modifying
the RETest class a little, so some basic methods can be called for reading
the RETest.txt file?
Re: Antwort: Re: Tests with JUnit
Posted by Oleg Sukhodolsky <so...@ppson.spb.ru>.
Hi Sebastian,
> now I looked into this and have following idea:
> RETest has a public static method which reads a filename and returns an
> array of test-objects. An test-object has accessing methods for the
> contents of the 5 lines for each test.
for now RETest processes script file in the follows way (see RETest.runAutomatedTests())
BufferedReader br = new BufferedReader(new FileReader(testInput));
try
{
// While input is available, parse lines
while (br.ready())
{
Runnable testcase = RETest.getNextTestCase(this, br);
if (testcase != null) {
testcase.run();
}
}
}
finally
{
br.close();
}
So, RETest.getNextTestCase() is that static method which creates test
cases. It's possible to change it so it will return array of test
cases, but I'm not sure that we need this (to be discussed :)
Test case is instance of RETestCase, it needs some utility methods
from RETest (we can extract them into public interface which you will
need to implement). Here is a draft of this interface:
interface RETestCaseEnv
{
void fail(StringBuffer log, String s); // to report failure
void say(String s); // to make some logging
int getNextTestNo(); // get number for this testcase
RECompiler getCompiler(); // compiler to compile pattern
boolean shouldShowSuccesses(); // should we print parens if match was successful
}
> With these objects I would write the JUnit tests and give the source back
> to you.
I'll try to send diffs tomorrow. So you will be able apply them to
your copy of current regexp workspace and play with it.
> Maybe some convience methods for testing could also be public as well, we
> could look in this deeper in the next step.
If you find that some methods should be public, just make them
public :) Although I don't see any such methods for now.
> What do you think about this?
Agree with such approach.
With best regards, Oleg.
---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org
Antwort: Re: Tests with JUnit
Posted by sp...@haenchen.softwarezentrum.de.
Dear Oleg,
now I looked into this and have following idea:
RETest has a public static method which reads a filename and returns an
array of test-objects. An test-object has accessing methods for the
contents of the 5 lines for each test.
With these objects I would write the JUnit tests and give the source back
to you.
Maybe some convience methods for testing could also be public as well, we
could look in this deeper in the next step.
What do you think about this?
Kind regards, Sebastian
---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org
Antwort: Re: Antwort: Re: Antwort: Re: Tests with JUnit
Posted by sp...@haenchen.softwarezentrum.de.
Thanks Vadim for your response.
> Committers do:
> http://www.apache.org/~jim/projects.html#jakarta-regexp
You as a committer will do too.
It is difficult to discuss things on a daily base. Quicker return would be
more efficient. Could we discuss the general intentions in a chat?
How about irc on freenode (http://www.freenode.org/)? My user name is
Sebastian_ and we can discuss in channel #Jakarta. I am online there the
next days.
---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org
Re: Antwort: Re: Antwort: Re: Tests with JUnit
Posted by Vadim Gritsenko <va...@reverycodes.com>.
sp@haenchen.softwarezentrum.de wrote:
>>I'm not a jakarta-regexp developer :(
>>
>>
>
>Who decides how the next version looks like?
>
>
Committers do:
http://www.apache.org/~jim/projects.html#jakarta-regexp
Vadim
---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org
Re: Antwort: Re: Antwort: Re: Tests with JUnit
Posted by Oleg Sukhodolsky <so...@ppson.spb.ru>.
> I can't find RETestCaseEnv.java.
Attached.
Oleg.
Antwort: Re: Antwort: Re: Tests with JUnit
Posted by sp...@haenchen.softwarezentrum.de.
> I'm not a jakarta-regexp developer :(
Who decides how the next version looks like?
> So I only can submit a patch
> with proposed changes. Could you, please, confirm that the attached
> diffs are exactly what you want.
I can't find RETestCaseEnv.java.
---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org
Re: Antwort: Re: Tests with JUnit
Posted by Oleg Sukhodolsky <so...@ppson.spb.ru>.
Hi Sebastian,
I'm not a jakarta-regexp developer :( So I only can submit a patch
with proposed changes. Could you, please, confirm that the attached
diffs are exactly what you want. And I will submit a patch (or you
can do this yourself).
With best regards, Oleg.
> Dear Oleg,
> please don't forget to make this interface public in the new version.
> I want to let your source code (the jar-file) untouched.
> Kind regards, Sebastian
Antwort: Re: Tests with JUnit
Posted by sp...@haenchen.softwarezentrum.de.
> Here are some changes:
...
> and RETestCaseEnv (you should make this
> interface public)
...
Dear Oleg,
please don't forget to make this interface public in the new version.
I want to let your source code (the jar-file) untouched.
Kind regards, Sebastian
---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org
Re: Antwort: Re: Antwort: Re: Antwort: Re: Antwort: Re: Tests with JUnit
Posted by Oleg Sukhodolsky <so...@ppson.spb.ru>.
Hi Sebastian,
> RE.REPLACE_WITH_ESCAPES could not be resolved. Please send me your new
> RE.java. Easiest for me would be, if you send all your sourcefiles.
REPLACE_WITH_ESCAPES is part of fix for 24234 (Doesn't seem to be a
way to use '\' in subst with) which is not integrated yet. So, you
can just comment out/remove lines which use it.
> Using JUnit the way you described is easy. I had MUCH more time to spend
> to get the sourcefiles.
I'm sorry. I've no idea about filters which set up for the list
and that I made several mistakes :(
> If the test works, I will refactor a little and would like to
> discuss it with you.
Any time.
With best regards, Oleg.
---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org
Antwort: Re: Antwort: Re: Antwort: Re: Antwort: Re: Tests with JUnit
Posted by sp...@haenchen.softwarezentrum.de.
Hi Oleg,
RE.REPLACE_WITH_ESCAPES could not be resolved. Please send me your new
RE.java. Easiest for me would be, if you send all your sourcefiles.
Using JUnit the way you described is easy. I had MUCH more time to spend
to get the sourcefiles. If the test works, I will refactor a little and
would like to discuss it with you.
Thanks so far, Sebastian
---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org
Re: Antwort: Re: Antwort: Re: Antwort: Re: Tests with JUnit
Posted by Oleg Sukhodolsky <so...@ppson.spb.ru>.
>> Here are the diffs.
> Please sent me the changed or new classes.
Antwort: Re: Antwort: Re: Antwort: Re: Tests with JUnit
Posted by sp...@haenchen.softwarezentrum.de.
> Here are the diffs.
Please sent me the changed or new classes.
---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org
Re: Antwort: Re: Antwort: Re: Tests with JUnit
Posted by Oleg Sukhodolsky <so...@ppson.spb.ru>.
Friday, March 5, 2004, 12:14:13 PM, you wrote:
>> >> I've attached final RETEst.java version
> You sent me RE.java. Please send RETest.java.
:(
Next try. Here are the diffs. Just make RETestCaseEnv interface
public. (Hope this try will be successful :)
Oleg.
Antwort: Re: Antwort: Re: Tests with JUnit
Posted by sp...@haenchen.softwarezentrum.de.
> >> I've attached final RETEst.java version
You sent me RE.java. Please send RETest.java.
---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org
Re: Antwort: Re: Tests with JUnit
Posted by Oleg Sukhodolsky <so...@ppson.spb.ru>.
>> I've attached final RETEst.java version
> Maybe you forgot to attach the file.
No, I've attached it but it looks like it was removed by the list
(perhaps it was too big)
Here is next try.
Oleg
Antwort: Re: Tests with JUnit
Posted by sp...@haenchen.softwarezentrum.de.
Dear Oleg,
many thanks for your reply.
> I've attached final RETEst.java version
Maybe you forgot to attach the file.
> Here are some changes:
...
> Or do you need
> something else?
Maybe, I will look into this and send you my solution to discuss.
> Also, perhaps it's worth to file RFE about this.
I am new, could you deicide and do it?
Kind regards, Sebastian
---------------------------------------------------------------------
To unsubscribe, e-mail: regexp-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: regexp-dev-help@jakarta.apache.org
Re: Tests with JUnit
Posted by Oleg Sukhodolsky <so...@ppson.spb.ru>.
>> RETest is a framework for the testing already and it's simplier than
>> JUnit.
> Yes, that is true.
> But we have plenty of JUnit Tests for our common code. So we would
> like to run JUnit for regex as well.
Ok.
>> I agree with Vadim that it should be easy to convert RETest to JUnit.
> Of course that is easy, but I hate duplicated code. How about modifying
> the RETest class a little, so some basic methods can be called for reading
> the RETest.txt file?
Here are some changes:
I made RETest.getNextTestCase() method public. It should be used to
get next test from the script-file. Test is a Runnable, to run it
just call run() :) getNextTestCase() takes two parameters
BufferedReader for script-file and RETestCaseEnv (you should make this
interface public) it provides some utility methods such as fail(),
say(), getCompiler() etc)
I've attached final RETEst.java version (I'm in off-line right now so
I can not make diffs).
Could you, please, look at it. Is it what you want? Or do you need
something else?
Also, perhaps it's worth to file RFE about this.
With best regards, Oleg.