Skip to content

Commit

Permalink
Add skeleton test for new Gatling "step"
Browse files Browse the repository at this point in the history
This commit just adds a skeleton test that we will be able to use
to test a new Gatling pipeline "step" when we add it.  The commit
also adds dependencies on the Jenkins plugins that are required
to get the test running.

The Gatling step itself will be introduced in a subsequent commit.
  • Loading branch information
cprice404 committed May 17, 2016
1 parent 9b0944a commit ed9df4b
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,24 @@
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>

<!-- dependencies on Jenkins Pipeline plugins -->
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
<version>1.14</version>

This comment has been minimized.

Copy link
@jglick

jglick May 19, 2016

Should be using <scope>test</scope> for all these.

This comment has been minimized.

Copy link
@cprice404

cprice404 May 19, 2016

Author Owner

orly?

I guess that makes sense in this commit; in the subsequent ones when I have a real build step defined, some of these become hard deps, though, right? at least workflow-steps-api?

</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId>
<version>1.14</version>
</dependency>
<!-- TODO: may just be using this for testing, can probably remove -->
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-basic-steps</artifactId>
<version>1.14</version>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/**
* Copyright 2011-2015 GatlingCorp (http://gatling.io)
*
* 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 io.gatling.jenkins.steps;

import org.apache.commons.lang.StringUtils;
import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
import org.junit.Assert;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;

import java.util.Arrays;

public class GatlingArchiverStepTest extends Assert {
@Rule public JenkinsRule j = new JenkinsRule();

/**
* Test archiving of gatling reports
*/
@Test
public void archive() throws Exception {
// job setup
WorkflowJob foo = j.jenkins.createProject(WorkflowJob.class, "foo");
foo.setDefinition(new CpsFlowDefinition(StringUtils.join(Arrays.asList(
"node {",
" echo 'hi'",
"}"), "\n")));

// get the build going, and wait until workflow pauses
WorkflowRun b = j.assertBuildStatusSuccess(foo.scheduleBuild2(0).get());

assertEquals(true, true);
}
}

0 comments on commit ed9df4b

Please sign in to comment.