From 52ed3feebaa5e32e119c5aed35361bf8142e8ce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Evaristo=20Guti=C3=A9rrez?= Date: Tue, 17 Mar 2020 19:23:21 +0100 Subject: [PATCH] Add integration test for MSTestRunner (#1328) --- demos/mstestrunner/README.md | 15 +++++++++ integrations/pom.xml | 7 ++++ .../plugins/casc/MSTestRunnerTest.java | 32 +++++++++++++++++++ ...faultPropertiesExportBlacklistExpected.yml | 6 ++++ 4 files changed, 60 insertions(+) create mode 100644 demos/mstestrunner/README.md create mode 100644 integrations/src/test/java/io/jenkins/plugins/casc/MSTestRunnerTest.java diff --git a/demos/mstestrunner/README.md b/demos/mstestrunner/README.md new file mode 100644 index 0000000000..fa9944a9aa --- /dev/null +++ b/demos/mstestrunner/README.md @@ -0,0 +1,15 @@ +# Configure MSBuild + +Basic configuration of [MSTestRunner](https://plugins.jenkins.io/mstestrunner/) plugin. + +## Sample configuration + +```yaml +tool: + msTestInstallation: + installations: + - defaultArgs: "/category:SmokeTests" + home: "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\MSTest.exe" + name: "MSTest test" + omitNoIsolation: true +``` diff --git a/integrations/pom.xml b/integrations/pom.xml index fbda38027e..402abe376d 100644 --- a/integrations/pom.xml +++ b/integrations/pom.xml @@ -464,6 +464,13 @@ 1.29 test + + + org.jenkins-ci.plugins + mstestrunner + 1.3.0 + test + diff --git a/integrations/src/test/java/io/jenkins/plugins/casc/MSTestRunnerTest.java b/integrations/src/test/java/io/jenkins/plugins/casc/MSTestRunnerTest.java new file mode 100644 index 0000000000..7ec445f183 --- /dev/null +++ b/integrations/src/test/java/io/jenkins/plugins/casc/MSTestRunnerTest.java @@ -0,0 +1,32 @@ +package io.jenkins.plugins.casc; + +import hudson.ExtensionList; +import io.jenkins.plugins.casc.misc.ConfiguredWithReadme; +import io.jenkins.plugins.casc.misc.JenkinsConfiguredWithReadmeRule; +import org.jenkinsci.plugins.MsTestInstallation; +import org.jenkinsci.plugins.MsTestInstallation.DescriptorImpl; +import org.junit.Rule; +import org.junit.Test; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +public class MSTestRunnerTest { + @Rule + public JenkinsConfiguredWithReadmeRule j = new JenkinsConfiguredWithReadmeRule(); + + @Test + @ConfiguredWithReadme("mstestrunner/README.md") + public void configure_mstestrunner() { + final DescriptorImpl msTestRunnerDescriptor = ExtensionList.lookupSingleton(DescriptorImpl.class); + assertNotNull(msTestRunnerDescriptor); + assertEquals(1, msTestRunnerDescriptor.getInstallations().length); + + final MsTestInstallation msTestRunnerInstallation = msTestRunnerDescriptor.getInstallations()[0]; + assertEquals("MSTest test", msTestRunnerInstallation.getName()); + assertEquals("C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\MSTest.exe", msTestRunnerInstallation.getHome()); + assertEquals("/category:SmokeTests", msTestRunnerInstallation.getDefaultArgs()); + assertTrue(msTestRunnerInstallation.getOmitNoIsolation()); + } +} diff --git a/integrations/src/test/resources/io/jenkins/plugins/casc/ToolDefaultPropertiesExportBlacklistExpected.yml b/integrations/src/test/resources/io/jenkins/plugins/casc/ToolDefaultPropertiesExportBlacklistExpected.yml index d81d069c99..07bed1f5e9 100644 --- a/integrations/src/test/resources/io/jenkins/plugins/casc/ToolDefaultPropertiesExportBlacklistExpected.yml +++ b/integrations/src/test/resources/io/jenkins/plugins/casc/ToolDefaultPropertiesExportBlacklistExpected.yml @@ -6,3 +6,9 @@ jdk: installations: - home: "/jdk" name: "default" +msTestInstallation: + installations: + - defaultArgs: "/category:SmokeTests" + home: "C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\Common7\\IDE\\MSTest.exe" + name: "MSTest test" + omitNoIsolation: true