Storyteller 4.2.0


Next

Fixtures

Previous

Connecting Storyteller to your System

Profiles Edit on GitHub


A couple years back we hacked the idea of "profiles" into Storyteller 2 as a way to crudely do matrix testing against multiple browsers with a large Storyteller suite by just passing the browser name we wanted to use as a command line parameter. This functionality was standardized and simplified for Storyteller 3.

The Storyteller command line application allows you to pass an optional Profile as an optional flag when launching the application with usage like this:

st run src/Specifications --profile PhantomJS

-- or --

st open src/Specifications --profile Firefox

In your own application code, either in a custom ISystem or in Fixture classes, you can find the current profile used to lauch the application -- if one exists -- with this syntax (taken from some Storyteller testing code where we were testing timeouts):


public class SometimesSlowFixture : Fixture
{
    public void Slow()
    {
        if (Project.CurrentProfile == "slow")
        {
            Thread.Sleep(1.Minutes());
        }
    }


    public void ReadText([Editor("big-text")]string text)
    {
        
    }
}

If you are running the interactive specification tool, the profile name will be shown in parantheses next to the system name in the top of the browser page.

What might this be good for?

  • The original usage was to supply the name of the browser that WebDriver should use in tests against a web application
  • It has been useful in internal Storyteller testing for simulating failure conditions
  • Opting into heavier tracing for better debugging that might be too slow to run normally