Passing arguments to Intern tests

theinternWe have started to use Intern to test MAGICapp, a medical guideline authoring application we are currently working on. I wanted the flexibility to run a test against any of our environments and didn’t want to hard code the server host name into the test. After looking through the Intern wiki and related blog posts I found nothing to explain how to pass an arguments into a test.

Digging in the source of the Intern I found ‘intern/lib/args‘ which has the following comment in the top of the file:

So if you include ‘intern/lib/args’ into your tests you’ll be able to pass the host you want to test against. You could pass other things like if the test should be ‘read’ or ‘write’ as you may not want to run tests that change data again your production application.

You can then pass arguments via the command line when you start you tests.

Feel free to reach out to us with your web application automation questions or needs.