();
29 | }
30 |
31 | public void testAcceptanceTestMojos()
32 | throws Exception {
33 | executeFailingGoals(PLUGIN + ":acceptance-test", PLUGIN + ":verify");
34 | assertFilePresent("target/robotframework-reports/TEST-acceptance.xml");
35 | }
36 |
37 | public void testLibdocMojo() throws IOException, VerificationException {
38 | executeGoals(PLUGIN + ":libdoc");
39 | assertFilePresent("target/robotframework/libdoc/JustForIT.html");
40 | }
41 |
42 | public void testOverrideFromCommandPrompt() throws IOException, VerificationException {
43 | cliOptions.add("-Dtests=successful*");
44 | executeGoals(PLUGIN + ":acceptance-test",PLUGIN + ":verify");
45 | assertFilePresent("target/robotframework-reports/TEST-acceptance.xml");
46 | }
47 |
48 | public void testOverrideListsFromCommandPrompt() throws IOException, VerificationException {
49 | cliOptions.add("-Dtests=foo,successful*,bar");
50 | cliOptions.add("-Dsuites=foo,successful*,bar");
51 | executeGoals(PLUGIN + ":acceptance-test",PLUGIN + ":verify");
52 | assertFilePresent("target/robotframework-reports/TEST-acceptance.xml");
53 | }
54 |
55 | public void testPomWithTestsConfigured() throws IOException, VerificationException {
56 | cliOptions.add("-f");
57 | cliOptions.add("pom_with_tests_configured.xml");
58 | executeGoals(PLUGIN + ":acceptance-test",PLUGIN + ":verify");
59 | assertFilePresent("target/robotframework-reports/TEST-acceptance.xml");
60 | }
61 |
62 | public void testVerificationIgnoresNonCritical() throws IOException, VerificationException {
63 | cliOptions.add("-f");
64 | cliOptions.add("pom_with_noncritical_failures.xml");
65 | executeGoals(PLUGIN + ":acceptance-test",PLUGIN + ":verify");
66 | assertFilePresent("target/robotframework-reports/TEST-acceptance.xml");
67 | }
68 |
69 | public void testPomWithTestsConfiguredOverridden() throws IOException, VerificationException {
70 | cliOptions.add("-f");
71 | cliOptions.add("pom_with_tests_configured.xml");
72 | cliOptions.add("-Dtests=failing*");
73 | executeFailingGoals(PLUGIN + ":acceptance-test", PLUGIN + ":verify");
74 | assertFilePresent("target/robotframework-reports/TEST-acceptance.xml");
75 | }
76 |
77 | public void testOverrideVariable() throws IOException, VerificationException {
78 | cliOptions.add("-f");
79 | cliOptions.add("pom_with_tests_configured.xml");
80 | cliOptions.add("-Dtests=FailingBasedOnVariable");
81 | cliOptions.add("-Dvariables=VariableThatShouldBeOverridden:permanent,ExtraVariableFromPrompt:overridden");
82 | executeGoals(PLUGIN + ":acceptance-test", PLUGIN + ":verify");
83 | assertFilePresent("target/robotframework-reports/TEST-acceptance.xml");
84 | }
85 |
86 | public void testClasspath() throws IOException, VerificationException {
87 | cliOptions.add("-f");
88 | cliOptions.add("pom_with_classpaths.xml");
89 | executeGoals(PLUGIN + ":acceptance-test", PLUGIN + ":verify");
90 | assertFilePresent("target/robotframework-reports/TEST-classpath-acceptance.xml");
91 | }
92 |
93 | public void testWithoutClasspath() throws IOException, VerificationException {
94 | cliOptions.add("-f");
95 | cliOptions.add("pom_without_classpaths.xml");
96 | executeGoals(PLUGIN + ":acceptance-test", PLUGIN + ":verify");
97 | assertFilePresent("target/robotframework-reports/TEST-classpath-acceptance.xml");
98 | }
99 |
100 | public void testPomWithExternalRunner() throws IOException, VerificationException {
101 | cliOptions.add("-f");
102 | cliOptions.add("pom_with_external_runner.xml");
103 | executeGoals(PLUGIN + ":acceptance-test",PLUGIN + ":verify");
104 | assertFilePresent("target/robotframework-reports/TEST-acceptance.xml");
105 | }
106 |
107 | public void testVerificationIsSkippedIfTestsAre() throws IOException, VerificationException {
108 | cliOptions.add("-DskipATs");
109 | executeGoals(PLUGIN + ":acceptance-test",PLUGIN + ":verify");
110 | }
111 |
112 | private void assertFilePresent(String file) {
113 | verifier.assertFilePresent(new File(testDir, file).getAbsolutePath());
114 | }
115 |
116 | private void executeGoals(String... goals) throws VerificationException, IOException {
117 | verifier.setCliOptions(cliOptions);
118 | verifier.deleteDirectory("target/robotframework-reports");
119 | verifier.deleteDirectory("target/robotframework");
120 | verifier.executeGoals(Arrays.asList(goals));
121 | verifier.displayStreamBuffers();
122 | verifier.resetStreams();
123 | }
124 |
125 | private void executeFailingGoals(String... goals) throws IOException {
126 | verifier.setCliOptions(cliOptions);
127 | verifier.deleteDirectory("target/robotframework-reports");
128 | verifier.deleteDirectory("target/robotframework");
129 | try {
130 | verifier.executeGoals(Arrays.asList(goals));
131 | fail("verify goal should fail the build");
132 | } catch (VerificationException e) {
133 | String message = e.getMessage();
134 | assertThat(message, containsString("There are acceptance test failures"));
135 | System.out.println(message);
136 | }
137 | verifier.displayStreamBuffers();
138 | verifier.resetStreams();
139 | }
140 |
141 | }
142 |
--------------------------------------------------------------------------------
/src/test/java/org/robotframework/mavenplugin/AcceptanceTestMojoTest.java:
--------------------------------------------------------------------------------
1 | package org.robotframework.mavenplugin;
2 |
3 | import static org.hamcrest.MatcherAssert.assertThat;
4 | import static org.hamcrest.Matchers.hasXPath;
5 |
6 | import java.io.File;
7 | import java.io.IOException;
8 |
9 | import javax.xml.parsers.DocumentBuilder;
10 | import javax.xml.parsers.DocumentBuilderFactory;
11 | import javax.xml.parsers.ParserConfigurationException;
12 |
13 | import org.apache.maven.plugin.testing.AbstractMojoTestCase;
14 | import org.w3c.dom.Document;
15 | import org.xml.sax.SAXException;
16 |
17 |
18 | public class AcceptanceTestMojoTest
19 | extends AbstractMojoTestCase {
20 |
21 | public void setup()
22 | throws Exception {
23 | super.setUp();
24 | }
25 |
26 | public void testShouldSucceed()
27 | throws Exception {
28 | File pom = getTestFile("src/test/resources/pom-success.xml");
29 | AcceptanceTestMojo mojo = (AcceptanceTestMojo) lookupMojo("acceptance-test", pom);
30 | mojo.execute();
31 | File xunitFile = getTestFile("target/robotframework-reports/TEST-robot-success.xml");
32 | assertTrue("missing xunit test report " + xunitFile, xunitFile.exists());
33 |
34 | Document xunit = parseDocument(xunitFile);
35 | assertThat(xunit, hasXPath("/testsuite[@errors='0']"));
36 | assertThat(xunit, hasXPath("/testsuite[@failures='0']"));
37 | assertThat(xunit, hasXPath("/testsuite[@tests='2']"));
38 | }
39 |
40 | public void testShouldFail()
41 | throws Exception {
42 | File pom = getTestFile("src/test/resources/pom-fail.xml");
43 | AcceptanceTestMojo mojo = (AcceptanceTestMojo) lookupMojo("acceptance-test", pom);
44 |
45 | mojo.execute();
46 |
47 | // output.xml contains failure
48 | File xunitFile = getTestFile("target/robotframework-reports/TEST-robot-fail.xml");
49 | assertTrue("missing xunit test report " + xunitFile, xunitFile.exists());
50 |
51 | Document xunit = parseDocument(xunitFile);
52 |
53 | assertThat(xunit, hasXPath("/testsuite[@failures='5']"));
54 | assertThat(xunit, hasXPath("/testsuite[@errors='0']"));
55 | assertThat(xunit, hasXPath("/testsuite[@tests='5']"));
56 |
57 | assertThat(xunit, hasXPath("//failure[@message = '1.0 != 2.0']"));
58 | assertThat(xunit, hasXPath("//failure[@message = '4.0 != 5.0']"));
59 | assertThat(xunit, hasXPath("//failure[@message = '5.0 != 6.0']"));
60 | assertThat(xunit, hasXPath("//failure[@message = '9.0 != 10.0']"));
61 | assertThat(xunit, hasXPath("//failure[@message = '11.0 != 12.0']"));
62 |
63 | }
64 |
65 | private Document parseDocument(File xunitFile)
66 | throws ParserConfigurationException, SAXException, IOException {
67 | DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
68 | DocumentBuilder builder = documentBuilderFactory.newDocumentBuilder();
69 | Document xunit = builder.parse(xunitFile);
70 | return xunit;
71 | }
72 |
73 | public void testHsqlShouldPass()
74 | throws Exception {
75 | File pom = getTestFile("src/test/resources/pom-hsqldb.xml");
76 | AcceptanceTestMojo mojo = (AcceptanceTestMojo) lookupMojo("acceptance-test", pom);
77 | mojo.execute();
78 |
79 | File xunitFile = getTestFile("target/robotframework-reports/TEST-robot-hsqldb.xml");
80 | assertTrue("missing xunit test report " + xunitFile, xunitFile.exists());
81 |
82 | Document xunit = parseDocument(xunitFile);
83 | assertThat(xunit, hasXPath("/testsuite[@errors='0']"));
84 | assertThat(xunit, hasXPath("/testsuite[@failures='0']"));
85 | }
86 |
87 | public void testErrorSuiteNotFound()
88 | throws Exception {
89 | File pom = getTestFile("src/test/resources/pom-error.xml");
90 | AcceptanceTestMojo mojo = (AcceptanceTestMojo) lookupMojo("acceptance-test", pom);
91 | mojo.execute();
92 | File xunitFile = getTestFile("target/robotframework-reports/TEST-nothing-here.xml");
93 | assertTrue("missing xunit test report " + xunitFile, xunitFile.exists());
94 |
95 | Document xunit = parseDocument(xunitFile);
96 | assertThat(xunit, hasXPath("/testsuite[@errors='1']"));
97 | assertThat(xunit, hasXPath("/testsuite/testcase/error[@message = 'Invalid test data or command line options (Returncode 252).']"));
98 | }
99 |
100 | public void testErrorInTestCase() {
101 | // TODO assert that xunitfile is not overwritten, if available
102 | }
103 |
104 |
105 | }
106 |
--------------------------------------------------------------------------------
/src/test/java/org/robotframework/mavenplugin/ArgumentsTest.java:
--------------------------------------------------------------------------------
1 | package org.robotframework.mavenplugin;
2 |
3 | import java.io.File;
4 |
5 | import junit.framework.TestCase;
6 |
7 |
8 | public class ArgumentsTest
9 | extends TestCase {
10 |
11 | public void testNONEFilePathParsing() {
12 | Arguments args = new Arguments();
13 | args.addFileToArguments(new File(new File("NONE").getAbsolutePath()), "-l");
14 | assertEquals("NONE", args.toArray()[1]);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/test/java/org/robotframework/mavenplugin/ExampleLib.java:
--------------------------------------------------------------------------------
1 | package org.robotframework.mavenplugin;
2 |
3 | /**
4 | * Library for demo purposes. This library is only used in an example and it does't do anything useful.
5 | */
6 | public class ExampleLib {
7 |
8 | /**
9 | * Does nothing
10 | */
11 | public void myKeyword() {
12 | }
13 |
14 | /**
15 | * Takes one argument and *does nothing* with it. Example: | Your Keyword | xxx | | Your Keyword | yyy |
16 | */
17 | public void yourKeyword(String arg) {
18 | }
19 | }
--------------------------------------------------------------------------------
/src/test/java/org/robotframework/mavenplugin/LibDocMojoTest.java:
--------------------------------------------------------------------------------
1 | package org.robotframework.mavenplugin;
2 |
3 | import java.io.File;
4 |
5 |
6 | public class LibDocMojoTest
7 | extends AbstractRFMojoTestCase {
8 |
9 | private final String outputDirectory = "target/robotframework/libdoc/";
10 | private final String htmlResourceLibDoc = outputDirectory + "html_resource.html";
11 | private final String javalibLibDoc = outputDirectory + "ExampleLib.html";
12 | private final String mylibLibDoc = outputDirectory + "mylib.html";
13 | private final String mypackageMylibLibDoc = outputDirectory + "mypackage.mylib.html";
14 |
15 | protected void setUp()
16 | throws Exception {
17 | super.setUp();
18 | File outputDir = new File(outputDirectory);
19 | outputDir.mkdirs();
20 | deleteDocument(htmlResourceLibDoc);
21 | deleteDocument(javalibLibDoc);
22 | deleteDocument(mylibLibDoc);
23 | deleteDocument(mypackageMylibLibDoc);
24 | }
25 |
26 | public void testLibDocForJavaResource()
27 | throws Exception {
28 | executeLibdocWithPom("libdoc", "src/test/resources/pom-libdoc.xml");
29 | assertTrue(javalibLibDoc + " not found", new File(javalibLibDoc).exists());
30 | }
31 |
32 | public void testLibDocForTxtResource()
33 | throws Exception {
34 | executeLibdocWithPom("libdoc", "src/test/resources/pom-libdoc-robotfile.xml");
35 | assertTrue(htmlResourceLibDoc + " not found", new File(htmlResourceLibDoc).exists());
36 |
37 | }
38 |
39 | public void testLibDocForLibraryNamePython()
40 | throws Exception {
41 |
42 | executeLibdocWithPom("libdoc", "src/test/resources/pom-libdoc-libraryname-python.xml");
43 | assertTrue(mylibLibDoc + " not found", new File(mylibLibDoc).exists());
44 |
45 | }
46 |
47 | public void testLibDocForLibraryNamePythonWithPackage()
48 | throws Exception {
49 | executeLibdocWithPom("libdoc", "src/test/resources/pom-libdoc-libraryname-python-subpackage.xml");
50 | assertTrue(mypackageMylibLibDoc + " not found", new File(mypackageMylibLibDoc).exists());
51 |
52 | }
53 |
54 | public void testLibDocForLibraryNameJava()
55 | throws Exception {
56 | executeLibdocWithPom("libdoc", "src/test/resources/pom-libdoc-libraryname-java.xml");
57 | assertTrue(javalibLibDoc + " not found", new File(javalibLibDoc).exists());
58 |
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/test/java/org/robotframework/mavenplugin/RebotMojoTest.java:
--------------------------------------------------------------------------------
1 | package org.robotframework.mavenplugin;
2 |
3 | import static org.hamcrest.MatcherAssert.assertThat;
4 | import static org.hamcrest.Matchers.hasXPath;
5 |
6 | import java.io.File;
7 | import java.io.IOException;
8 |
9 | import javax.xml.parsers.DocumentBuilder;
10 | import javax.xml.parsers.DocumentBuilderFactory;
11 | import javax.xml.parsers.ParserConfigurationException;
12 |
13 | import org.apache.commons.io.FileUtils;
14 | import org.apache.maven.plugin.MojoExecutionException;
15 | import org.apache.maven.plugin.MojoFailureException;
16 | import org.apache.maven.plugin.testing.AbstractMojoTestCase;
17 | import org.w3c.dom.Document;
18 | import org.xml.sax.SAXException;
19 |
20 | public class RebotMojoTest extends AbstractMojoTestCase {
21 |
22 | public void setup() throws Exception {
23 | super.setUp();
24 | File outputDirectory = getTestFile("target/robotframework-report");
25 | outputDirectory.delete();
26 | }
27 |
28 | public void testReportSuccess() throws Exception {
29 | File pom = getTestFile("src/test/resources/pom-rebot.xml");
30 | this.executeRebotMojo(pom);
31 | File xunitFile = getTestFile("target/robotframework-reports/rebot/TEST-robot-success.xml");
32 | assertTrue("missing xunit test report " + xunitFile, xunitFile.exists());
33 |
34 | Document xunit = parseDocument(xunitFile);
35 | assertThat(xunit, hasXPath("/testsuite[@errors='0']"));
36 | assertThat(xunit, hasXPath("/testsuite[@failures='0']"));
37 | assertThat(xunit, hasXPath("/testsuite[@tests='4']"));
38 | }
39 |
40 | public void testReportSuccessMerged() throws Exception {
41 | File pom = getTestFile("src/test/resources/pom-rebot-merged.xml");
42 | this.executeRebotMojo(pom);
43 | File xunitFile = getTestFile("target/robotframework-reports/rebot/TEST-robot-success-merged.xml");
44 | assertTrue("missing xunit test report " + xunitFile, xunitFile.exists());
45 |
46 | Document xunit = parseDocument(xunitFile);
47 | assertThat(xunit, hasXPath("/testsuite[@errors='0']"));
48 | assertThat(xunit, hasXPath("/testsuite[@failures='0']"));
49 | //As same suite is runned twice, merge shows only 2 runs. Rebot knows that the cases
50 | //area same, and includes results in the cases itself.
51 | assertThat(xunit, hasXPath("/testsuite[@tests='2']"));
52 | }
53 |
54 | private Document parseDocument(File xunitFile) throws ParserConfigurationException, SAXException, IOException {
55 | DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
56 | DocumentBuilder builder = documentBuilderFactory.newDocumentBuilder();
57 | Document xunit = builder.parse(xunitFile);
58 | return xunit;
59 | }
60 |
61 | private void executeRebotMojo(File pom)
62 | throws MojoExecutionException, MojoFailureException {
63 | RebotMojo mojo;
64 | try {
65 | mojo = (RebotMojo) lookupMojo("rebot", pom);
66 | File outputDirectory = getTestFile("src/test/resources/output-for-rebot/");
67 | File targetDirectory = (File) getVariableValueFromObject(mojo, "outputDirectory");
68 | File[] files = outputDirectory.listFiles();
69 | for (int i = 0; i < files.length; i++) {
70 | FileUtils.copyFileToDirectory(files[i], targetDirectory);
71 | }
72 | } catch (Exception ex) {
73 | throw new RuntimeException("failed to prepare mojo execution", ex);
74 | }
75 | mojo.execute();
76 | }
77 | }
78 |
--------------------------------------------------------------------------------
/src/test/java/org/robotframework/mavenplugin/RobotFrameworkMojoTest.java:
--------------------------------------------------------------------------------
1 | package org.robotframework.mavenplugin;
2 |
3 | import org.apache.maven.plugin.MojoExecutionException;
4 | import org.apache.maven.plugin.MojoFailureException;
5 | import org.apache.maven.plugin.testing.AbstractMojoTestCase;
6 |
7 |
8 | import java.io.File;
9 |
10 | public class RobotFrameworkMojoTest
11 | extends AbstractMojoTestCase {
12 |
13 | public void setup()
14 | throws Exception {
15 | super.setUp();
16 | }
17 |
18 | public void testShouldSucceed()
19 | throws Exception {
20 | File pom = getTestFile("src/test/resources/pom-success.xml");
21 | RobotFrameworkMojo mojo = (RobotFrameworkMojo) lookupMojo("run", pom);
22 | mojo.execute();
23 | }
24 |
25 | public void testRunmodesShouldWork()
26 | throws Exception {
27 | File pom = getTestFile("src/test/resources/pom-runmodes.xml");
28 | RobotFrameworkMojo mojo = (RobotFrameworkMojo) lookupMojo("run", pom);
29 | mojo.execute();
30 | }
31 |
32 |
33 | public void testShouldSucceedWithExternalRunner()
34 | throws Exception {
35 | File pom = getTestFile("src/test/resources/pom-configure-runner.xml");
36 | RobotFrameworkMojo mojo = (RobotFrameworkMojo) lookupMojo("run", pom);
37 | mojo.execute();
38 | }
39 |
40 | public void testShouldFail()
41 | throws Exception {
42 | File pom = getTestFile("src/test/resources/pom-fail.xml");
43 | RobotFrameworkMojo mojo = (RobotFrameworkMojo) lookupMojo("run", pom);
44 | try {
45 | mojo.execute();
46 | fail("robot tests should have failed");
47 | } catch (MojoFailureException e) {
48 | assertTrue(true);
49 | }
50 | }
51 |
52 | public void testHsqlShouldPass()
53 | throws Exception {
54 | File pom = getTestFile("src/test/resources/pom-hsqldb.xml");
55 | RobotFrameworkMojo mojo = (RobotFrameworkMojo) lookupMojo("run", pom);
56 | mojo.execute();
57 | }
58 |
59 | public void testShouldHaveErrors()
60 | throws Exception {
61 |
62 | File pom = getTestFile("src/test/resources/pom-error.xml");
63 | RobotFrameworkMojo mojo = (RobotFrameworkMojo) lookupMojo("run", pom);
64 | try {
65 | mojo.execute();
66 | fail("robot tests should have errors");
67 | } catch (MojoExecutionException e) {
68 | assertTrue(true);
69 | }
70 |
71 | }
72 |
73 | }
74 |
--------------------------------------------------------------------------------
/src/test/java/org/robotframework/mavenplugin/RobotFrameworkSkipTest.java:
--------------------------------------------------------------------------------
1 | package org.robotframework.mavenplugin;
2 |
3 | import java.io.File;
4 |
5 | import org.apache.maven.plugin.MojoExecutionException;
6 | import org.apache.maven.plugin.MojoFailureException;
7 | import org.junit.Before;
8 | import org.junit.Test;
9 | import org.junit.runner.RunWith;
10 | import org.powermock.api.mockito.PowerMockito;
11 | import org.powermock.core.classloader.annotations.PrepareForTest;
12 | import org.powermock.modules.junit4.PowerMockRunner;
13 | import org.powermock.reflect.Whitebox;
14 | import org.robotframework.RobotFramework;
15 |
16 | @RunWith(PowerMockRunner.class)
17 | @PrepareForTest(RobotFramework.class)
18 | public class RobotFrameworkSkipTest {
19 |
20 | private RobotFrameworkMojo robotFrameworkMojo;
21 |
22 | @Before
23 | public void setUp() {
24 | PowerMockito.mockStatic(RobotFramework.class);
25 | robotFrameworkMojo = new RobotFrameworkMojo();
26 | }
27 |
28 | @Test
29 | public void testSkipTests()
30 | throws MojoExecutionException, MojoFailureException {
31 | Whitebox.setInternalState(robotFrameworkMojo, "skipTests", true);
32 | robotFrameworkMojo.execute();
33 | }
34 |
35 | @Test
36 | public void testSkip()
37 | throws MojoExecutionException, MojoFailureException {
38 | Whitebox.setInternalState(robotFrameworkMojo, "skip", true);
39 | robotFrameworkMojo.execute();
40 | }
41 |
42 | @Test
43 | public void testSkipATs()
44 | throws MojoExecutionException, MojoFailureException {
45 | Whitebox.setInternalState(robotFrameworkMojo, "skipATs", true);
46 | robotFrameworkMojo.execute();
47 | }
48 |
49 | @Test
50 | public void testSkipITs()
51 | throws MojoExecutionException, MojoFailureException {
52 | Whitebox.setInternalState(robotFrameworkMojo, "skipITs", true);
53 | robotFrameworkMojo.execute();
54 | }
55 |
56 | @Test
57 | public void testDontSkip()
58 | throws MojoExecutionException, MojoFailureException {
59 | String testsFolder = "tests";
60 | Whitebox.setInternalState(robotFrameworkMojo, "testCasesDirectory", new File(testsFolder));
61 | robotFrameworkMojo.execute();
62 |
63 | PowerMockito.verifyStatic(RobotFramework.class);
64 | RobotFramework.run(new String[]{"-x", "TEST-tests.xml", "--xunitskipnoncritical", testsFolder});
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/src/test/java/org/robotframework/mavenplugin/TestDocMojoTest.java:
--------------------------------------------------------------------------------
1 | package org.robotframework.mavenplugin;
2 |
3 | import java.io.File;
4 | import java.nio.charset.Charset;
5 |
6 | import org.apache.commons.io.FileUtils;
7 |
8 |
9 | public class TestDocMojoTest
10 | extends AbstractRFMojoTestCase {
11 |
12 | private final String outputDirectory = "target/robotframework/testdoc/";
13 |
14 | protected void setUp()
15 | throws Exception {
16 | super.setUp();
17 | File outputDir = new File(outputDirectory);
18 | outputDir.mkdirs();
19 | }
20 |
21 | public void testTestDocForTxtResource()
22 | throws Exception {
23 | executeLibdocWithPom("testdoc", "src/test/resources/pom-testdoc-robotfile.xml");
24 | String txtResourceTestDoc = outputDirectory + "invalid.html";
25 | assertTrue(txtResourceTestDoc + " not found", new File(txtResourceTestDoc).exists());
26 | }
27 |
28 | public void testTestDocForTxtResourceWithTitle()
29 | throws Exception {
30 | executeLibdocWithPom("testdoc", "src/test/resources/pom-testdoc-robotfile-title.xml");
31 | String txtResourceWithTitleTestDoc = outputDirectory + "invalid_login_title.html";
32 | assertTrue(txtResourceWithTitleTestDoc + " not found", new File(txtResourceWithTitleTestDoc).exists());
33 | String contents = FileUtils.readFileToString(new File(txtResourceWithTitleTestDoc), Charset.defaultCharset());
34 | assertTrue(contents.contains("\"title\":\"Custom Title\""));
35 | }
36 |
37 | public void testTestDocForTxtResourceWithName()
38 | throws Exception {
39 | executeLibdocWithPom("testdoc", "src/test/resources/pom-testdoc-robotfile-name.xml");
40 | String txtResourceWithNameTestDoc = outputDirectory + "invalid_login_name.html";
41 | assertTrue(txtResourceWithNameTestDoc + " not found", new File(txtResourceWithNameTestDoc).exists());
42 | String contents = FileUtils.readFileToString(new File(txtResourceWithNameTestDoc), Charset.defaultCharset());
43 | assertTrue(contents.contains("\"fullName\":\"Custom name\""));
44 | }
45 |
46 | public void testTestDocForTxtResourceWithDoc()
47 | throws Exception {
48 | executeLibdocWithPom("testdoc", "src/test/resources/pom-testdoc-robotfile-doc.xml");
49 | String txtResourceWithDocTestDoc = outputDirectory + "invalid_login_doc.html";
50 | assertTrue(txtResourceWithDocTestDoc + " not found", new File(txtResourceWithDocTestDoc).exists());
51 | String contents = FileUtils.readFileToString(new File(txtResourceWithDocTestDoc), Charset.defaultCharset());
52 | assertTrue(contents.contains("\"doc\":\"Custom documentation"));
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/test/java/org/robotframework/mavenplugin/VerifyMojoTest.java:
--------------------------------------------------------------------------------
1 | package org.robotframework.mavenplugin;
2 |
3 | import static org.hamcrest.MatcherAssert.assertThat;
4 | import static org.hamcrest.Matchers.containsString;
5 |
6 | import java.io.File;
7 | import java.io.FileOutputStream;
8 | import java.io.IOException;
9 | import java.io.InputStream;
10 | import java.io.OutputStream;
11 |
12 | import org.apache.maven.plugin.MojoExecutionException;
13 | import org.apache.maven.plugin.MojoFailureException;
14 | import org.apache.maven.plugin.testing.AbstractMojoTestCase;
15 |
16 |
17 | public class VerifyMojoTest
18 | extends AbstractMojoTestCase {
19 |
20 | public void setup()
21 | throws Exception {
22 | super.setUp();
23 | File outputDirectory = getTestFile("target/robotframework-report");
24 | outputDirectory.delete();
25 | }
26 |
27 | public void testReportSuccess()
28 | throws Exception {
29 | File pom = getTestFile("src/test/resources/pom-success.xml");
30 | String xunitResult = "/xunitresults/TEST-robot-success.xml";
31 | executeVerifyMojo(pom, xunitResult);
32 |
33 | }
34 |
35 | public void testReportFgailure()
36 | throws Exception {
37 | File pom = getTestFile("src/test/resources/pom-fail.xml");
38 | String xunitResult = "/xunitresults/TEST-robot-fail.xml";
39 | try {
40 | executeVerifyMojo(pom, xunitResult);
41 | fail("MojoFailureException expected");
42 | } catch (MojoFailureException ex) {
43 | assertThat(ex.getMessage(), containsString("failure"));
44 | }
45 | }
46 |
47 | public void testReportError()
48 | throws Exception {
49 | File pom = getTestFile("src/test/resources/pom-error.xml");
50 | String xunitResult = "/xunitresults/TEST-nothing-here.xml";
51 | try {
52 | executeVerifyMojo(pom, xunitResult);
53 | fail("MojoFailureException expected");
54 | } catch (MojoFailureException ex) {
55 | assertThat(ex.getMessage(), containsString("There are acceptance test failures"));
56 | }
57 | }
58 |
59 | private void executeVerifyMojo(File pom, String xunitResult)
60 | throws MojoExecutionException, MojoFailureException {
61 | VerifyMojo mojo;
62 | try {
63 | mojo = (VerifyMojo) lookupMojo("verify", pom);
64 |
65 | File xunitFile = (File) getVariableValueFromObject(mojo, "xunitFile");
66 | File outputDirectory = (File) getVariableValueFromObject(mojo, "outputDirectory");
67 |
68 | // copy from resources:
69 | InputStream resultFileInputStream = this.getClass().getResourceAsStream(xunitResult);
70 | copyXunitReport(resultFileInputStream, outputDirectory, xunitFile);
71 | } catch (Exception ex) {
72 | throw new RuntimeException("failed to prepare mojo execution", ex);
73 | }
74 | mojo.execute();
75 | }
76 |
77 | private void copyXunitReport(InputStream resultFileInput, File outputDirectory, File targetFile)
78 | throws IOException {
79 | File xunitOutput = getXunitOutput(outputDirectory, targetFile);
80 |
81 | OutputStream out = new FileOutputStream(xunitOutput);
82 | byte[] bytes = new byte[1024];
83 | int len;
84 | while (-1 != (len = resultFileInput.read(bytes))) {
85 | out.write(bytes, 0, len);
86 | }
87 |
88 | }
89 |
90 | private File getXunitOutput(File outputDirectory, File xunitFile) {
91 | outputDirectory.mkdirs();
92 | if (!xunitFile.isAbsolute())
93 | return new File(outputDirectory, xunitFile.getName());
94 | return xunitFile;
95 | }
96 |
97 | }
98 |
--------------------------------------------------------------------------------
/src/test/java/org/robotframework/mavenplugin/harvesters/A.java:
--------------------------------------------------------------------------------
1 | package org.robotframework.mavenplugin.harvesters;
2 |
3 | public class A {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/src/test/java/org/robotframework/mavenplugin/harvesters/AntPatternClassPredicateTest.java:
--------------------------------------------------------------------------------
1 | package org.robotframework.mavenplugin.harvesters;
2 |
3 | import static org.junit.Assert.assertFalse;
4 | import static org.junit.Assert.assertTrue;
5 |
6 | import org.junit.Test;
7 |
8 | public class AntPatternClassPredicateTest {
9 |
10 | @Test
11 | public void testApplySimple() throws Exception {
12 | // test data
13 | AntPatternClassPredicate predicate = new AntPatternClassPredicate("*.List");
14 |
15 | // do the test
16 | assertTrue(predicate.apply("java.util.List"));
17 | assertFalse(predicate.apply("java.awt.Window"));
18 | }
19 |
20 | @Test
21 | public void testApplySimple1() throws Exception {
22 | // test data
23 | AntPatternClassPredicate predicate = new AntPatternClassPredicate("java.**.A");
24 |
25 | // do the test
26 | assertTrue(predicate.apply("java.util.butil.A"));
27 | assertFalse(predicate.apply("java.awt.Window"));
28 | }
29 |
30 | @Test
31 | public void testApplySimplePattern2() throws Exception {
32 | // test data
33 | AntPatternClassPredicate predicate = new AntPatternClassPredicate("java.util.*List");
34 |
35 | // do the test
36 | assertTrue(predicate.apply("java.util.ArrayList"));
37 | assertFalse(predicate.apply("java.awt.Window"));
38 | }
39 |
40 | @Test
41 | public void testApplyNoPattern() throws Exception {
42 | // test data
43 | AntPatternClassPredicate predicate = new AntPatternClassPredicate("java.util.List");
44 |
45 | // do the test
46 | assertTrue(predicate.apply("java.util.List"));
47 | assertFalse(predicate.apply("java.awt.Window"));
48 | }
49 |
50 | @Test
51 | public void testApplyRecursive() throws Exception {
52 | // test data
53 | AntPatternClassPredicate predicate = new AntPatternClassPredicate("java.**.List");
54 |
55 | // do the test
56 | assertTrue(predicate.apply("java.util.List"));
57 | assertTrue(predicate.apply("java.bla.bla.bla.List"));
58 | }
59 |
60 | @Test
61 | public void testAppliesIgnoresSuffixed() throws Exception {
62 | // test data
63 | AntPatternClassPredicate predicate = new AntPatternClassPredicate("java.**.List");
64 |
65 | // do the test
66 | assertTrue(predicate.apply("java.util.List.class"));
67 | assertFalse(predicate.apply("java.bla.bla.bla.List.classs"));
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/src/test/java/org/robotframework/mavenplugin/harvesters/B.java:
--------------------------------------------------------------------------------
1 | package org.robotframework.mavenplugin.harvesters;
2 |
3 | public class B extends A {
4 |
5 | }
6 |
--------------------------------------------------------------------------------
/src/test/java/org/robotframework/mavenplugin/harvesters/ClassNameHarvesterTest.java:
--------------------------------------------------------------------------------
1 | package org.robotframework.mavenplugin.harvesters;
2 |
3 | import static org.junit.Assert.assertEquals;
4 |
5 | import java.util.Set;
6 |
7 | import org.junit.Test;
8 |
9 | public class ClassNameHarvesterTest {
10 |
11 | public static class A {
12 |
13 | }
14 |
15 | public static class B extends A {
16 |
17 | }
18 |
19 | @Test
20 | public void testHarvestSimple() throws Exception {
21 | // prepare data
22 | String pattern = "java.util.List";
23 |
24 | // do the test
25 | NameHarvester harv = new ClassNameHarvester();
26 | Set result = harv.harvest(pattern);
27 |
28 | // checks
29 | assertEquals(1, result.size());
30 | String r = result.iterator().next();
31 | assertEquals(pattern, r);
32 | }
33 |
34 | @Test
35 | public void testHarvestSimplePattern() throws Exception {
36 | // prepare data
37 | String pattern = "org.**.*ClassNameHarvester";
38 |
39 | // do the test
40 | NameHarvester harv = new ClassNameHarvester();
41 | Set result = harv.harvest(pattern);
42 |
43 | // checks
44 | assertEquals(1, result.size());
45 | String r = result.iterator().next();
46 | assertEquals("org.robotframework.mavenplugin.harvesters.ClassNameHarvester", r);
47 | }
48 |
49 | @Test
50 | public void testHarvestSimplePattern1() throws Exception {
51 | // prepare data
52 | String pattern = "org.**.B";
53 |
54 | // do the test
55 | NameHarvester harv = new ClassNameHarvester();
56 | Set result = harv.harvest(pattern);
57 |
58 | // checks
59 | assertEquals(1, result.size());
60 | String r = result.iterator().next();
61 | assertEquals("org.robotframework.mavenplugin.harvesters.B", r);
62 | }
63 |
64 | @Test
65 | public void testHarvestSimplePattern2() throws Exception {
66 | // prepare data.
67 | // There's Class A from other package, too, so has to be more specific
68 | String pattern = "org.robotframework.**.A";
69 |
70 | // do the test
71 | NameHarvester harv = new ClassNameHarvester();
72 | Set result = harv.harvest(pattern);
73 |
74 | // checks
75 | assertEquals(1, result.size());
76 | String r = result.iterator().next();
77 | assertEquals("org.robotframework.mavenplugin.harvesters.A", r);
78 | }
79 |
80 | @Test
81 | public void testHarvestSimplePatternWithInners() throws Exception {
82 | // prepare data
83 | String pattern = "org.**.ClassNameHarvesterTest$A";
84 |
85 | // do the test
86 | NameHarvester harv = new ClassNameHarvester();
87 | Set result = harv.harvest(pattern);
88 |
89 | // checks
90 | assertEquals(1, result.size());
91 | String r = result.iterator().next();
92 | assertEquals("org.robotframework.mavenplugin.harvesters.ClassNameHarvesterTest$A", r);
93 | }
94 | }
95 |
--------------------------------------------------------------------------------
/src/test/java/org/robotframework/mavenplugin/harvesters/HarvestUtilsTest.java:
--------------------------------------------------------------------------------
1 | package org.robotframework.mavenplugin.harvesters;
2 |
3 | import static org.junit.Assert.assertEquals;
4 | import static org.junit.Assert.assertTrue;
5 |
6 | import java.io.File;
7 |
8 | import org.junit.Test;
9 |
10 | public class HarvestUtilsTest {
11 |
12 | @Test
13 | public void testExtractName() throws Exception {
14 |
15 | assertEquals("Blabla", HarvestUtils.extractName("com.xxx.Blabla"));
16 | assertEquals("Blabla", HarvestUtils.extractName("Blabla.java"));
17 | assertEquals("Blabla", HarvestUtils.extractName("c:\\xxx\\Blabla.java"));
18 | assertEquals("Blabla", HarvestUtils.extractName("/xxx/Blabla.java"));
19 | }
20 |
21 | @Test
22 | public void testGenerateIdName() throws Exception {
23 | assertEquals("b_c_d_e", HarvestUtils.generateIdName("b/c\\d.e"));
24 | }
25 |
26 | @Test
27 | public void testExtractExtension() throws Exception {
28 | assertEquals(".java", HarvestUtils.extractExtension("Blabla.java"));
29 | assertEquals("", HarvestUtils.extractExtension("Blabla"));
30 | assertEquals(".java", HarvestUtils.extractExtension(".java"));
31 | assertEquals(".java", HarvestUtils.extractExtension("*.java"));
32 |
33 | assertEquals(".java", HarvestUtils.extractExtension(new File(".java").getName()));
34 | assertEquals(".java", HarvestUtils.extractExtension(new File("*.java").getName()));
35 |
36 | }
37 |
38 | @Test
39 | public void testIsAbsolutePathFragment() throws Exception {
40 | // Supports Linux and Windows only, on local file systems, so no UNC,
41 | // etc.
42 |
43 | if (File.separatorChar == '\\') {
44 | assertTrue(HarvestUtils.isAbsolutePathFragment("c:\\bla\\*.java"));
45 | } else {
46 | assertTrue(HarvestUtils.isAbsolutePathFragment("/bla/*.java"));
47 | }
48 | }
49 |
50 | @Test
51 | public void testRemovePrefixDirectory() throws Exception {
52 | if (File.separatorChar == '\\') {
53 | assertEquals("bla.java", HarvestUtils.removePrefixDirectory(new File("c:\\bla"), "c:\\bla\\bla.java"));
54 | assertEquals("bla.java", HarvestUtils.removePrefixDirectory(new File("c:\\bla\\"), "c:\\bla\\bla.java"));
55 | } else {
56 | assertEquals("bla.java", HarvestUtils.removePrefixDirectory(new File("/bla"), "/bla/bla.java"));
57 | assertEquals("bla.java", HarvestUtils.removePrefixDirectory(new File("/bla/"), "/bla/bla.java"));
58 | }
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/src/test/java/org/robotframework/mavenplugin/harvesters/ResourceNameHarvesterTest.java:
--------------------------------------------------------------------------------
1 | package org.robotframework.mavenplugin.harvesters;
2 |
3 | import static org.junit.Assert.assertEquals;
4 | import static org.junit.Assert.assertTrue;
5 |
6 | import java.util.Set;
7 |
8 | import org.junit.Test;
9 |
10 | public class ResourceNameHarvesterTest {
11 |
12 | @Test
13 | public void testHarvestResourcesSimpleNonMatching() throws Exception {
14 | // prepare data
15 | String pattern = "xxx.py";
16 |
17 | // do the test
18 | NameHarvester harv = new ResourceNameHarvester();
19 | Set result = harv.harvest(pattern);
20 |
21 | // checks
22 | assertEquals(1, result.size());
23 | String r = result.iterator().next();
24 | assertEquals(pattern, r);
25 | }
26 |
27 | @Test
28 | public void testHarvestPythonResourcesLargeMatch() throws Exception {
29 | // prepare data
30 | String pattern = "*.py";
31 |
32 | // do the test
33 | NameHarvester harv = new ResourceNameHarvester();
34 | Set result = harv.harvest(pattern);
35 |
36 | // checks
37 | assertTrue(result.size() > 1);
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/src/test/java/org/robotframework/mavenplugin/harvesters/SourceFileNameHarvesterTest.java:
--------------------------------------------------------------------------------
1 | package org.robotframework.mavenplugin.harvesters;
2 |
3 | import static org.junit.Assert.assertEquals;
4 | import static org.junit.Assert.assertTrue;
5 |
6 | import java.io.File;
7 | import java.io.IOException;
8 | import java.util.HashSet;
9 | import java.util.Set;
10 |
11 |
12 | import org.apache.commons.io.FileUtils;
13 | import org.junit.After;
14 | import org.junit.Before;
15 | import org.junit.Test;
16 |
17 | public class SourceFileNameHarvesterTest {
18 |
19 | public volatile File workingDirectory = new File(new File(System.getProperty("user.dir")),
20 | SourceFileNameHarvesterTest.class.getCanonicalName());
21 |
22 | @Before
23 | public void setup() throws IOException {
24 | if (workingDirectory.isDirectory()) {
25 | FileUtils.deleteDirectory(workingDirectory);
26 | } else {
27 | if (workingDirectory.isFile())
28 | assertTrue(workingDirectory.delete());
29 | else
30 | assertTrue(workingDirectory.mkdir());
31 | }
32 | }
33 |
34 | @After
35 | public void teardown() throws IOException {
36 | if (workingDirectory.isDirectory()) {
37 | FileUtils.deleteDirectory(workingDirectory);
38 | } else {
39 | if (workingDirectory.isFile())
40 | workingDirectory.delete();
41 | }
42 | }
43 |
44 | @Test
45 | public void testHarvestFilesSimple() throws Exception {
46 | // create some files
47 | File testFile1 = new File(workingDirectory, "bla.java");
48 | assertTrue(testFile1.createNewFile());
49 | String pattern = workingDirectory.getAbsolutePath() + File.separator + "*.java";
50 |
51 | // do the test
52 | NameHarvester h = new SourceFileNameHarvester(workingDirectory);
53 | Set result = h.harvest(pattern);
54 |
55 | // Checks
56 | assertEquals(1, result.size());
57 | String t = result.iterator().next();
58 | assertEquals(testFile1.getAbsolutePath(), t);
59 | }
60 |
61 | @Test
62 | public void testHarvestFilesSeveralButStillSimplerPattern() throws Exception {
63 | // create some files
64 | File testFile1 = new File(workingDirectory, "bla.java");
65 | assertTrue(testFile1.createNewFile());
66 | File testFile2 = new File(workingDirectory, "deeper" + File.separator + "bla.java");
67 | assertTrue(testFile2.getParentFile().mkdirs());
68 | assertTrue(testFile2.createNewFile());
69 |
70 | String pattern = workingDirectory.getAbsolutePath() + File.separator + "*.java";
71 |
72 | // do the test
73 | NameHarvester h = new SourceFileNameHarvester(workingDirectory);
74 | Set result = h.harvest(pattern);
75 |
76 | // Checks
77 | assertEquals(1, result.size());
78 | String t = result.iterator().next();
79 | assertEquals(testFile1.getAbsolutePath(), t);
80 | }
81 |
82 | @Test
83 | public void testHarvestFilesSeveralRecursivePattern() throws Exception {
84 | // create some files
85 | File testFile1 = new File(workingDirectory, "bla.java");
86 | assertTrue(testFile1.createNewFile());
87 | File testFile2 = new File(workingDirectory,
88 | "deeper" + File.separator + "deeper_still" + File.separator + "bla.java");
89 | assertTrue(testFile2.getParentFile().mkdirs());
90 | assertTrue(testFile2.createNewFile());
91 |
92 | String pattern = workingDirectory.getAbsolutePath() + File.separator + "**" + File.separator + "*.java";
93 |
94 | // do the test
95 | NameHarvester h = new SourceFileNameHarvester(workingDirectory);
96 | Set result = h.harvest(pattern);
97 |
98 | // Checks
99 | assertEquals(2, result.size());
100 |
101 | HashSet tr = new HashSet(result);
102 | assertTrue(tr.contains(testFile1.getAbsolutePath()));
103 | assertTrue(tr.contains(testFile2.getAbsolutePath()));
104 |
105 | }
106 |
107 | @Test
108 | public void testHarvestFilesSeveralRecursivePatternSlash() throws Exception {
109 | // create some files
110 | File testFile1 = new File(workingDirectory, "bla.java");
111 | assertTrue(testFile1.createNewFile());
112 | File testFile2 = new File(workingDirectory,
113 | "deeper" + File.separator + "deeper_still" + File.separator + "bla.java");
114 | assertTrue(testFile2.getParentFile().mkdirs());
115 | assertTrue(testFile2.createNewFile());
116 |
117 | String pattern = workingDirectory.getAbsolutePath() + File.separator + "**" + File.separator + "*.java";
118 |
119 | // do the test
120 | NameHarvester h = new SourceFileNameHarvester(workingDirectory);
121 | Set result = h.harvest(pattern);
122 |
123 | // Checks
124 | assertEquals(2, result.size());
125 |
126 | HashSet tr = new HashSet(result);
127 | assertTrue(tr.contains(testFile1.getAbsolutePath()));
128 | assertTrue(tr.contains(testFile2.getAbsolutePath()));
129 |
130 | }
131 |
132 | @Test
133 | public void testHarvestFilesSeveralRecursivePatternSlashRelativePattern() throws Exception {
134 |
135 | // create some files
136 | File testFile1 = new File(workingDirectory, "bla.java");
137 | assertTrue(testFile1.createNewFile());
138 | File testFile2 = new File(workingDirectory,
139 | "deeper" + File.separator + "deeper_still" + File.separator + "bla.java");
140 | assertTrue(testFile2.getParentFile().mkdirs());
141 | assertTrue(testFile2.createNewFile());
142 |
143 | String pattern = "deeper" + File.separator + "**" + File.separator + "*.java";
144 |
145 | // do the test
146 | NameHarvester h = new SourceFileNameHarvester(workingDirectory);
147 | Set result = h.harvest(pattern);
148 |
149 | // Checks
150 | assertEquals(1, result.size());
151 |
152 | HashSet tr = new HashSet(result);
153 | assertTrue(tr.contains(testFile2.getAbsolutePath()));
154 | }
155 | }
156 |
--------------------------------------------------------------------------------
/src/test/projects/acceptance-and-verify/pom.xml:
--------------------------------------------------------------------------------
1 |
5 | 4.0.0
6 |
7 | org.robotframework
8 | robotframework-maven-plugin-test
9 | 1.0-SNAPSHOT
10 | pom
11 | Test Mojo
12 |
13 |
14 | com.github.hi-fi
15 | robotframework-httprequestlibrary
16 | 0.0.11
17 | test
18 |
19 |
20 |
21 |
22 |
23 |
24 | org.robotframework
25 | robotframework-maven-plugin
26 | ${env.MAVEN_LIBRARY_VERSION}
27 |
28 |
29 |
30 | acceptance-test
31 | verify
32 |
33 |
34 |
35 |
36 |
37 | src/test/robotframework/acceptance/lib.py
38 | JustForIT.html
39 |
40 | dotted
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/src/test/projects/acceptance-and-verify/pom_with_classpaths.xml:
--------------------------------------------------------------------------------
1 |
5 | 4.0.0
6 |
7 | org.robotframework
8 | robotframework-maven-plugin-test
9 | 1.0-SNAPSHOT
10 | pom
11 | Test Mojo
12 |
13 |
14 |
15 | com.github.hi-fi
16 | robotframework-httprequestlibrary
17 | 0.0.11
18 | test
19 |
20 |
21 |
22 |
23 |
24 |
25 | org.robotframework
26 | robotframework-maven-plugin
27 | ${env.MAVEN_LIBRARY_VERSION}
28 |
29 |
30 |
31 | acceptance-test
32 | verify
33 |
34 |
35 |
36 |
37 |
38 | Dependencies should be in classpath
39 |
40 |
41 | ${project.basedir}/src/test/robotframework/classpath-acceptance
42 |
43 |
44 | false
45 |
46 | dotted
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
--------------------------------------------------------------------------------
/src/test/projects/acceptance-and-verify/pom_with_external_runner.xml:
--------------------------------------------------------------------------------
1 |
5 | 4.0.0
6 |
7 | org.robotframework
8 | robotframework-maven-plugin-test
9 | 1.0-SNAPSHOT
10 | pom
11 | Test Mojo
12 |
13 |
14 | com.github.hi-fi
15 | robotframework-httprequestlibrary
16 | 0.0.11
17 | test
18 |
19 |
20 |
21 |
22 |
23 |
24 | org.robotframework
25 | robotframework-maven-plugin
26 | ${env.MAVEN_LIBRARY_VERSION}
27 |
28 |
29 |
30 | acceptance-test
31 | verify
32 |
33 |
34 |
35 |
36 |
37 |
38 | magic is this?
39 |
40 |
41 |
42 | Successful_Test
43 |
44 | dotted
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/src/test/projects/acceptance-and-verify/pom_with_noncritical_failures.xml:
--------------------------------------------------------------------------------
1 |
5 | 4.0.0
6 |
7 | org.robotframework
8 | robotframework-maven-plugin-test
9 | 1.0-SNAPSHOT
10 | pom
11 | Test Mojo
12 |
13 |
14 | com.github.hi-fi
15 | robotframework-httprequestlibrary
16 | 0.0.11
17 | test
18 |
19 |
20 |
21 |
22 |
23 |
24 | org.robotframework
25 | robotframework-maven-plugin
26 | ${env.MAVEN_LIBRARY_VERSION}
27 |
28 |
29 |
30 | acceptance-test
31 | verify
32 |
33 |
34 |
35 |
36 |
37 | success
38 |
39 | dotted
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/src/test/projects/acceptance-and-verify/pom_with_tests_configured.xml:
--------------------------------------------------------------------------------
1 |
5 | 4.0.0
6 |
7 | org.robotframework
8 | robotframework-maven-plugin-test
9 | 1.0-SNAPSHOT
10 | pom
11 | Test Mojo
12 |
13 |
14 | com.github.hi-fi
15 | robotframework-httprequestlibrary
16 | 0.0.11
17 | test
18 |
19 |
20 |
21 |
22 |
23 |
24 | org.robotframework
25 | robotframework-maven-plugin
26 | ${env.MAVEN_LIBRARY_VERSION}
27 |
28 |
29 |
30 | acceptance-test
31 | verify
32 |
33 |
34 |
35 |
36 |
37 | *TestNegatives
38 | Successful_Test
39 |
40 |
41 | VariableThatShouldNotBeOverridden:permanent
42 | VariableThatShouldBeOverridden:temp
43 |
44 | dotted
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/src/test/projects/acceptance-and-verify/pom_without_classpaths.xml:
--------------------------------------------------------------------------------
1 |
5 | 4.0.0
6 |
7 | org.robotframework
8 | robotframework-maven-plugin-test
9 | 1.0-SNAPSHOT
10 | pom
11 | Test Mojo
12 |
13 |
14 |
15 | com.github.hi-fi
16 | robotframework-httprequestlibrary
17 | 0.0.11
18 | test
19 |
20 |
21 |
22 |
23 |
24 |
25 | org.robotframework
26 | robotframework-maven-plugin
27 | ${env.MAVEN_LIBRARY_VERSION}
28 |
29 |
30 |
31 | acceptance-test
32 | verify
33 |
34 |
35 |
36 |
37 |
38 | Dependencies should not be in classpath
39 |
40 |
41 | ${project.basedir}/src/test/robotframework/classpath-acceptance
42 |
43 |
44 | true
45 |
46 | this-should-be-seen-by-external-process.jar
47 |
48 |
49 | dotted
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/src/test/projects/acceptance-and-verify/src/test/robotframework/acceptance/anotherSuccessfulTest.robot:
--------------------------------------------------------------------------------
1 | *** Settings ***
2 | Default Tags success
3 |
4 | *** Test Cases ***
5 | Successful Test Negatives
6 | Should Be Equal As Numbers -1 -1
7 | Should Be Equal As Numbers -4 -4
--------------------------------------------------------------------------------
/src/test/projects/acceptance-and-verify/src/test/robotframework/acceptance/failingTest.robot:
--------------------------------------------------------------------------------
1 | *** Variables ***
2 | ${VariableThatShouldNotBeOverridden} This defined in pom_with_test_configured.xml
3 | ${VariableThatShouldBeOverridden} This defined in pom_with_test_configured.xml but should be overridden on prompt
4 | ${extra variable from prompt} This also should be overridden from prompt
5 |
6 | *** Test Cases ***
7 | Failing Test Case
8 | Should Be Equal As Numbers 1 2
9 | Should Be Equal As Numbers 2 3
10 | Failing based on variable
11 | Should Be Equal ${VariableThatShouldNotBeOverridden} ${VariableThatShouldBeOverridden}
12 | Should Be Equal ${extra variable from prompt} overridden
13 |
--------------------------------------------------------------------------------
/src/test/projects/acceptance-and-verify/src/test/robotframework/acceptance/lib.py:
--------------------------------------------------------------------------------
1 | def example(hello):
2 | print hello
--------------------------------------------------------------------------------
/src/test/projects/acceptance-and-verify/src/test/robotframework/acceptance/secondFailingTest.robot:
--------------------------------------------------------------------------------
1 | *** Test Cases ***
2 | Second Failing Test Case
3 | Should Be Equal As Numbers 5 6
4 | Should Be Equal As Numbers 7 8
5 | Second Other Failing Test Case
6 | Should Be Equal As Numbers 9 10
7 | Second Yet Another Failing Test Case
8 | Should Be Equal As Numbers 11 12
--------------------------------------------------------------------------------
/src/test/projects/acceptance-and-verify/src/test/robotframework/acceptance/successfulTest.robot:
--------------------------------------------------------------------------------
1 | *** Settings ***
2 | Library HttpRequestLibrary
3 | Default Tags success
4 |
5 | *** Test Cases ***
6 | Successful Test
7 | Should Be Equal As Numbers 1 1
8 | Should Be Equal As Numbers 4 4
9 | Pretty Print Json { "testJson": { "key": "value" }}
10 |
--------------------------------------------------------------------------------
/src/test/projects/acceptance-and-verify/src/test/robotframework/classpath-acceptance/classpathTests.robot:
--------------------------------------------------------------------------------
1 | *** Test cases ***
2 | Dependencies should be in classpath
3 | Should contain %{java.class.path} httprequestlibrary
4 | Dependencies should not be in classpath
5 | Should not contain %{java.class.path} httprequestlibrary
6 | Should contain %{java.class.path} this-should-be-seen-by-external-process.jar
--------------------------------------------------------------------------------
/src/test/resources/files/embed1/resourcesA.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robotframework/MavenPlugin/0402a407b275b39ca3e5be2180a69db82b2033f7/src/test/resources/files/embed1/resourcesA.txt
--------------------------------------------------------------------------------
/src/test/resources/files/embed1/test.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robotframework/MavenPlugin/0402a407b275b39ca3e5be2180a69db82b2033f7/src/test/resources/files/embed1/test.java
--------------------------------------------------------------------------------
/src/test/resources/files/embed2/test2.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robotframework/MavenPlugin/0402a407b275b39ca3e5be2180a69db82b2033f7/src/test/resources/files/embed2/test2.txt
--------------------------------------------------------------------------------
/src/test/resources/files/resources.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robotframework/MavenPlugin/0402a407b275b39ca3e5be2180a69db82b2033f7/src/test/resources/files/resources.txt
--------------------------------------------------------------------------------
/src/test/resources/files/test.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robotframework/MavenPlugin/0402a407b275b39ca3e5be2180a69db82b2033f7/src/test/resources/files/test.txt
--------------------------------------------------------------------------------
/src/test/resources/output-for-rebot/output-rebot-20181115-081427.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Fails if objects are unequal after converting them to real numbers.
8 |
9 | -1
10 | -1
11 |
12 |
13 |
14 |
15 | Fails if objects are unequal after converting them to real numbers.
16 |
17 | -4
18 | -4
19 |
20 |
21 |
22 |
23 | success
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | Fails if objects are unequal after converting them to real numbers.
33 |
34 | 1
35 | 1
36 |
37 |
38 |
39 |
40 | Fails if objects are unequal after converting them to real numbers.
41 |
42 | 4
43 | 4
44 |
45 |
46 |
47 |
48 | success
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | Critical Tests
59 | All Tests
60 |
61 |
62 | success
63 |
64 |
65 | Robot-Success
66 | Robot-Success.anotherSuccessfulTest
67 | Robot-Success.successfulTest
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/src/test/resources/output-for-rebot/output-rebot-20181115-081428.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Fails if objects are unequal after converting them to real numbers.
8 |
9 | -1
10 | -1
11 |
12 |
13 |
14 |
15 | Fails if objects are unequal after converting them to real numbers.
16 |
17 | -4
18 | -4
19 |
20 |
21 |
22 |
23 | success
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | Fails if objects are unequal after converting them to real numbers.
33 |
34 | 1
35 | 1
36 |
37 |
38 |
39 |
40 | Fails if objects are unequal after converting them to real numbers.
41 |
42 | 4
43 | 4
44 |
45 |
46 |
47 |
48 | success
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | Critical Tests
59 | All Tests
60 |
61 |
62 | success
63 |
64 |
65 | Robot-Success
66 | Robot-Success.anotherSuccessfulTest
67 | Robot-Success.successfulTest
68 |
69 |
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/src/test/resources/pom-configure-runner.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 |
15 | org.robotframework
16 | robotframework-maven-plugin
17 |
18 | src/test/resources/robot-external
19 | target/robotframework-reports
20 | TEST-robot-configure-runner.xml
21 |
22 |
23 | bar
24 | Something else
25 |
26 |
27 | dotted
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/src/test/resources/pom-error.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 | junit
15 | junit
16 | 4.10
17 | test
18 |
19 |
20 |
21 |
22 |
23 |
24 | org.robotframework
25 | robotframework-maven-plugin
26 |
27 | src/test/resources/nothing-here
28 | target/robotframework-reports
29 | TEST-nothing-here.xml
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/test/resources/pom-fail.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 | junit
15 | junit
16 | 4.10
17 | test
18 |
19 |
20 |
21 |
22 |
23 |
24 | org.robotframework
25 | robotframework-maven-plugin
26 |
27 | src/test/resources/robot-fail
28 | target/robotframework-reports
29 | TEST-robot-fail.xml
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/test/resources/pom-hsqldb.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 | junit
15 | junit
16 | 4.10
17 | test
18 |
19 |
20 |
21 |
22 |
23 |
24 | org.robotframework
25 | robotframework-maven-plugin
26 |
27 | src/test/resources/robot-hsqldb
28 | target/robotframework-reports
29 |
30 | src/test/resources/python
31 |
32 | dotted
33 |
34 |
35 |
36 | org.hsqldb
37 | hsqldb
38 | 1.8.0.10
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/src/test/resources/pom-libdoc-libraryname-java.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 |
15 | org.robotframework
16 | robotframework-maven-plugin
17 |
18 |
19 | org.robotframework.mavenplugin.ExampleLib
20 | ExampleLib.html
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/test/resources/pom-libdoc-libraryname-python-subpackage.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 |
15 | org.robotframework
16 | robotframework-maven-plugin
17 |
18 |
19 | mypackage.mylib
20 |
21 | src/test/resources/robot-libdoc-libraryname
22 |
23 | mypackage.mylib.html
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/src/test/resources/pom-libdoc-libraryname-python.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 |
15 | org.robotframework
16 | robotframework-maven-plugin
17 |
18 |
19 | mylib
20 |
21 | src/test/resources/robot-libdoc-libraryname
22 |
23 | mylib.html
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/test/resources/pom-libdoc-robotfile.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 |
15 | org.robotframework
16 | robotframework-maven-plugin
17 |
18 |
19 | src/test/resources/robot-libdoc/html_resource.robot
20 | html_resource.html
21 | src/test/resources/robotframework/libraries
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/test/resources/pom-libdoc.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 |
15 | org.robotframework
16 | robotframework-maven-plugin
17 |
18 |
19 | src/test/java/org/robotframework/mavenplugin/ExampleLib.java
20 | ExampleLib.html
21 | src/test/resources/robotframework/libraries
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/test/resources/pom-rebot-merged.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 |
15 | org.robotframework
16 | robotframework-maven-plugin
17 |
18 | target/robotframework-reports/rebot
19 | TEST-robot-success-merged.xml
20 | true
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/test/resources/pom-rebot.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 |
15 | org.robotframework
16 | robotframework-maven-plugin
17 |
18 | target/robotframework-reports/rebot
19 | TEST-robot-success.xml
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/test/resources/pom-runmodes.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 |
15 | org.robotframework
16 | robotframework-maven-plugin
17 |
18 | src/test/resources/robot-fail
19 | target/robotframework-reports
20 | TEST-robot-runmodes.xml
21 | true
22 | true
23 | true
24 | all
25 | dotted
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/test/resources/pom-success.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 |
15 | org.robotframework
16 | robotframework-maven-plugin
17 |
18 | src/test/resources/robot-success
19 | target/robotframework-reports
20 | TEST-robot-success.xml
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/src/test/resources/pom-testdoc-robotfile-doc.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 |
15 | org.robotframework
16 | robotframework-maven-plugin
17 |
18 |
19 | src/test/resources/robot-testdoc/invalid_login.robot
20 | invalid_login_doc.html
21 | Custom documentation
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/test/resources/pom-testdoc-robotfile-name.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 |
15 | org.robotframework
16 | robotframework-maven-plugin
17 |
18 |
19 | src/test/resources/robot-testdoc/invalid_login.robot
20 | invalid_login_name.html
21 | Custom name
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/test/resources/pom-testdoc-robotfile-title.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 |
15 | org.robotframework
16 | robotframework-maven-plugin
17 |
18 |
19 | src/test/resources/robot-testdoc/invalid_login.robot
20 | invalid_login_title.html
21 | Custom Title
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/src/test/resources/pom-testdoc-robotfile.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 |
6 | org.robotframework
7 | robotframework-maven-plugin-test
8 | 1.0-SNAPSHOT
9 | jar
10 | Test Mojo
11 |
12 |
13 |
14 |
15 | org.robotframework
16 | robotframework-maven-plugin
17 |
18 |
19 | src/test/resources/robot-testdoc/invalid_login.robot
20 | invalid.html
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/src/test/resources/python/DatabaseLibrary/__init__.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2010 Franz Allan Valencia See
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | from connection_manager import ConnectionManager
16 | from query import Query
17 | from manipulation import Manipulation
18 | from assertion import Assertion
19 |
20 | __version__ = '0.3'
21 |
22 | class DatabaseLibrary(ConnectionManager, Query, Assertion, Manipulation):
23 | """
24 | Database Library contains utilities meant for Robot Framework's usage.
25 |
26 | This can allow you to query your database after an action has been made to verify the results.
27 |
28 | This is `compatible*` with any Database API Specification 2.0 module.
29 |
30 |
31 |
32 | References:
33 |
34 | + Database API Specification 2.0 - http://www.python.org/dev/peps/pep-0249/
35 |
36 | + Lists of DB API 2.0 - http://wiki.python.org/moin/DatabaseInterfaces
37 |
38 | + Python Database Programming - http://wiki.python.org/moin/DatabaseProgramming/
39 |
40 | Notes:
41 |
42 |
43 |
44 | `compatible* - or at least theoretically it should be compatible. Currently tested only with postgresql
45 | (using psycopg2).`
46 |
47 | Example Usage:
48 | | # Setup |
49 | | Connect to Database |
50 | | # Guard assertion (verify that test started in expected state). |
51 | | Check if not exists in database | select id from person where first_name = 'Franz Allan' and last_name = 'See' |
52 | | # Drive UI to do some action |
53 | | Go To | http://localhost/person/form.html | | # From selenium library |
54 | | Input Text | name=first_name | Franz Allan | # From selenium library |
55 | | Input Text | name=last_name | See | # From selenium library |
56 | | Click Button | Save | | # From selenium library |
57 | | # Log results |
58 | | @{queryResults} | Query | select * from person |
59 | | Log Many | @{queryResults} |
60 | | # Verify if persisted in the database |
61 | | Check if exists in database | select id from person where first_name = 'Franz Allan' and last_name = 'See' |
62 | | # Teardown |
63 | | Disconnect from Database |
64 | """
65 |
66 | ROBOT_LIBRARY_SCOPE = 'GLOBAL'
67 |
68 |
--------------------------------------------------------------------------------
/src/test/resources/python/DatabaseLibrary/assertion.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2010 Franz Allan Valencia See
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | class Assertion(object):
16 | """
17 | Assertion handles all the assertions of Database Library.
18 | """
19 |
20 | def check_if_exists_in_database(self,selectStatement):
21 | """
22 | Check if any row would be returned by given the input
23 | `selectStatement`. If there are no results, then this will
24 | throw an AssertionError.
25 |
26 | For example, given we have a table `person` with the following data:
27 | | id | first_name | last_name |
28 | | 1 | Franz Allan | See |
29 |
30 | When you have the following assertions in your robot
31 | | Check If Exists In Database | select id from person where first_name = 'Franz Allan' |
32 | | Check If Exists In Database | select id from person where first_name = 'John' |
33 |
34 | Then you will get the following:
35 | | Check If Exists In Database | select id from person where first_name = 'Franz Allan' | # PASS |
36 | | Check If Exists In Database | select id from person where first_name = 'John' | # FAIL |
37 | """
38 | if not self.query(selectStatement):
39 | raise AssertionError("Expected to have have at least one row from '%s' "
40 | "but got 0 rows." % selectStatement)
41 |
42 | def check_if_not_exists_in_database(self,selectStatement):
43 | """
44 | This is the negation of `check_if_exists_in_database`.
45 |
46 | Check if no rows would be returned by given the input
47 | `selectStatement`. If there are any results, then this will
48 | throw an AssertionError.
49 |
50 | For example, given we have a table `person` with the following data:
51 | | id | first_name | last_name |
52 | | 1 | Franz Allan | See |
53 |
54 | When you have the following assertions in your robot
55 | | Check If Not Exists In Database | select id from person where first_name = 'John' |
56 | | Check If Not Exists In Database | select id from person where first_name = 'Franz Allan' |
57 |
58 | Then you will get the following:
59 | | Check If Not Exists In Database | select id from person where first_name = 'John' | # PASS |
60 | | Check If Not Exists In Database | select id from person where first_name = 'Franz Allan' | # FAIL |
61 | """
62 | queryResults = self.query(selectStatement)
63 | if queryResults:
64 | raise AssertionError("Expected to have have no rows from '%s' "
65 | "but got some rows : %s." % (selectStatement, queryResults))
66 |
--------------------------------------------------------------------------------
/src/test/resources/python/DatabaseLibrary/connection_manager.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2010 Franz Allan Valencia See
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | import ConfigParser
16 |
17 | class ConnectionManager (object):
18 | """
19 | Connection Manager handles the connection & disconnection to the database.
20 | """
21 |
22 | def __init__(self):
23 | """
24 | Initializes _dbconnection to None.
25 | """
26 | self._dbconnection = None
27 |
28 |
29 | def connect_to_dbapi2(self, dbapiModuleName, *args):
30 | """
31 | Loads the DB API 2.0 module with the given `dbapiModuleName`, then uses
32 | it to connect to the database using `args`. The arguments depend on the
33 | dbapiModule which is used for the connection.
34 |
35 | Example usage:
36 | | # Using psycopg2, specify postgres database name, user and password |
37 | | Connect To Dbapi2 | psycopg2 | my_db | user | s3cr3t |
38 |
39 | | # Using pymysql, specify mysql database host, user, password, db and port |
40 | | Connect To Dbapi2 | pymysql | localhost | user | s3cr3t | my_db | 3306 |
41 |
42 | | # Using jaydebeapi, set classpath, connect via Oracle jdbc driver in Python or Jython |
43 | | Set Environment Variable | CLASSPATH | ${CURDIR}/../libraries/ojdbc14-10.2.0.3.0.jar |
44 | | Connect To Dbapi2 | jaydebeapi | oracle.jdbc.driver.OracleDriver | jdbc:oracle:thin:@host:port | user | s3cr3t |
45 |
46 | | # Using jaydebeapi, set classpath, connect via Firebird jdbc driver in Python or Jython |
47 | | Set Environment Variable | CLASSPATH | ${CURDIR}/../libraries/jaybird-full-2.1.6.jar
48 | | Connect To Dbapi2 | jaydebeapi | org.firebirdsql.jdbc.FBDriver | jdbc:firebirdsql:localhost/3050:c:/data/test.fdb | SYSDBA | masterkey |
49 |
50 | """
51 | db_api_2 = __import__(dbapiModuleName);
52 | # TODO: pass configfile as second arg dbConfigFile="./resources/db.cfg"?
53 | # maybe use ConfigParser.SafeConfigParser({'bar': 'Life', 'baz': 'hard'})
54 | # seems to be recommended by Python reference
55 | # don't know how to handle config.items so that it can be passed as args
56 | self._dbconnection = db_api_2.connect (*args);
57 |
58 | def connect_to_database(self, dbapiModuleName=None, dbName=None, dbUsername=None, dbPassword=None, dbConfigFile="./resources/db.cfg"):
59 | """
60 | Loads the DB API 2.0 module given `dbapiModuleName` then uses it to
61 | connect to the database using `dbName`, `dbUsername`, and `dbPassword`.
62 |
63 | Optionally, you can specify a `dbConfigFile` wherein it will load the
64 | default property values for `dbapiModuleName`, `dbName` `dbUsername`
65 | and `dbPassword` (note: specifying `dbapiModuleName`, `dbName`
66 | `dbUsername` or `dbPassword` directly will override the properties of
67 | the same key in `dbConfigFile`). If no `dbConfigFile` is specified, it
68 | defaults to `./resources/db.cfg`.
69 |
70 | The `dbConfigFile` is useful if you don't want to check into your SCM
71 | your database credentials.
72 |
73 | Example usage:
74 | | # explicitly specifies all db property values |
75 | | Connect To Database | psycopg2 | my_db | postgres | s3cr3t |
76 |
77 | | # loads all property values from default.cfg |
78 | | Connect To Database | dbConfigFile=default.cfg |
79 |
80 | | # loads all property values from ./resources/db.cfg |
81 | | Connect To Database |
82 |
83 | | # uses explicit `dbapiModuleName` and `dbName` but uses the `dbUsername` and `dbPassword` in 'default.cfg' |
84 | | Connect To Database | psycopg2 | my_db_test | dbConfigFile=default.cfg |
85 |
86 | | # uses explicit `dbapiModuleName` and `dbName` but uses the `dbUsername` and `dbPassword` in './resources/db.cfg' |
87 | | Connect To Database | psycopg2 | my_db_test |
88 | """
89 |
90 | config = ConfigParser.ConfigParser()
91 | config.read([dbConfigFile])
92 |
93 | dbapiModuleName = dbapiModuleName or config.get('default', 'dbapiModuleName')
94 | dbName = dbName or config.get('default', 'dbName')
95 | dbUsername = dbUsername or config.get('default', 'dbUsername')
96 | dbPassword = dbPassword or config.get('default', 'dbPassword')
97 |
98 | db_api_2 = __import__(dbapiModuleName);
99 | self._dbconnection = db_api_2.connect (database=dbName, user=dbUsername, password=dbPassword)
100 |
101 | def disconnect_from_database(self):
102 | """
103 | Disconnects from the database.
104 |
105 | For example:
106 | | Disconnect From Database | # disconnects from current connection to the database |
107 | """
108 | self._dbconnection.close()
109 |
110 |
--------------------------------------------------------------------------------
/src/test/resources/python/DatabaseLibrary/manipulation.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2010 Franz Allan Valencia See
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | class Manipulation(object):
16 | """
17 | Manipulation handles data manipulation.
18 | """
19 |
20 | def execute_sql(self, operation, *parameters):
21 | """
22 | Executes the SQL statement given in `operation`, passing in the given
23 | parameters, which could be used by prepared statements. If the statement
24 | yields a result, it is returned.
25 |
26 | Example:
27 | Simple update statement with parameters as part of the operation string.
28 | | Execute Sql | UPDATE MYTABLE set FLAG = ${accepted} WHERE ID=${id} |
29 |
30 | The syntax for parameterized statements is database dependent. Search
31 | Google for "dbapi2 cheat sheet" if you want to pass parameters.
32 | """
33 | cur = None
34 | try:
35 | cur = self._dbconnection.cursor()
36 | cur.execute (operation);
37 | if(cur.description is not None):
38 | allRows = cur.fetchall()
39 | return allRows
40 | finally :
41 | if cur :
42 | cur.close()
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/src/test/resources/python/DatabaseLibrary/query.py:
--------------------------------------------------------------------------------
1 | # Copyright (c) 2010 Franz Allan Valencia See
2 | #
3 | # Licensed under the Apache License, Version 2.0 (the "License");
4 | # you may not use this file except in compliance with the License.
5 | # You may obtain a copy of the License at
6 | #
7 | # http://www.apache.org/licenses/LICENSE-2.0
8 | #
9 | # Unless required by applicable law or agreed to in writing, software
10 | # distributed under the License is distributed on an "AS IS" BASIS,
11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 | # See the License for the specific language governing permissions and
13 | # limitations under the License.
14 |
15 | class Query(object):
16 | """
17 | Query handles all the querying done by the Database Library.
18 | """
19 |
20 |
21 | def query(self, selectStatement):
22 | """
23 | Uses the input `selectStatement` to query for the values that
24 | will be returned as a list of tuples.
25 |
26 | Tip: Unless you want to log all column values of the specified rows,
27 | try specifying the column names in your select statements
28 | as much as possible to prevent any unnecessary surprises with schema
29 | changes and to easily see what your [] indexing is trying to retrieve
30 | (i.e. instead of `"select * from my_table"`, try
31 | `"select id, col_1, col_2 from my_table"`).
32 |
33 | For example, given we have a table `person` with the following data:
34 | | id | first_name | last_name |
35 | | 1 | Franz Allan | See |
36 |
37 | When you do the following:
38 | | @{queryResults} | Query | select * from person |
39 | | Log Many | @{queryResults} |
40 |
41 | You will get the following:
42 | [1, 'Franz Allan', 'See']
43 |
44 | Also, you can do something like this:
45 | | ${queryResults} | Query | select first_name, last_name from person |
46 | | Log | ${queryResults[0][1]}, ${queryResults[0][0]} |
47 |
48 | And get the following
49 | See, Franz Allan
50 | """
51 | cur = None
52 | try:
53 | cur = self._dbconnection.cursor()
54 | cur.execute (selectStatement);
55 | allRows = cur.fetchall()
56 | return allRows
57 | finally :
58 | if cur :
59 | cur.close()
60 |
61 | def execute_sql_script(self, sqlScriptFileName):
62 | """
63 | Executes the content of the `sqlScriptFileName` as SQL commands.
64 | Useful for setting the database to a known state before running
65 | your tests, or clearing out your test data after running each a
66 | test.
67 |
68 | SQL commands are expected to be delimited by a semi-colon (';').
69 |
70 | For example:
71 | delete from person_employee_table;
72 | delete from person_table;
73 | delete from employee_table;
74 |
75 | Also, the last SQL command can optionally omit its trailing semi-colon.
76 |
77 | For example:
78 | delete from person_employee_table;
79 | delete from person_table;
80 | delete from employee_table
81 |
82 | Given this, that means you can create spread your SQL commands in several
83 | lines.
84 |
85 | For example:
86 | delete
87 | from person_employee_table;
88 | delete
89 | from person_table;
90 | delete
91 | from employee_table
92 |
93 | However, lines that starts with a number sign (`#`) are treated as a
94 | commented line. Thus, none of the contents of that line will be executed.
95 |
96 | For example:
97 | # Delete the bridging table first...
98 | delete
99 | from person_employee_table;
100 | # ...and then the bridged tables.
101 | delete
102 | from person_table;
103 | delete
104 | from employee_table
105 | """
106 | sqlScriptFile = open(sqlScriptFileName)
107 |
108 | cur = None
109 | try:
110 | cur = self._dbconnection.cursor()
111 | sqlStatement = ''
112 | for line in sqlScriptFile:
113 | line = line.strip()
114 | if line.startswith('#'):
115 | continue
116 |
117 | sqlFragments = line.split(';')
118 | if len(sqlFragments) == 1:
119 | sqlStatement += line + ' ';
120 | else:
121 | for sqlFragment in sqlFragments:
122 | sqlFragment = sqlFragment.strip()
123 | if len(sqlFragment) == 0:
124 | continue
125 |
126 | sqlStatement += sqlFragment + ' ';
127 |
128 | cur.execute(sqlStatement)
129 | sqlStatement = ''
130 |
131 | sqlStatement = sqlStatement.strip()
132 | if len(sqlStatement) != 0:
133 | cur.execute(sqlStatement)
134 |
135 | self._dbconnection.commit()
136 | except:
137 | self._dbconnection.rollback()
138 | finally:
139 | if cur :
140 | cur.close()
--------------------------------------------------------------------------------
/src/test/resources/python/jaydebeapi/__init__.py:
--------------------------------------------------------------------------------
1 | from dbapi2 import *
2 |
--------------------------------------------------------------------------------
/src/test/resources/robot-external/successfulTest.robot:
--------------------------------------------------------------------------------
1 | *** Settings ***
2 | Default Tags success
3 |
4 | *** Test Cases ***
5 | Verify environment variable
6 | Should Be Equal %{FOO} bar
7 | Should Be Equal %{FAA} Something else
--------------------------------------------------------------------------------
/src/test/resources/robot-fail/failingTest.robot:
--------------------------------------------------------------------------------
1 | *** Test Cases ***
2 | Failing Test Case
3 | Should Be Equal As Numbers 1 2
4 | Should Be Equal As Numbers 2 3
5 | Other Failing Test Case
6 | Should Be Equal As Numbers 4 5
--------------------------------------------------------------------------------
/src/test/resources/robot-fail/secondFailingTest.robot:
--------------------------------------------------------------------------------
1 | *** Test Cases ***
2 | Second Failing Test Case
3 | Should Be Equal As Numbers 5 6
4 | Should Be Equal As Numbers 7 8
5 | Second Other Failing Test Case
6 | Should Be Equal As Numbers 9 10
7 | Second Yet Another Failing Test Case
8 | Should Be Equal As Numbers 11 12
--------------------------------------------------------------------------------
/src/test/resources/robot-hsqldb/hsqldb.robot:
--------------------------------------------------------------------------------
1 | *** Settings ***
2 | Library OperatingSystem
3 | Library DatabaseLibrary
4 |
5 | *** Test Cases ***
6 | Connect
7 | Connect To Dbapi2 jaydebeapi org.hsqldb.jdbcDriver jdbc:hsqldb:mem:robot sa ${EMPTY}
8 | Execute SQL create table testtable (myid integer not null primary key, name varchar(25))
9 | Execute SQL insert into testtable values (1, 'myname')
10 | Execute SQL insert into testtable values (2, 'yourname')
11 | @{result}= Execute Sql Select * from testtable
12 | Log Many @{result}
13 | Check If Exists In Database select * from testtable where myid=2
14 | Execute SQL drop table testtable
15 | Disconnect From Database
16 |
17 |
--------------------------------------------------------------------------------
/src/test/resources/robot-libdoc-folder-only/html_resource.robot:
--------------------------------------------------------------------------------
1 | *** Settings ***
2 | Documentation A resource file containing the application specific keywords that create our own domain specific language. This resource implements keywords for testing HTML version of the test application. Keywords for Flex version are in flex_resource.txt and common_resource.txt is used to select which one to use.
3 | Library SeleniumLibrary
4 |
5 | *** Variables ***
6 | ${LOGIN URL} http://${SERVER}/html/
7 | ${WELCOME URL} http://${SERVER}/html/welcome.html
8 | ${ERROR URL} http://${SERVER}/html/error.html
9 |
10 | *** Keywords ***
11 | Open Browser To Login Page
12 | Open Browser ${LOGIN URL} ${BROWSER}
13 | Maximize Browser Window
14 | Set Selenium Speed ${DELAY}
15 | Title Should Be Login Page
16 |
17 | Go To Login Page
18 | Go To ${LOGIN URL}
19 | Title Should Be Login Page
20 |
21 | Input Username
22 | [Arguments] ${username}
23 | Input Text username_field ${username}
24 |
25 | Input Password
26 | [Arguments] ${password}
27 | Input Text password_field ${password}
28 |
29 | Submit Credentials
30 | Click Button login_button
31 |
32 | Welcome Page Should Be Open
33 | Location Should Be ${WELCOME URL}
34 | Title Should Be Welcome Page
35 |
36 | Login Should Have Failed
37 | Location Should Be ${ERROR URL}
38 | Title Should Be Error Page
39 |
40 |
--------------------------------------------------------------------------------
/src/test/resources/robot-libdoc-libraryname/mylib.py:
--------------------------------------------------------------------------------
1 | class mylib:
2 | """
3 | Support routines to handle tan operations
4 | """
5 |
6 |
7 | def __init__(self):
8 | """
9 | Constructor
10 | """
11 |
12 | def say_hello(self):
13 | """
14 | Says hello
15 | """
16 | print("hello")
--------------------------------------------------------------------------------
/src/test/resources/robot-libdoc-libraryname/mypackage/__init__.py:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/robotframework/MavenPlugin/0402a407b275b39ca3e5be2180a69db82b2033f7/src/test/resources/robot-libdoc-libraryname/mypackage/__init__.py
--------------------------------------------------------------------------------
/src/test/resources/robot-libdoc-libraryname/mypackage/mylib.py:
--------------------------------------------------------------------------------
1 | class mylib:
2 | """
3 | Support routines to handle tan operations
4 | """
5 |
6 |
7 | def __init__(self):
8 | """
9 | Constructor
10 | """
11 |
12 | def say_hello(self):
13 | """
14 | Says hello
15 | """
16 | print("hello")
--------------------------------------------------------------------------------
/src/test/resources/robot-libdoc/html_resource.robot:
--------------------------------------------------------------------------------
1 | *** Settings ***
2 | Documentation A resource file containing the application specific keywords that create our own domain specific language. This resource implements keywords for testing HTML version of the test application. Keywords for Flex version are in flex_resource.txt and common_resource.txt is used to select which one to use.
3 | Library SeleniumLibrary
4 |
5 | *** Variables ***
6 | ${LOGIN URL} http://${SERVER}/html/
7 | ${WELCOME URL} http://${SERVER}/html/welcome.html
8 | ${ERROR URL} http://${SERVER}/html/error.html
9 |
10 | *** Keywords ***
11 | Open Browser To Login Page
12 | Open Browser ${LOGIN URL} ${BROWSER}
13 | Maximize Browser Window
14 | Set Selenium Speed ${DELAY}
15 | Title Should Be Login Page
16 |
17 | Go To Login Page
18 | Go To ${LOGIN URL}
19 | Title Should Be Login Page
20 |
21 | Input Username
22 | [Arguments] ${username}
23 | Input Text username_field ${username}
24 |
25 | Input Password
26 | [Arguments] ${password}
27 | Input Text password_field ${password}
28 |
29 | Submit Credentials
30 | Click Button login_button
31 |
32 | Welcome Page Should Be Open
33 | Location Should Be ${WELCOME URL}
34 | Title Should Be Welcome Page
35 |
36 | Login Should Have Failed
37 | Location Should Be ${ERROR URL}
38 | Title Should Be Error Page
39 |
40 |
--------------------------------------------------------------------------------
/src/test/resources/robot-libdoc/invalid_login.robot:
--------------------------------------------------------------------------------
1 | *** Settings ***
2 |
3 | Documentation A test suite containing tests related to invalid login. These
4 | ... tests are data-driven by they nature. They use a single
5 | ... keyword, specified with Test Template setting, that is called
6 | ... with different arguments to cover different scenarios.
7 | Suite Setup Open Browser To Login Page
8 | Test Setup Go To Login Page
9 | Test Template Login With Invalid Credentials Should Fail
10 | Suite Teardown Close Browser
11 | Resource common_resource.txt
12 |
13 |
14 | *** Test Cases *** User Name Password
15 |
16 | Invalid Username invalid ${VALID PASSWD}
17 | Invalid Password ${VALID USER} invalid
18 | Invalid Username And Password invalid whatever
19 | Empty Username ${EMPTY} ${VALID PASSWD}
20 | Empty Password ${VALID USER} ${EMPTY}
21 | Empty Username And Password ${EMPTY} ${EMPTY}
22 |
23 |
24 | *** Keywords ***
25 |
26 | Login With Invalid Credentials Should Fail
27 | [Arguments] ${username} ${password}
28 | Input Username ${username}
29 | Input Password ${password}
30 | Submit Credentials
31 | Login Should Have Failed
32 |
--------------------------------------------------------------------------------
/src/test/resources/robot-libdoc/valid_login.robot:
--------------------------------------------------------------------------------
1 | *** Settings ***
2 |
3 | Documentation A test suite with a single test for valid login. This test has
4 | ... a workflow that is created using keywords from the resource file.
5 | Resource common_resource.txt
6 |
7 |
8 | *** Test Cases ***
9 |
10 | Valid Login
11 | Open Browser To Login Page
12 | Input Username demo
13 | Input Password mode
14 | Submit Credentials
15 | Welcome Page Should Be Open
16 | [Teardown] Close Browser
17 |
--------------------------------------------------------------------------------
/src/test/resources/robot-success/anotherSuccessfulTest.robot:
--------------------------------------------------------------------------------
1 | *** Settings ***
2 | Default Tags success
3 |
4 | *** Test Cases ***
5 | Successful Test Negatives
6 | Should Be Equal As Numbers -1 -1
7 | Should Be Equal As Numbers -4 -4
--------------------------------------------------------------------------------
/src/test/resources/robot-success/successfulTest.robot:
--------------------------------------------------------------------------------
1 | *** Settings ***
2 | Default Tags success
3 |
4 | *** Test Cases ***
5 | Successful Test
6 | Should Be Equal As Numbers 1 1
7 | Should Be Equal As Numbers 4 4
--------------------------------------------------------------------------------
/src/test/resources/robot-testdoc/invalid_login.robot:
--------------------------------------------------------------------------------
1 | *** Settings ***
2 |
3 | Documentation A test suite containing tests related to invalid login. These
4 | ... tests are data-driven by they nature. They use a single
5 | ... keyword, specified with Test Template setting, that is called
6 | ... with different arguments to cover different scenarios.
7 | Suite Setup Open Browser To Login Page
8 | Test Setup Go To Login Page
9 | Test Template Login With Invalid Credentials Should Fail
10 | Suite Teardown Close Browser
11 | Resource common_resource.txt
12 |
13 |
14 | *** Test Cases *** User Name Password
15 |
16 | Invalid Username invalid ${VALID PASSWD}
17 | Invalid Password ${VALID USER} invalid
18 | Invalid Username And Password invalid whatever
19 | Empty Username ${EMPTY} ${VALID PASSWD}
20 | Empty Password ${VALID USER} ${EMPTY}
21 | Empty Username And Password ${EMPTY} ${EMPTY}
22 |
23 |
24 | *** Keywords ***
25 |
26 | Login With Invalid Credentials Should Fail
27 | [Arguments] ${username} ${password}
28 | Input Username ${username}
29 | Input Password ${password}
30 | Submit Credentials
31 | Login Should Have Failed
32 |
--------------------------------------------------------------------------------
/src/test/resources/xunitresults/TEST-nothing-here.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/src/test/resources/xunitresults/TEST-robot-fail.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/src/test/resources/xunitresults/TEST-robot-success.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------