Closed dfreiberger closed 1 month ago
Easy fix in https://github.com/tcunit/TcUnit/commit/8fdf2564b54d48e4d64c646f0682e12227cb9d52
I will look at adding unit tests tomorrow before creating PR.
@dfreiberger Thanks for this discovery. Looking forward to your PR. ❤
Are you using TcUnit-VsExtension for your nice integration of TcUnit into TwinCAT?
Also, something feels different about the colors and font of your IDE? What nice font is that?
@sagatowski yes, I am using TcUnit-VsExtension + the adapter using the branch I am working on at TcUnit-VsTestAdapter that can parse out tests via the TMC file and regex parsing for TEST and TEST_ORDERED sections. The fonts and colors I think are just defaults in TwinCAT VS 2019 although maybe I adjusted something at one point. The font is Consolas.
Fixed in PR #231
Describe the bug Tests defined used![image](https://github.com/tcunit/TcUnit/assets/3814449/796f4e47-c717-4c91-923f-1a5301c6109f)
TEST_ORDERED()
do not appear to calculate the duration correctly.A quick look into the code reveals that the Test StartedAt may not be set, as shown in this screenshot for![image](https://github.com/tcunit/TcUnit/assets/3814449/1c639419-1361-436b-9ed6-1fc00187dbc8)
SetFinishedAndDuration()
.It looks like a simple fix to the
TEST_ORDERED
FC to addTest.SetStartedAtIfNotSet(Timestamp := F_GetCpuCounterAs64bit(GVL_TcUnit.GetCpuCounter));
is necessary. I will try to submit a PR as soon as I have time for this.To Reproduce Run any set of tests that include
TEST_ORDERED
tests. For exampleTestCase1C
will be calculated incorrectly while TestCase1D is correct.Expected behavior The duration should be calculated for the overall length of time that the test takes.
Software versions 1.3.0.0
Run environment Hardware PLC