Search in sources :

Example 1 with Script

use of org.jenkinsci.test.acceptance.plugins.scriptler.Script in project acceptance-test-harness by jenkinsci.

the class ScriptlerPluginTest method parameterized.

@Test
public void parameterized() {
    HashMap<String, String> params = new HashMap<>();
    params.put("lhs", "7");
    params.put("rhs", "11");
    Script script = scriptler.create("script1", "println lhs + ' + ' + rhs;", params);
    params = new HashMap<>();
    params.put("rhs", "9");
    assertThat(script.run(params).output(jenkins), equalTo("7 + 9"));
}
Also used : Script(org.jenkinsci.test.acceptance.plugins.scriptler.Script) HashMap(java.util.HashMap) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 2 with Script

use of org.jenkinsci.test.acceptance.plugins.scriptler.Script in project acceptance-test-harness by jenkinsci.

the class ScriptlerPluginTest method run_new_script.

@Test
public void run_new_script() {
    Script script = scriptler.upload(SIMPLE_SCRIPT);
    assertThat(script.exists(), is(true));
    String output = script.run().output(jenkins);
    assertThat(output, containsString("Hello world!"));
    script.delete();
    assertThat(script.exists(), is(false));
}
Also used : Script(org.jenkinsci.test.acceptance.plugins.scriptler.Script) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 3 with Script

use of org.jenkinsci.test.acceptance.plugins.scriptler.Script in project acceptance-test-harness by jenkinsci.

the class ScriptlerPluginTest method run_on_all_slaves.

@Test
public void run_on_all_slaves() throws Exception {
    Slave slaveA = slaves.install(jenkins).get();
    Slave slaveB = slaves.install(jenkins).get();
    Script script = scriptler.upload(SIMPLE_SCRIPT);
    ScriptResult output = script.runOnAllSlaves();
    assertThat(output.output(jenkins), nullValue());
    assertThat(output.output(slaveA), equalTo("Hello world!"));
    assertThat(output.output(slaveB), equalTo("Hello world!"));
}
Also used : ScriptResult(org.jenkinsci.test.acceptance.plugins.scriptler.ScriptResult) Script(org.jenkinsci.test.acceptance.plugins.scriptler.Script) Slave(org.jenkinsci.test.acceptance.po.Slave) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Example 4 with Script

use of org.jenkinsci.test.acceptance.plugins.scriptler.Script in project acceptance-test-harness by jenkinsci.

the class ScriptlerPluginTest method run_on_slave.

@Test
public void run_on_slave() throws Exception {
    Slave slave = slaves.install(jenkins).get();
    Script script = scriptler.upload(SIMPLE_SCRIPT);
    String output = script.runOn(slave).output(slave);
    assertThat(output, equalTo("Hello world!"));
}
Also used : Script(org.jenkinsci.test.acceptance.plugins.scriptler.Script) Slave(org.jenkinsci.test.acceptance.po.Slave) AbstractJUnitTest(org.jenkinsci.test.acceptance.junit.AbstractJUnitTest) Test(org.junit.Test)

Aggregations

AbstractJUnitTest (org.jenkinsci.test.acceptance.junit.AbstractJUnitTest)4 Script (org.jenkinsci.test.acceptance.plugins.scriptler.Script)4 Test (org.junit.Test)4 Slave (org.jenkinsci.test.acceptance.po.Slave)2 HashMap (java.util.HashMap)1 ScriptResult (org.jenkinsci.test.acceptance.plugins.scriptler.ScriptResult)1