plone / plone.app.testing

Testing tools for Plone-the-application
http://pypi.python.org/pypi/plone.app.testing
2 stars 7 forks source link

Use dexterity instead of AT for PloneTestCase #50

Closed pbauer closed 6 years ago

pbauer commented 6 years ago

For now this is just a crazy experiment. Porting all tests away from PloneTestCase seems way more work that migrating the layer and fixing the tests. Also we have no replacement for self.publish in the modern testlayers.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at ?% when pulling a0d77f9e9c1b28c54c4ed976199169e1b99e1456 on use_dexterity into 7d5eb0fec2179549fcaa08b830db5b95bf72d2ea on py3.

pbauer commented 6 years ago

This change increased the number of running test in python 3 by +748 and added 310 failing tests (https://jenkins.plone.org/view/PLIPs/job/plip-py3/463). So in raw numbers that seems like a good idea.

I'm willing to fix all these tests (mosty replace obj.setFoo('bar') with obj.foo = 'bar'). One alternative would be to provide a self.publish method in in plone.app.testing. Another is to migrate all tests that use self.publish to now use restrictedTraverse or the testbrowser.

Opinions or other options?

pbauer commented 6 years ago

Some more things:

Most importantly:

gforcada commented 6 years ago

Regarding your comments:

You are doing a great job! If you need more hands, it might be a good idea to create a tracker ticket to give bite sized chunks of things to port, something that one could do in some free hours during an afternoon or weekend.

I myself tried to fix some failing tests the other day and was a bit let down as there was someone else already working on it as well and it was a bit confusing how thing should get merged and how to actually check that what you are doing is actually improving the situation.

These examples that you are giving now about "just" changing this or that to fix some tests, might be a good idea to have them as these tasks I was mentioning.

pbauer commented 6 years ago

I just realized that this will break many tests in Archetypes, ATContentTypes and related packages since they now get DX as content. We should create a py2-only testlayer for these Tests exactly like the old PloneTestCase and have all test in AT-packages and ATCTSiteTestCase use that.

gforcada commented 6 years ago

@pbauer we can create a layer on those packages to override the changes done here. I guess this is possible, right?

pbauer commented 6 years ago

I'm not sure if that's possible without changing the imports of PloneTestCase for all tests. And if we need to do that it does not really matter if we overwrite the existing one or use a new one. Luckly many tests already use ATCTTypeTestCase and changing that is easy.

pbauer commented 6 years ago

I can start working on that next week since I'm currently busy with client-work. So if you want to tackle that please go ahead 😄