Alex Smolov
Alex Smolov

Reputation: 1861

Testing one Rails app within another

On edx.org there is Software as a Service course that grades all submitted assignments.

You upload a zip-file with a Rails project and they run a bunch of integration and unit tests.

How do they do it?

My thoughts are they mount an uploaded application as Rails engine. Is it possible to test one Rails app within another? I'd like to create a similar service, but I don't know what to start with.

Upvotes: 1

Views: 118

Answers (1)

Mike K.
Mike K.

Reputation: 3789

I would imagine you could do this in a similar way that Jenkins runs continuous testing on a project. Where each project uploaded to your site gets expanded into a workspace, and then you shell out and execute commands. But that allows for a lot of variable configurations and complexity that probably doesn't make sense in the scope you've proposed. It also doesn't protect your underlying OS from the projects your testing.

You could also probably use an application container like docker and manage each uploaded application that way as well, which would keep everything self-contained, and isolate the application from the OS. It also puts the onus on the developer to package and manage dependencies correctly. I'm guessing they are probably using docker or something similar, here's an example Using Docker for MOOCS

At the point you want to capture the test results and report them back, I'd think they probably use something similar to the Junit formatter for Rspec or they just parse the rspec output directly.

Upvotes: 1

Related Questions