Skip to content

Migrating to Optimus 2.3.3 Beta

Krishnanand B edited this page Feb 7, 2018 · 1 revision

Optimus 2.3.3 Beta brings in a lot of new changes framework wise, however, the migration would be simple.

Step 1

Create a new directory libs under your project root.

Step 2

Download Optimus-services jar into your libs folder from here

Step 3

Update following sections in your build.gradle

Update Optimus Section

optimus {
   testFeed = System.getProperty("testFeed");
   tags = System.getProperty("tags");
   devMode = System.getProperty("devMode");
   regression = System.getProperty("regression");
   env = System.getProperty("env", "integration");
   classpath = sourceSets.test.runtimeClasspath
 }

Add Services Section

service {
    database = System.getProperty("database", "optimus")
    port = System.getProperty("port", "8090")
    uri = System.getProperty("uri", "mongodb://localhost:27017")
}

Update Optimus Execution rules

tasks.runFragmentation.dependsOn 'clean', 'build','spinServices'
tasks.runDistribution.dependsOn 'clean', 'build','spinServices'
tasks.build.mustRunAfter 'clean'
tasks.runFragmentation.finalizedBy 'fragmentationReport'
tasks.runDistribution.finalizedBy 'distributionReport'
tasks.fragmentationReport.finalizedBy 'stopServices'
tasks.distributionReport.finalizedBy 'stopServices'

Update Optimus Gradle version to 2.3.2

buildscript {
    repositories {
        maven {
            url "https://plugins.gradle.org/m2/"
        }
        mavenCentral()
    }
    dependencies {
        classpath "gradle.plugin.com.testvagrant.optimus:OptimusGradle:2.3.2"
    }

}

Update project dependencies to below

compile group: 'com.testvagrant', name: 'optimus', version: '2.3.3-beta'
compile 'com.testvagrant.stepdefs:stepdefs:1.0.7'
compile 'com.testvagrant.intents:intents:1.0.6'

You are now good to run your tests. But wait, you might be wondering, what's the point if all these changes doesnt add any value to the way you trigger tests??

We have something in store for you.

You can now run tests pointing to a specific mongo instance (localhost being default) and with custom db name(optimus being default)

Here are the updated commands.

Fragmentation

./gradlew runFragmentation -DtestFeed=<YourTestFeedName> -Dtags=<comma seperated tags> -Ddatabase=<custom database name> -Duri=<your mongo instance uri>

Distribution

./gradlew runDistribution -DtestFeed=<YourTestFeedName> -Dtags=<comma seperated tags> -Ddatabase=<custom database name> -Duri=<your mongo instance uri>