-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
WIP: Fusion Tests inside of Fusion #3572
Conversation
d48efac
to
af08cb0
Compare
Extracted the testcase into own Package |
@mhsdesign sorry for sidetracking this with the idea to separate the testing into an extra package. Just noticed how much changes would be needed with almost non existing gain in neos/flow-development-collection#2683. I am sorry for causing extra work and agree that the base testcase should be in tests in the neos/fusion package. |
Sure we can keep it in Neos.Fusion ;) how can we proceed?But before i move this again i would like to know how we can proceed. Maybe we can roll this out with 8.0 - we dont have to rewrite all tests but id like that we then have agreed on a syntax and implementation. in terms of syntax and implementation id like to abstact as less as possible (eg. make the testCase accessible in eel) or as i wrote in slack:
|
Added an issue for tracking on the release boards, no pressure to finish this for Neos 8.0 as this is a clear feature that can be added later aswell. Would still be nice if we would manage to get this in. |
arent we basically trying to build our own behat? - why not use it directly ^^ |
Sounds a bit like it, I agree... |
Would be fine with that aswell |
but behat files wont give us fancy fusion syntax highlighting ... (for inline fusion snippets) edit: they do, if one writes it like:
|
Looks better so far than my totally in fusion approach: Feature: Fusion
As a developer i want to write Fusion because Fusion is cool
Scenario: Simple value
Given I have this Fusion
"""
include: resource://Neos.Fusion/Private/Fusion/Root.fusion
root = Neos.Fusion:Value {
value = "abc"
}
"""
Then I expect to have the following result for path "root"
"""
abc
"""
Scenario: Simple array
Given I have this Fusion
"""
include: resource://Neos.Fusion/Private/Fusion/Root.fusion
root = Neos.Fusion:DataStructure {
foo = "bar"
}
"""
Then I expect to have the following json array for path "root"
"""
{
"foo": "bar"
}
"""
|
I agree, that looks really nice and is really easy to understand. |
i will close this pr, and make a new WIP one based on behat. (just too keep the original idea and code seperately) |
I was inspired by this comment: #2729 (comment)
and started this WIP idea...
Currently all functional fusion tests still need to be registered manually in the corresponding php test class and also the expected results are located on the php site. This PR attempts to put this closer to fusion ... in fusion.
The idea is we leverage php units dataprovider and parse the fusion beforehand then look for all paths on the first level who end with 'Test' and yield a configuration (which is generated only from the ast - not at runtime)
run the tests via the usual:
test generation in more detail:
get all first level paths which end with 'Tests' or which are a Neos.Fusion.Testing:TestCase
it can have multiple test and fusion data providers - which will be in mixed combinations evaluated.
return values of @beforeRender and @afterRender are ignored, their purpose is to call methods on the context objects:
php unit dataproviders
using dataproviders has the advantage, that each fusion test is treated separately from another fusion tests, and so if one test fails - not everything breaks.
Also filtering with --filter works:
exception messages when one test fails are also fairly readable:
...FusionTestsFusion\FusionTestsFusionTest::assertFusionRendersAsExpected with data set "dataStructureTest.nestingWithNonExistingChildObject with: scenario[1] provider[1]"
how to write the new tests?
i put some working examples in the
Fixtures/Fusion/FusionTestsFusion/
dir.you can run those from the flow root with:
Checklist
... what do you say?
i did create two new folders and so as this is WIP and just a demo ^^
see #3594