-
Notifications
You must be signed in to change notification settings - Fork 76
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
Test results of nested test suites don't show up in result summary #206
Comments
Why would you call a test suite from a test suite? Tests should be independent from each other. |
How else can you prepare objects before testing them? I want to prepare an array of objects, and then call the test suite with the array as input. |
Declare the objects in the same test suite (or better yet, in the testcase) where you test the object under test. |
Declaring the objects in each test case requires rewriting the whole test for each implementation of an interface. This way, I only have to prepare the objects once for each implementation, and I use the interface in the test. |
Sorry, I don't understand your description. Can you elaborate (with code snippets)? |
I made a quick proof of concept here https://github.com/Bulkje/TcUnitSandbox In my example I can add another implementation of ISum, and keep the tests the same, just have to add a new prepare method. This also allows me to add IMultiply easily for example. |
You seem to have uploaded the wrong example. The tests seem to not even have a TEST() and TEST_FINISHED()-method defined. Did you read the documentation for how to write tests at the TcUnit.org website? |
The test suite that has tests in it is SumTest, it is instantiated in CalculatorTest and BrokenCalculatorTest which are instantiated in MAIN. I cloned the .git again in a new local repository and it works fine for me. |
Did you have a chance to look at this more thoroughly? |
Hi! Unfortuanetly not, I'm currently overloaded with work. Anyone else in the TcUnit community? |
@Bulkje Also, your tests are missing A test-suite should not depend on another test-suite, and a test should not depend on another test. You can however have as many test suites as you want that test (similar) behaviour, but it doesn't mean that you have to link the test-suites to each other but you can simply create them independently from each other. The same applies to tests. |
Whoops, must've changed the code a bit since taking the screenshot. Creating a new test suite for each implementation of an interface is doing double work or code duplication. That is, the implementations of the interfaces should perform the same behaviour. (So they should be tested with the same test code). I'm not familiar with xUnit, how would it handle using the same test code for testing multiple classes / fb's / etc. ? |
So you have some behaviour you want to verify? But you want to implement that behaviour in multiple ways? Write a test suite for the behaviour you want to test. Then create a test if you have different variants you want to test. |
Describe the bug
When calling a test suite inside another test suite, the results of that test suite are not added to the result summary
To Reproduce
Make a test suite (A), add another test suite (B) as a var to A. Call test suite B in the body of A.
Expected behavior
Expected behaviour is that all the test results count towards the test result summary
Screenshots
(there's only 1 Assert in the test, different instantiations)
Software versions
TcUnit v1.2.0.0 TwinCAT 4024.12
Run environment
local on PC runtime
Additional context
You would ask, why would you need nested tests? I want to use the same test suite for multiple implementations of an interface. Each implementation requires a different setup, so I want to call the testSuite in the body and input prepared objects.
The text was updated successfully, but these errors were encountered: