How I saved development time with devMode while developing tests with Optimus

Pani Kumar
TestVagrant
Published in
2 min readOct 21, 2018

Any test automation at UI layer can be tiresome as you would be in following loop

  1. Write/Modify some test code
  2. Run test to observe the code’s behaviour
  3. Back to Step 1

Problem

This loop goes for several times to get the working piece. Every time a test runs, Optimus is going to install the application and does login (assuming the application has login). This could take approximately between 40 to 60 seconds depending on the application. This means we would lose 40 to 60 seconds of time every time we run a test.

devMode

Optimus saves this waste of time my means of devMode. Here is how you pass the system argument.

-DdevMode=true avoids application reset. This means when a test runs application won’t get installed and instead uses the application which is already present

Now, that we have avoided installation of application, we can save additional time by skipping login step, assuming you have already logged in to the application. Here is how we can do.

ConditionalRunner is a functional interface and StepSkipper skips doLogin method if devMode is true. This will avoid login step. However, butRun() allows to do any additional steps as necessary. This can be left blank if there is no additional steps needed.

Writing custom ConditionalRunners with -DdevMode=true can skip redundant steps and focus on the functionality of test which is under test.

--

--