Creating test content automatically

26 views
Skip to first unread message

Oscar Farg

unread,
Nov 27, 2015, 10:05:39 AM11/27/15
to hippo-c...@googlegroups.com
Hi,

On our project we have a pretty big suite of testcases that use testcontent in the cms to check if everything is working according to specs.

The problem with the current set up is that a lot of tests are dependent on test content that was manually created in the T-environment. This makes it really hard to run automated tests on other environments were that content is not available. Manually copying the content to other environments is not really an option because we want to be able to run the tests on production as well.

All our tests are selenium based and currently some tests already use selenium to create and remove documents. This takes a lot of developer effort each time a new document type has to be tested and it's also very slow because selenium uses a lot of pause to make sure everything is loaded.

Because of this problem we're looking for another way to create test content on the fly when running the functional tests. I'm thinking of something were we load an xml-file with test content directly into the CMS or something like that. Maybe by using a REST-service to create a document based on the XML. Does anything like that already exists in Hippo or is the only way to create documents over HTTP by using the CMS GUI? In that case i would have to write something myself. I think I can use the 'REPOSITORY JAX-RS SERVICE' for that, am I right?

Does anyone have other ideas about this? I'm sure were not the only project that is facing issues with creating test content in Hippo. 

Kind regards,

Oscar Farg

Tobias Jeger

unread,
Nov 27, 2015, 10:16:04 AM11/27/15
to hippo-c...@googlegroups.com
Hi Oscar,

this may not be the nicest solution, but I imagine you could bootstrap (and remove, afterwards) test content by having selenium use the Hippo Console and use its XML import feature?

cheers

Tobi


--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at http://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.



--
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
Boston - 101 Main Street, Cambridge, MA 02142

US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466
www.onehippo.com

Jasper Floor

unread,
Nov 30, 2015, 4:39:17 AM11/30/15
to Hippo Community
The requirement to run tests in production makes this more difficult. I would also caution you about running tests in a production environment. If you do run into problems with your tests you also risk leaving your repository in a dirty state. Of course, these tests will also have been run on safer environments so the risk is minimal. If you only run tests that don't add or change content on production this should not be an issue.

For non production environments it should be simple enough to prepare a db and restore it when necessary. Rather than do a dump and restore you can have two copies of the database. Just drop one and recreate with the copy you don't touch. For production you could use selenium like Tobias suggests or you could use a groovy runner or a rest service. Personally I would use a groovy runner but any of these would work. I don't like selenium for this because, as you point out, it can be slow. Unless there is a need to test the creation of a document (eg custom workflows). 

You can also use a groovy updater to clean up your test content. Again, this is risky in a production environment because tests can fail and leave the data in an unexpected state. 

mvg,
Jasper

Oscar Farg

unread,
Nov 30, 2015, 5:52:47 AM11/30/15
to hippo-c...@googlegroups.com
I'm not in favor of running the tests on production either but at least on the acceptance server should be possible. The acceptance server runs a copy of the production database so we can't restore that to a database with test content. That is what we currently do on our Test server. We can easily backup and restore that database through jenkins.

I'll see what I can do with a groovy runner, thanks.

Michiel Rop

unread,
Dec 1, 2015, 12:57:30 AM12/1/15
to Hippo Community
Hi,

About test content for Integration tests like Selenium:
  • I recommend treating this content like code:
    • Create a separate module containing test content;
    • Make sure sure it loads "on top" of your bootstrap content;
    • Check it in into your source control system
    • Start the CMS with a separate Profile, e.g. -Ptest to load the test content.
In that way you're able to load test content on any environment and keep your integration tests in sync with the test content.

This approach has been used so far by two big clients.
Reply all
Reply to author
Forward
0 new messages