All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.smartbear.readyapi.client.TestRecipeBuilder Maven / Gradle / Ivy

Go to download

Java client library for creating and executing test recipes against Ready!API TestServer

There is a newer version: 1.2.1
Show newest version
package com.smartbear.readyapi.client;

import com.smartbear.readyapi.client.model.TestCase;
import com.smartbear.readyapi.client.model.TestStep;
import com.smartbear.readyapi.client.teststeps.TestStepBuilder;

import java.util.LinkedList;
import java.util.List;

public class TestRecipeBuilder {
    private List testStepBuilders = new LinkedList<>();

    public TestRecipeBuilder addStep(TestStepBuilder testStepBuilder) {
        this.testStepBuilders.add(testStepBuilder);
        return this;
    }

    public TestRecipe buildTestRecipe() {
        TestCase testCase = new TestCase();
        testCase.setFailTestCaseOnError( true );
        addTestSteps(testCase);
        return new TestRecipe(testCase);
    }

    private void addTestSteps(TestCase testCase) {
        List testSteps = new LinkedList<>();
        for (TestStepBuilder testStepBuilder : testStepBuilders) {
            testSteps.add(testStepBuilder.build());
        }
        testCase.setTestSteps(testSteps);
    }

    public static TestRecipeBuilder newTestRecipe() {
        return new TestRecipeBuilder();
    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy