Skip to content

Commit

Permalink
added automation for bug#93
Browse files Browse the repository at this point in the history
  • Loading branch information
sudheerkethireddy committed Sep 28, 2016
1 parent 627f8f1 commit a927e40
Showing 1 changed file with 72 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*******************************************************************************
* Copyright 2016 Intuit
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
package com.intuit.wasabi.tests.service;

import static com.intuit.wasabi.tests.library.util.ModelAssert.assertEqualModelItems;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.testng.Assert;
import org.testng.annotations.Test;

import com.intuit.wasabi.tests.library.TestBase;
import com.intuit.wasabi.tests.library.util.Constants;
import com.intuit.wasabi.tests.library.util.serialstrategies.DefaultNameExclusionStrategy;
import com.intuit.wasabi.tests.model.Bucket;
import com.intuit.wasabi.tests.model.Experiment;
import com.intuit.wasabi.tests.model.factory.BucketFactory;
import com.intuit.wasabi.tests.model.factory.ExperimentFactory;

/**
*
* @created on 09/28/2016 as part of below issue
* https://github.com/intuit/wasabi/issues/93
*
* steps followed
* beforetest: setup require data
* test: do a post on the
* aftertest: clean
*/
public class PastDatedExperimentCreationTest extends TestBase{
static final Logger LOGGER = LoggerFactory.getLogger(PastDatedExperimentCreationTest.class);
Experiment experiment;

@Test
public void testSetUp()
{
experiment = ExperimentFactory.createPreviousDatedExperiment();
DefaultNameExclusionStrategy experimentComparisonStrategy = new DefaultNameExclusionStrategy("creationTime", "modificationTime", "ruleJson");
experiment.setSerializationStrategy(experimentComparisonStrategy);
Experiment exp = postExperiment(experiment);
Assert.assertNotNull(exp.creationTime, "Experiment creation failed (No creationTime).");
Assert.assertNotNull(exp.modificationTime, "Experiment creation failed (No modificationTime).");
Assert.assertNotNull(exp.state, "Experiment creation failed (No state).");
experiment.update(exp);

//create buckets within the experiment
List<Bucket> buckets = postBuckets(BucketFactory.createCompleteBuckets(experiment, 2));
Assert.assertEquals(buckets.size(), 2);

//change the state of experiment to running
experiment.state = Constants.EXPERIMENT_STATE_RUNNING;
exp = putExperiment(experiment);
assertEqualModelItems(exp, experiment);
}


}

0 comments on commit a927e40

Please sign in to comment.