Activity for co♻e: unittest framework for CODESYS

  • eguerra eguerra posted a comment on ticket #65

    Library Manager -> Library Parameters (near placeholders) There you can change parameters like the max number of test suites, the max number of tests per test suite or the max number of asserts per test

  • bnewman bnewman posted a comment on ticket #67

    this can be closed BTW

  • bnewman bnewman posted a comment on ticket #67

    I think this is the same or similar to https://forge.codesys.com/lib/counit/tickets/58/ I figured out that this was occurring because assert was being called continuously

  • eschwellinger eschwellinger posted a comment on ticket #59

    For security reasons, we had to shut down the faq.codesys.com page. The content will gradually be integrated into the CODESYS Online Help System (https://www.helpme-codesys.com). Here the preliminary faq file for download.

  • bnewman bnewman posted a comment on ticket #59

    Seems to work now. Can this be closed?

  • bnewman bnewman created ticket #68

    Request: Tutorial for Jinkins and example Python Scripts

  • bnewman bnewman created ticket #67

    AccessViolation Exception thrown in FB_AssertResultStatic.AddAssertResult()

  • azabala azabala modified a comment on ticket #66

    For anyone looking for a solution to a similar problem: * You should install a newer version of CodeSys (e.g. 3.5 SP19) * Open newer version of CodeSys * Import the project * Click File > Save Project as * Select the appropriate file type according to the target CodeSys version - in case of CodeSys 3.5 SP11 select Library files (CODESYS V3.5 SP11) (*.library) * Click Save Now you will be able to open the .library with the target CodeSys version.

  • azabala azabala posted a comment on ticket #66

    For anyone looking for a solution to a similar problem: * You should install a newer version of CodeSys (e.g. 3.5 SP19) * Open newer version of CodeSys * Import the project * Click File > Save Project as * Select the appropriate file type according to the target CodeSys version - in case of CodeSys 3.5 SP19 select Library files (CODESYS V3.5 SP11) (*.library) * Click Save Now you will be able to open the .library with the target CodeSys version.

  • azabala azabala created ticket #66

    CoUnit Library installation error in CodeSys 3.5 SP11

  • elpanoo1 elpanoo1 posted a comment on ticket #65

    Can you give me an example on how this should look like?

  • hermsen hermsen posted a comment on ticket #65

    Hi, Yes it seems the program will not fit in your PLC memory. To resole this you can use the parameters in the CoUnit library to limit the various array sizes.

  • elpanoo1 elpanoo1 created ticket #65

    coUnitRunner Error: no more free global space

  • aguado aguado posted a comment on ticket #64

    Hi, this might help you: https://forge.codesys.com/tol/codesys-4-linux/docker/ci/master/tree/codesys-ide/scripts/ Won't run out of the box i guess, but it gives a good idea on how scripting CODESYS works.

  • adenis adenis modified a comment on ticket #64

    Thanks for the response! I am already building my libraries and packaging them in Jenkins. I am running SP17 so I can't take advantage of the SP19 feature. I'll have a look at bug 63. Ideally, the test results would be stored in the Jenkins build folder. This would allow concurrent running of builds. Really what I wanted to know is if someone could share the actual python script or include it in the library or in the documentation. In my experience, the largest challenge is to come up with what you...

  • adenis adenis modified a comment on ticket #64

    Thanks for the response! I am already building my libraries and packaging them in Jenkins. I am running SP17 so I cant take advantage of the SP19 feature. Ill have a look at bug 63. Really what I wanted to know is if you could share the actual python script or include it in the library or in the documentation. In my experience, the largest challenge is to come up with what you call: "your script file which monitors the xUnit xml-file has been dumped and exits CODESYS afterwards.py" If you have such...

  • adenis adenis posted a comment on ticket #64

    Thanks for the response! I am already building my libraries and packaging them in Jenkins. I am running SP17 so I cant take advantage of the SP19 feature. Ill have a look at bug 63. Really what I wanted to know is if you could share the actual python script or include it in the library or in the documentation. In my experience, the largest challenge is to come up with what you call: "<your script="" file="" which="" monitors="" the="" xunit="" xml-file="" has="" been="" dumped="" and="" exits=""...

  • hermsen hermsen modified ticket #64

    Jenkins python scripts

  • hermsen hermsen modified ticket #64

    Jenkins python scripts

  • hermsen hermsen modified a comment on ticket #64

    Hi, A small primer on how to go started. You should not change the path of the xml file via Python unless you fancy a challenge. Try changing via the supposed manner: via the new lib parameter interaction window (SP19 or newer) or change it in the .library and save it (recommended for older then SP19). The lib is open source so you may do whatever you see fit. I suggest you open the lib and explore/read it as this will help you write code for step2, monitoring the successful dump of the XML file...

  • hermsen hermsen modified ticket #64

    Jenkins python scripts

  • hermsen hermsen posted a comment on ticket #64

    Hi, A small primer on how to go started. You should not change the path of the xml file via Python unless you fancy a challenge. Try changing via the supposed manner: via the new lib parameter interaction window (SP19 or newer) or change it in the .library and save it (recommended for older then SP19). The lib is open source so you may do whatever you see fit. I suggest you open the lib and explore/read it as this will help you write code for step2, monitoring the successful dump of the XML file...

  • adenis adenis created ticket #64

    Jenkins python scripts

  • hermsen hermsen modified a comment on ticket #63

    you are most likely affected by this security fix: Codesys Advisory 2023-01 get the files from Program data or change that setting (Forceiecfilepath) to zero. hope this gives you enough hints

  • hermsen hermsen modified a comment on ticket #63

    you are probably affected by this security fix: Codesys Advisory 2023-01

  • hermsen hermsen modified a comment on ticket #63

    1) If you keep the default directory, is the file written? => The anwser should be YES if the unittest doesn't hang (i.e all test finish regardless outcome). 2) If you change the Default directory, is the file written? => If No: - check your PATH notation in CODESYS(!), - check the file write FB error messages, - check if the unittest doesn't hang (i.e all test finish regardless outcome). The XML file is only dumped at the end of all the tests. If the xml file is incomplete, assign a bigger filebuffer...

  • hermsen hermsen posted a comment on ticket #63

    Its quite simple: the main fault was most probably somewhere in your filepath syntax. Read up on the FileRead/FileWrite/FileOpen and FileClose FB's from CAA File Library for hints on the path's syntax: CAA.FILENAME which is described in “CAA_Types.library“ should be usable for library “CAA_File“ in the following way. Separators between directory paths in “CAA.FILENAME“ are the slash („/“) or the back-slash („\“). The interpretation of the directory path is tolerant to the effect that either one or...

  • thecolonel26 thecolonel26 modified a comment on ticket #63

    Wait I found it. It seems it ignores the "C:\" I changed the path to just the file name 'coUnit_xunit_testresults.xml' and then I found it written to C:\ProgramData\CODESYS\CODESYSControlWinV3x64\B4A102F1\PlcLogic Is is rather confusing. Where is it writing to if I put C:\ on it? it says it is suceeding.

  • thecolonel26 thecolonel26 posted a comment on ticket #63

    Wait I found it. It seems it ignores the "C:\' and puts it in a temp folder in ProgramData C:\ProgramData\CODESYS\CODESYSControlWinV3x64\B4A102F1\PlcLogic Is is rather confusing.

  • thecolonel26 thecolonel26 modified a comment on ticket #63

    I am confused. As I said in my post 1. using the default directory which is set to 'C:\' in the library parameter list results in all log messages to the device log showing success. there are no error messages. 2. Changing the directory to C:\Temp\ has the same result all show sucess, and no error mesages. but the xml file is not there in either case. This is the export of the log entries runing the test using the default path <LoggerEntries xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">...

  • thecolonel26 thecolonel26 modified a comment on ticket #63

    I am confused. As I said in my post 1. using the default directory which is set to 'C:\' in the library parameter list results in all log messages to the device log showing success. there are no error messages. 2. Changing the directory to C:\Temp\ has the same result all show sucess, and no error mesages. but the xml file is not there in either case. This is the log entries with default path <LoggerEntries xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">...

  • thecolonel26 thecolonel26 posted a comment on ticket #63

    I am confused. As I said in my post 1. using the default directory which is set to 'C:\' in the library parameter list results in all log messages to the device log showing success. there are no error messages. 2. Changing the directory has the same result all show sucess, and no error mesages. but the xml file is not there in either case. This is the log entries with default path <LoggerEntries xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Logger...

  • hermsen hermsen posted a comment on ticket #63

    1) If you keep the default directory, is the file written? => The anwser is YES if the unittest doesn't hang (i.e all test finish regardless outcome). 2) If you change the Default directory, is the file written? => If No: - check your PATH notation in CODESYS(!), - check the file write FB error messages, - check if the unittest doesn't hang (i.e all test finish regardless outcome). The XML file is only dumped at the end of all the tests. If the xml file is incomplete, assign a bigger filebuffer until...

  • hermsen hermsen modified ticket #62

    Test Suite is not being Executed

  • thecolonel26 thecolonel26 created ticket #63

    xml Results file not being written to file system

  • thecolonel26 thecolonel26 modified a comment on ticket #62

    Ok it appears it will only execute once and then will require a reset and not just a start and stop. So I figured that out. Next problem This can be closed

  • thecolonel26 thecolonel26 posted a comment on ticket #62

    Ok it appears it will only execute once and then will require a reset and not just a start and stop. So I figured that out. Next problem

  • thecolonel26 thecolonel26 created ticket #62

    Test Suite is not being Executed

  • hermsen hermsen modified ticket #58

    AssertResults array not checked for upper bounds

  • hermsen hermsen posted a comment on ticket #58

    The library is open source, you can edit the source code if you wish.

  • hermsen hermsen modified ticket #58

    AssertResults array not checked for upper bounds

  • sgronchi sgronchi posted a comment on ticket #58

    I had the same problem just today with coUnit v1.2.0.0. Library parameters are not editable so I cannot increment the related array size.

  • jtebokkel jtebokkel posted a review comment

    I've caught so many bugs in my code. From silly mistakes to big head scratchers. Massive thanks guys

  • hermsen hermsen modified a wiki page

    Userlist

  • hermsen hermsen modified a wiki page

    Home

  • hermsen hermsen modified a wiki page

    Home

  • hermsen hermsen modified ticket #60

    AssertEquals_REAL does not handle NaN

  • hermsen hermsen modified ticket #60

    AssertEquals_REAL does not handle NaN

  • hermsen hermsen modified ticket #60

    AssertEquals_REAL does not handle NaN

  • hermsen hermsen modified a wiki page

    Userlist

  • hermsen hermsen modified a comment on ticket #61

    Hi, first off let me start by thanking you for using our unit testing framework solution. As you might know allready this software is an official fork of TcUnit. Therefore, we try to follow the original TcUnit codebase as close as possible or technically permitted. For instance, ADS will not work without a proper implementation in CODESYS, but a bespoke CI/CD runner is not necessary like in TwinCAT3. So there are pro's and con's. Currently we are waiting for the release of TcUnit v1.3 (or V2?). When...

  • hermsen hermsen posted a comment on ticket #61

    Hi, first off let me start by thanking you for using our unit testing framework solution. As you might know allready this software is an official fork of TcUnit. Therefore, we try to follow the original TcUnit codebase as close as possible or technically permitted. For instance ADS will not work in CODESYS, but a bespoke CI/CD runner is not necessary like in TwinCAT3. So there are pro's and con's. Currently we are waiting for the release of TcUnit v1.3 (or V2?). When it is officially released, you...

  • stmos stmos posted a comment on ticket #61

    Attached a tentative solution for the problem, patch for the FB_AssertResultStatic.ReportResult method, based on what's implemented in FB_AssertArrayResultStatic.ReportResult.

  • stmos stmos created ticket #61

    FB_AssertResultStatic.ReportResult - PLC Crash

  • hermsen hermsen modified a wiki page

    Home

  • hermsen hermsen modified a wiki page

    Home

  • hermsen hermsen modified a wiki page

    Home

  • jtebokkel jtebokkel posted a comment on ticket #60

    See the attached files. Yes, this is in v1.2.0.0

  • hermsen hermsen modified ticket #60

    AssertEquals_REAL does not handle NaN

  • hermsen hermsen posted a comment on ticket #60

    Hi John, We are aware that certain details in the framework are sub optimal. However, that said, every tip/hint we get to optimise is one step in the right direction. So, since you found this issue, I hope you could also submit a patch which catches the Not A Number status and yields a fail in the assert. You can submit your patch in multiple ways. My suggestion would be that you just drop a code here in the Ticket. The reason behind this because I dont know if you hvae the Professional Developer...

  • jtebokkel jtebokkel modified a comment on ticket #60

    A note about this. It seems that if all the variables in the function I'm testing are 0.0 then the math can return NaN however if only the divisor (rl2) is 0.0 then the controller will throw a divide-by-zero exception. FUNCTION ExampleFunction : REAL VAR_INPUT rl1 : REAL; rl2 : REAL; rl3 : REAL; END_VAR ExampleFunction := (rl1 / rl2) * rl3; It is interesting the things you discover as you create more test cases. (Thanks for your work on this library <3 )

  • jtebokkel jtebokkel posted a comment on ticket #60

    A note about this. It seems that if all the variables in the function I'm testing are 0.0 then the math can return NaN however if only the divisor (r2) is 0.0 then the controller will throw a divide-by-zero exception. FUNCTION ExampleFunction : REAL VAR_INPUT rl1 : REAL; rl2 : REAL; rl3 : REAL; END_VAR ExampleFunction := (r1 / r2) * r3; It is interesting the things you discover as you create more test cases. (Thanks for your work on this library <3 )

  • jtebokkel jtebokkel created ticket #60

    AssertEquals_REAL does not handle NaN

  • mr337 mr337 created ticket #59

    FAQ page not working

  • hermsen hermsen modified ticket #58

    AssertResults array not checked for upper bounds

  • hermsen hermsen modified a comment on ticket #58

    Since I have not received feedback and you make use of an older version, I asume this has been resolved. If somehow your issue persists in the latest version ( v1.2) you can open a new ticket.

  • hermsen hermsen posted a comment on ticket #58

    Since I have not received feedback and use an outdated version I asume this has been resolved. If somehow your issue persists in the latest version ( v1.2) you can open a new ticket.

  • hermsen hermsen modified a wiki page

    Home

  • hermsen hermsen modified a wiki page

    Home

  • hermsen hermsen modified a wiki page

    Home

  • hermsen hermsen posted a comment on ticket #58

    Thank you for using cfUnit. Sadly cfunit v1.1.0.0 will not receive bugfixes as it has been superseeded by coUnit. A slightly different name will only bring you some minor code changes if you use refactoring wisely, however coUnit v1.2.0.0 also brings new features, improvements and bugfixes over its predecessor. So step 1 is to update to coUnit.

  • srigan1986 srigan1986 created ticket #58

    AssertResults array not checked for upper bounds

  • hermsen hermsen modified a wiki page

    Home

  • hermsen hermsen committed [r459]

    Autoversioning commit: a non-deltaV client made a change to

  • hermsen hermsen committed [r458]

    Autoversioning commit: a non-deltaV client made a change to

  • hermsen hermsen committed [r457]

    Autoversioning commit: a non-deltaV client made a change to

  • aliazzz aliazzz created ticket #57

    Create .yml pipeline and tuned manifest

  • hermsen hermsen posted a comment on ticket #55

    Ignore my previous message. In the meanwhile I confirmed the real issue, now searching for root cause

  • aliazzz aliazzz modified a comment on ticket #56

    XSD https://forge.codesys.com/prj/cfunit/code/HEAD/tree/trunk/coUnit/XSD/JUnitv5.xsd Compliance https://forge.codesys.com/prj/cfunit/code/HEAD/tree/trunk/coUnit/XSD/QA%20xUnit.xml%20template.png?format=raw

  • aliazzz aliazzz modified ticket #56

    Add ability to disable tests and have them reported

  • aliazzz aliazzz posted a comment on ticket #56

    XSD https://forge.codesys.com/prj/cfunit/code/HEAD/tree/trunk/coUnit/XSD/JUnitv5.xsd Compliance (non debatable here) https://forge.codesys.com/prj/cfunit/code/HEAD/tree/trunk/coUnit/XSD/QA%20xUnit.xml%20template.png?format=raw

  • aliazzz aliazzz posted a comment on ticket #56

    Since this ticket is fulfilled within scope I will close the issue.

  • jtebokkel jtebokkel posted a comment on ticket #56

    Did some digging on the format and I can't seem to find disabled as an attribute in the xsd (https://github.com/windyroad/JUnit-Schema/blob/master/JUnit.xsd) however skipped is mentioned, but in the context of <testsuite>

  • jtebokkel jtebokkel posted a comment on ticket #56

    It seems it is not reported as disabled in the xml report or in the log. (See attached screen shots), but is reported as SKIPPED in the test suite. Maybe I misunderstand the disabled field for <testsuites> I was expecting that to give the total disabled or skipped tests. It does get marked as skipped, but calling TEST_FINISHED() doesn't mark it finished. (Not sure if it should)

  • aliazzz aliazzz modified a comment on ticket #56

    If you declare a test, calling TEST_FINISHED() is mandatory, even if the test will be disabled; TEST('DISABLED_ThisTestWillBeIgnored'); AssertEquals(Expected := a, Actual := b, Message := 'A does not equal B'); TEST_FINISHED(); Note that 'Disabled' is case insensitive.

  • aliazzz aliazzz posted a comment on ticket #56

    If you declare a test, calling TEST_FINISHED() is mandatory, even if the test will be disabled; TEST('DISABLED_ThisTestWillBeIgnored'); AssertEquals(Expected := a, Actual := b, Message := 'A does not equal B'); TEST_FINISHED();

  • jtebokkel jtebokkel posted a comment on ticket #56

    Does TEST_FINISHED() need to be called when the test is marked as disabled_? or is it sufficient to just have it marked as skipped/disabled? METHOD T101_Process VAR_INPUT END_VAR VAR_INST mxT : UINT; END_VAR IF xLiveDB THEN TEST('T101_Process'); ELSE // gc_sDisable : STRING(10) := 'disabled_'; TEST(concat(gConst.gc_sDisable, 'T101_Process')); // Is this call necessary? TEST_FINISHED(); RETURN; END_IF CASE mxT OF 0: // init mxT := 10; 10: // multi stage test mxT := 20; ELSE TEST_FINISHED(); END_C...

  • aliazzz aliazzz modified ticket #56

    Add ability to disable tests and have them reported

  • aliazzz aliazzz posted a comment on ticket #56

    Hi, maybe it is an undocumented feature(?) but your request is allready implemented into v1.2.0.0 :-) AFAIK Use Test('Disabled_TestXYZ'); Test_Finished(); This will be counted in the reporting as a skipped test. (both logged in PLC Log and in the XML.report)

  • jtebokkel jtebokkel created ticket #56

    Add ability to disable tests and have them reported

  • aliazzz aliazzz modified a wiki page

    Home

  • aliazzz aliazzz modified a wiki page

    Home

  • aliazzz aliazzz modified a wiki page

    Home

  • aliazzz aliazzz modified a wiki page

    Home

  • aliazzz aliazzz modified a wiki page

    Home

  • aliazzz aliazzz modified a wiki page

    Home

  • aliazzz aliazzz modified a wiki page

    Home

  • aliazzz aliazzz modified a wiki page

    Home

1 >