Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RUN_IN_SEQUENCE doesn't work for multiple TestSuites #189

Closed
doerk77 opened this issue Jun 14, 2022 · 13 comments
Closed

RUN_IN_SEQUENCE doesn't work for multiple TestSuites #189

doerk77 opened this issue Jun 14, 2022 · 13 comments
Labels
bug Something isn't working

Comments

@doerk77
Copy link

doerk77 commented Jun 14, 2022

Describe the bug
RUN_IN_SEQUENCE executes the tests on the first TestSuite, but the tests for the 2nd TestSuite are not being executed.

When RUN_IN_SEQUENCE calls AreAllTestsFinished(), it returns true (because no test has been registered yet) and therefore the tests never get executed.
But the tests can only be registered in TEST_ORDERED during execution of the test suite.

Note: It all works fine if the test suites are being executed in parallel.

Screenshots
Using TcUnit.RUN() and TEST()
image

Using TcUnit.RUN_IN_SEQUENCE() and TEST_ORDERED()
image

image

image

Software versions
v1.2.1.0

@sagatowski
Copy link
Member

Your output window looks weird, you get double outputs for some reason.

  1. Did you define the tests and test-suites correctly?
    You have example projects for this use case here:
    https://github.com/tcunit/ExampleProjects/tree/master/RunTestsInSequenceExampleProjects

Please also check this FAQ: https://tcunit.org/frequently-asked-questions/?Display_FAQ=970

  1. Do you have an example project that re-creates this issue?

Note that version 1.2.1.0 of TcUnit doesn't exist. The latest release is 1.2.0.0.

@doerk77
Copy link
Author

doerk77 commented Jun 14, 2022

Just tested with your sample project

image

As you can see there are clearly more than 4 tests throughout the various test suites. But only 4 tests get executed.

XML output states the same.
image

PS: I'm using the latest (unreleased) version from GitHub which tells 1.2.1.0.

@sagatowski
Copy link
Member

I tested it with the latest release 1.2.0.0 and got the following:
image

Which means that something in a commit after the release has broken this.

@doerk77 Could you look into it and create a PR?

@sagatowski sagatowski added the bug Something isn't working label Jun 14, 2022
@sagatowski sagatowski changed the title RUN_IN_SEQUENCE doesn't work for multiple TestSuites RUN_IN_SEQUENCE doesn't work for multiple TestSuites in 1.2.1.0 (current master) Jun 14, 2022
@sagatowski
Copy link
Member

Make sure to read the contributing. Thanks.

@sagatowski
Copy link
Member

Here are all the commits since the release of 1.2.0.0.

@sagatowski
Copy link
Member

Also, if you could think of any good test to add to the TcUnit-Verifier to cover this case, that would be awesome!

@doerk77
Copy link
Author

doerk77 commented Jun 14, 2022

Happened between Commits 5059342 and c7d7021

First guess is that this is causing the issue:
image
(Left is 5059342 )

But need to check in detail.
Hadn't been clean before. Therefore the workaround incl. comment ;-)

@sagatowski
Copy link
Member

@doerk77 seems reasonable. Good work! TcUnit always needs more contributors!
Bad of me to not discover this during code review :/

Would be really good if the TcUnit-Runner would detect this failure, so we don't end up here again.

@doerk77
Copy link
Author

doerk77 commented Jun 14, 2022

Question: Is there a reason why registering tests is only possible while the testsuite is running?

In general I'd allow it the whole time until the testsuite actually starts running. At this point in time the list should not change any more.
That way it would even allow to register tests during FB_Init or in a method with attribute 'call_after_global_init_slot'.

Not that easy to write a test how it might be possible to detect this kind of issue though... Let me think about it.

@doerk77
Copy link
Author

doerk77 commented Jun 15, 2022

Your output window looks weird, you get double outputs for some reason.

Seems to be an ADSLOGSTR / TwinCAT feature if you have 2 projects in a single solution.

@doerk77
Copy link
Author

doerk77 commented Jun 15, 2022

Your output window looks weird, you get double outputs for some reason.

Seems to be an ADSLOGSTR / TwinCAT feature if you have 2 projects in a single solution.

FYI: Just checked with Beckhoff support. Inside the IDE there's an event listener instantiated per project on the PLC. Therefore the event from ADSLOGSTR is being written to the Error List window twice.
However, as far as I can see this shouldn't cause any trouble. It's just a little annoying to see it pop up multiple times.

@sagatowski
Copy link
Member

@doerk77 Yes, you are correct. I just remember that there already was an issue on this particular topic:
#92

@sagatowski
Copy link
Member

Solved. Thanks for finding the problem @doerk77.

@sagatowski sagatowski added this to the Release 1.3.0.0 milestone Nov 26, 2023
@sagatowski sagatowski changed the title RUN_IN_SEQUENCE doesn't work for multiple TestSuites in 1.2.1.0 (current master) RUN_IN_SEQUENCE doesn't work for multiple TestSuites Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants