Feature #1889
rework the date.java internal tests as real unit tests
100%
Related issues
History
#1 Updated by Greg Shah over 9 years ago
- Target version deleted (
24)
#2 Updated by Greg Shah about 3 years ago
- Parent task deleted (
#1886)
#4 Updated by Greg Shah over 1 year ago
See #9202-32 for a version of the date.java tests written to run in ABLUnit. The only "problem" is that each test is grouped as a set of related tests rather than being its own @Test method.
We probably should also rename TestCase.cls to something more obviously specific to date testing.
#5 Updated by Greg Shah over 1 year ago
- Project changed from Build and Source Control to Testing
#6 Updated by Greg Shah about 1 year ago
- Related to Support #6860: lexer tests added
#7 Updated by Greg Shah about 1 year ago
- Related to Bug #9963: Date literal issues added
#8 Updated by Greg Shah about 1 year ago
- Assignee set to Florin Eugen Rotaru
- % Done changed from 0 to 50
In addition to moving these tests into ABLUnit, please create lexer tests for each of the literal values AND ensure the cases from #9963 are included as ABLUnit tests.
#9 Updated by Vladimir Tsichevski about 1 year ago
There are also a number of 4GL test classes I wrote for DATE type and date FILL-IN-related issues. Some are linked to related tasks, while others have not yet been published. I will publish them after May 12, 2025.
#10 Updated by Vladimir Tsichevski about 1 year ago
Additionally, there are several standard non-4GL JUnit5 test classes within the FWD framework, located in the test/ source directory under the com.goldencode.p2j.util package. IMO these should be reviewed, rewritten in 4GL as ABLUnit tests (integrating their logic into existing ABLUnit tests where possible), and eventually eliminated to reduce possible code duplication across Java and 4GL, thereby simplifying project maintenance.
#11 Updated by Florin Eugen Rotaru about 1 year ago
- % Done changed from 50 to 70
I commited to tests/primitive_type/date/ the classes MdyDateTests.cls, YmdDateTests.cls which contain one Test method per date literal test, and the utility class TestCase.cls.
In OE, all tests pass, in FWD:
MdyDateTests.cls and YmdDateTests.cls - 73/75 are successful, for each.
#12 Updated by Florin Eugen Rotaru about 1 year ago
Greg Shah wrote:
In addition to moving these tests into ABLUnit, please create lexer tests for each of the literal values AND ensure the cases from #9963 are included as ABLUnit tests.
I added tests/primitive_type/date/DateDefinitionsTests.cls which contains ABLUnit tests for the cases from #9963.
I have also added lexer tests for the literals from ##9963 and #9202-32, they are in tests/conversion/lexer/4gl_testcases/dates, there are also corresponding test plans for them.
Last Testcases rev is 1750.
#13 Updated by Florin Eugen Rotaru about 1 year ago
- Status changed from New to WIP
- % Done changed from 70 to 90
#14 Updated by Florin Eugen Rotaru about 1 year ago
- % Done changed from 90 to 100
- Status changed from WIP to Review
#15 Updated by Florin Eugen Rotaru about 1 year ago
- reviewer Greg Shah added
#16 Updated by Greg Shah about 1 year ago
There are many date literals in the date.java tests which are not present in the lexer testcases. To be clear: all dates present in mdyTests and ymdTests should be included in the lexer literal tests.
#17 Updated by Florin Eugen Rotaru about 1 year ago
Greg Shah wrote:
There are many date literals in the
date.javatests which are not present in the lexer testcases. To be clear: all dates present inmdyTestsandymdTestsshould be included in the lexer literal tests.
I've fixed that and made a commit to testcases. I included all literals in a test and then duplicated the tests to cover the quoted version too. I've also added the harness tests for FWD and OE.
#18 Updated by Vladimir Tsichevski about 1 year ago
- File DateParseTest.cls added
- File DateParseCapture.cls added
- File TestDateFormatAssignAdjustment.cls added
- File TestParse.cls added
- File DateParseTestBase.cls added
- File TestDateFormatDeclarationAdjustment.cls added
I’ve attached the following ABLUnit classes for testing date format validation and parsing:
- DateParseTestBase.cls: An abstract base class for parsing dates, defining test cases and providing a foundation for derived classes.
- DateParseTest.cls: A class to test parsing dates and setting a FILL-IN:SCREEN-VALUE, offering the test implementation to pair with DateParseTestBase.cls.
- TestParse.cls: A standalone class for testing date parsing with DATE(spec), which should be re-implemented using DateParseTestBase.cls.
- DateParseCapture.cls: A utility class, also derived from DateParseTestBase.cls, used to capture expected test results for DateParseTest.cls.
The goal is to ensure that all date handling procedures across OE and FWD use consistent logic for dates and formats. However, this is not currently the case in FWD.
Additionally, the following ABLUnit tests investigate and validate the OE date format adjustment feature (see #9855):
- TestDateFormatAssignAdjustment.cls: A test for format adjustment during format assignment.
- TestDateFormatDeclarationAdjustment.cls: A test for format adjustment during variable declaration.
Based on my testing, the format adjustment behavior remains consistent regardless of whether it’s applied via variable declaration, format assignment, or date formatting. Thus, the test cases for both classes can be consolidated into a common base class. For completeness, we could also add a TestDateFormatFormattingAdjustment.cls to test date format adjustment while date formatting.
#19 Updated by Greg Shah about 1 year ago
I’ve attached the following ABLUnit classes for testing date format validation and parsing:
Do any of these relate to the purpose of this task? These sound useful but it is not clear to me how they relate. Florin has implemented tests to replace the testing in date.main().
Any additional tests should be checked in to the testcases project.
#20 Updated by Vladimir Tsichevski about 1 year ago
Greg Shah wrote:
I’ve attached the following ABLUnit classes for testing date format validation and parsing:
Do any of these relate to the purpose of this task? These sound useful but it is not clear to me how they relate. Florin has implemented tests to replace the testing in
date.main().
My tests are a superset of the tests in date.main(). I believe they should either be merged or, at the very least, positioned near each other in the repo.
Any additional tests should be checked in to the testcases project.
Agreed. To support this an instruction should exists on where to put such sources, the rules on how the classes and directories should be named, how the documentation for the test should look like, and where the documentation should be placed. Otherwise nobody will find them :-(
Ran into another problem: I can’t access the testcases repo myself due to a connection issue: the attempt fails after a 300-second timeout is exceeded.
#21 Updated by Greg Shah about 1 year ago
- Status changed from Review to Test
Florin: Do the tests all pass in both OE and FWD?
#22 Updated by Greg Shah about 1 year ago
To support this an instruction should exists on where to put such sources, the rules on how the classes and directories should be named, how the documentation for the test should look like, and where the documentation should be placed. Otherwise nobody will find them :-(
Base Language Testcases
Database/Persistence Testcases
User Interface Testcases
Runtime Infrastructure Testcases
These are being edited by Marian right now as they are working to get the documentation updated to match the current tests.
Your tests might cross over the boundaries of the Format String Tests and Format String (UI) Tests.
#23 Updated by Florin Eugen Rotaru about 1 year ago
Greg Shah wrote:
Florin: Do the tests all pass in both OE and FWD?
- In OE all tests PASS.
- In FWD:
- For
tests/primitive_datatypes/YmdDateTest.clswe have two failing tests:@Test. method public void test70(). Assert:isTrue(new TestCase(date(1, 1, 5), "?????", "9-9-9", 1, 1, 5, 5):test()). end method. @Test. method public void test71(). Assert:isTrue(new TestCase(date(1, 1, 5), "0005.00001.00001", "99999.9999.99999", 1, 1, 5, 5):test()). end method. - For
tests/primitive_datatypes/MdyDateTest.clsalso two failing tests:@Test. method public void test70(). Assert:isTrue( new TestCase(date(1, 1, 5), "?????", "9-9-9", 1, 1, 5, 5):test()). end method. @Test. method public void test71(). Assert:isTrue( new TestCase(date(1, 1, 5), "00001.00001.0005", "99999.9999.99999", 1, 1, 5, 5):test()). end method.
These failures were also mentioned indate.javacomments. - For the additional tests we have in
tests/primitive_datatypes/DateDefinitionsTests.cls, the compilation fails because of the lineDEFINE VARIABLE d1 AS DATE NO-UNDO INITIAL 01022999., even though it is OE-valid.
- For
#24 Updated by Florin Eugen Rotaru about 1 year ago
Vladimir Tsichevski wrote:
Ran into another problem: I can’t access the testcases repo myself due to a connection issue: the attempt fails after a 300-second timeout is exceeded.
Vladimir, if you're using checkout with ftp, try the ssh. That worked for me when I had the same issue.
#25 Updated by Vladimir Tsichevski about 1 year ago
Florin Eugen Rotaru wrote:
Vladimir Tsichevski wrote:
Ran into another problem: I can’t access the testcases repo myself due to a connection issue: the attempt fails after a 300-second timeout is exceeded.
Vladimir, if you're using checkout with
ftp, try thessh. That worked for me when I had the same issue.
I use bzr+ssh://vvt@xfer.goldencode.com/opt/testcases/. Today the weather is good and ssh is working :-)
#26 Updated by Greg Shah about 1 year ago
As a fallback, you can try creating a tunnel to 192.168.1.37 on our internal GCD network. That is the same system as xfer.goldencode.com. I think some people have found that it is faster to access that system via tunnel.