forked from jenkinsci/gatling-plugin
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add skeleton test for new Gatling "step"
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
Showing
2 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
cprice404
Author
Owner
|
||
</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> | ||
|
50 changes: 50 additions & 0 deletions
50
src/test/java/io/gatling/jenkins/steps/GatlingArchiverStepTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
|
Should be using
<scope>test</scope>
for all these.