Class Test
java.lang.Object
hudson.tasks.BuildStepCompatibilityLayer
hudson.tasks.Builder
io.jenkins.plugins.dotnet.commands.Command
io.jenkins.plugins.dotnet.commands.msbuild.MSBuildCommand
io.jenkins.plugins.dotnet.commands.msbuild.Test
- All Implemented Interfaces:
ExtensionPoint
,Describable<Builder>
,BuildStep
,SimpleBuildStep
A build step to run "
dotnet test
", running unit tests for a project, using its configured runner.-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
A descriptor for "dotnet test
" build steps.Nested classes/interfaces inherited from interface hudson.tasks.BuildStep
BuildStep.PublisherList
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
Nested classes/interfaces inherited from interface jenkins.tasks.SimpleBuildStep
SimpleBuildStep.LastBuildAction, SimpleBuildStep.LastBuildActionFactory
-
Field Summary
Fields inherited from class io.jenkins.plugins.dotnet.commands.msbuild.MSBuildCommand
configuration, nologo, options, outputDirectory, project, properties, verbosity
Fields inherited from class io.jenkins.plugins.dotnet.commands.Command
sdk, showSdkInfo, shutDownBuildServers, unstableIfErrors, unstableIfWarnings, workDirectory
Fields inherited from interface hudson.tasks.BuildStep
BUILDERS, PUBLISHERS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
Adds command line arguments for this "dotnet test
" invocation.Gets the type of dump to collect when the test host terminates unexpectedly.Gets the type of dump to collect when a test times out.Gets the timeout (in milliseconds) to use for hang detection.Gets the data collector to use.getDiag()
Gets the path to the diagnostics file to use.Gets the filter expression to use.Gets the target framework moniker to use.Gets the logger to use.Gets the directory to store test results in.Gets the inline run settings to use.Gets the inline run settings to use.Gets the runtime identifier to use.Gets the.runsettings
file to use.Gets the path to search for test adapters.boolean
isBlame()
Determines whether tests should be run in blame mode, to diagnose test host crashes.boolean
Determines whether crash dumps should be collected in blame mode.boolean
Determines whether crash dumps should be collected in blame mode even for expected test host termination.boolean
Determines whether test timeouts should result in termination.boolean
Determines whether discovered tests should be listed.boolean
Determines whether a build should be performed before running tests.boolean
Determines whether an implicit restore should be executed as part of this command.void
setBlame
(boolean blame) Determines whether tests should be run in blame mode, to diagnose test host crashes.void
setBlameCrash
(boolean blameCrash) Determines whether crash dumps should be collected in blame mode.void
setBlameCrashCollectAlways
(boolean blameCrashCollectAlways) Determines whether crash dumps should be collected in blame mode even for expected test host termination.void
setBlameCrashDumpType
(String blameCrashDumpType) Sets the type of dump to collect when the test host terminates unexpectedly.void
setBlameHang
(boolean blameHang) Determines whether test timeouts should result in termination.void
setBlameHangDumpType
(String blameHangDumpType) Sets the type of dump to collect when a test times out.void
setBlameHangTimeout
(Integer blameHangTimeout) Sets the timeout (in milliseconds) to use for hang detection.void
setCollect
(String collect) Sets the data collector to use.void
Sets the path to the diagnostics file to use.void
Sets the filter expression to use.void
setFramework
(String framework) Sets the target framework moniker to use.void
setListTests
(boolean listTests) Determines whether discovered tests should be listed.void
Sets the logger to use.void
setNoBuild
(boolean noBuild) Determines whether a build should be performed before running tests.void
setNoRestore
(boolean noRestore) Determines whether an implicit restore should be executed as part of this command.void
setResultsDirectory
(String resultsDirectory) Sets the directory to store test results in.void
setRunSettings
(Map<String, String> runSettings) Sets the inline run settings to use.void
setRunSettingsString
(String runSettings) Sets the inline run settings to use.void
setRuntime
(String runtime) Sets the runtime identifier to use.void
setSettings
(String settings) Sets the.runsettings
file to use.void
setTestAdapterPath
(String testAdapterPath) Sets the path to search for test adapters.Methods inherited from class io.jenkins.plugins.dotnet.commands.msbuild.MSBuildCommand
getConfiguration, getOption, getOptions, getOptionsString, getOutputDirectory, getProject, getProperties, getPropertiesString, getVerbosity, isNologo, isShutDownBuildServers, isUnstableIfErrors, isUnstableIfWarnings, setConfiguration, setNologo, setOption, setOptions, setOptionsString, setOutputDirectory, setProject, setProperties, setPropertiesString, setShutDownBuildServers, setUnstableIfErrors, setUnstableIfWarnings, setVerbosity
Methods inherited from class io.jenkins.plugins.dotnet.commands.Command
getCharset, getDescriptor, getSdk, getSdkDescriptor, getWorkDirectory, isContinueOnError, isShowSdkInfo, isSpecificSdkVersion, perform, setCharset, setContinueOnError, setSdk, setShowSdkInfo, setSpecificSdkVersion, setWorkDirectory
Methods inherited from class hudson.tasks.Builder
all, getRequiredMonitorService, prebuild
Methods inherited from class hudson.tasks.BuildStepCompatibilityLayer
getProjectAction, getProjectAction, getProjectActions, perform, perform, prebuild
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface hudson.tasks.BuildStep
getProjectAction, getProjectActions, getRequiredMonitorService, perform, prebuild
Methods inherited from interface jenkins.tasks.SimpleBuildStep
perform, perform, requiresWorkspace
-
Constructor Details
-
Test
@DataBoundConstructor public Test()Creates a new "dotnet test
" build step.
-
-
Method Details
-
addCommandLineArguments
Adds command line arguments for this "dotnet test
" invocation.This adds:
- Any arguments added by
MSBuildCommand.addCommandLineArguments(DotNetArguments)
. -f:xxx
, if a target framework moniker has been specified viasetFramework(String)
.-r:xxx
, if a runtime identifier has been specified viasetRuntime(String)
.--blame
, if requested viasetBlame(boolean)
.--blame-crash
, if requested viasetBlameCrash(boolean)
.--blame-crash-collect-always
, if requested viasetBlameCrashCollectAlways(boolean)
.--blame-crash-dump-type xxx
, if requested viasetBlameCrashDumpType(String)
.--blame-hang
, if requested viasetBlameHang(boolean)
.--blame-hang-dump-type xxx
, if requested viasetBlameHangDumpType(String)
.--blame-hang-timeout nnn
, if requested viasetBlameHangTimeout(Integer)
.--collect xxx
, if a data collector has been specified viasetCollect(String)
.--diag xxx
, if a diagnostics file has been specified viasetDiag(String)
.--filter xxx
, if a filter expression has been specified viasetFilter(String)
.--list-tests
, if requested viasetListTests(boolean)
.--logger xxx
, if a logger has been specified viasetLogger(String)
.--no-build
, if requested viasetNoBuild(boolean)
.--no-restore
, if requested viasetNoRestore(boolean)
.--results-directory xxx
, if a results directory has been specified viasetResultsDirectory(String)
.--settings xxx
, if a.runsettings
file has been specified viasetSettings(String)
.--test-adapter-path xxx
, if a test adapter path has been specified viasetTestAdapterPath(String)
.-
-- name=value [name=value]
, for all settings specified viasetRunSettings(Map)
orsetRunSettingsString(String)
.
- Overrides:
addCommandLineArguments
in classMSBuildCommand
- Parameters:
args
- The current set of arguments.
- Any arguments added by
-
isBlame
public boolean isBlame()Determines whether tests should be run in blame mode, to diagnose test host crashes.- Returns:
true
when tests are run in blame mode;false
otherwise.
-
setBlame
@DataBoundSetter public void setBlame(boolean blame) Determines whether tests should be run in blame mode, to diagnose test host crashes.- Parameters:
blame
-true
to run tests in blame mode;false
otherwise.
-
isBlameCrash
public boolean isBlameCrash()Determines whether crash dumps should be collected in blame mode.- Returns:
true
when crash dumps are collected;false
otherwise.
-
setBlameCrash
@DataBoundSetter public void setBlameCrash(boolean blameCrash) Determines whether crash dumps should be collected in blame mode.- Parameters:
blameCrash
-true
to collect crash dumps;false
otherwise.
-
isBlameCrashCollectAlways
public boolean isBlameCrashCollectAlways()Determines whether crash dumps should be collected in blame mode even for expected test host termination.- Returns:
true
when crash dumps are collected even for expected test host termination;false
otherwise.
-
setBlameCrashCollectAlways
@DataBoundSetter public void setBlameCrashCollectAlways(boolean blameCrashCollectAlways) Determines whether crash dumps should be collected in blame mode even for expected test host termination.- Parameters:
blameCrashCollectAlways
-true
to collect crash dumps even for expected test host termination;false
otherwise.
-
getBlameCrashDumpType
Gets the type of dump to collect when the test host terminates unexpectedly.- Returns:
- The type of dump to collect when the test host terminates unexpectedly.
-
setBlameCrashDumpType
Sets the type of dump to collect when the test host terminates unexpectedly.- Parameters:
blameCrashDumpType
- The type of dump to collect when the test host terminates unexpectedly.
-
isBlameHang
public boolean isBlameHang()Determines whether test timeouts should result in termination.- Returns:
true
when test timeouts result in termination;false
otherwise.
-
setBlameHang
@DataBoundSetter public void setBlameHang(boolean blameHang) Determines whether test timeouts should result in termination.- Parameters:
blameHang
-true
to terminate execution when a test times out;false
otherwise.
-
getBlameHangDumpType
Gets the type of dump to collect when a test times out.- Returns:
- The type of dump to collect when a test times out.
-
setBlameHangDumpType
Sets the type of dump to collect when a test times out.- Parameters:
blameHangDumpType
- The type of dump to collect when a test times out.
-
getBlameHangTimeout
Gets the timeout (in milliseconds) to use for hang detection.- Returns:
- The timeout (in milliseconds) to use for hang detection.
-
setBlameHangTimeout
Sets the timeout (in milliseconds) to use for hang detection.- Parameters:
blameHangTimeout
- The timeout (in milliseconds) to use for hang detection.
-
getCollect
Gets the data collector to use.- Returns:
- The data collector to use.
-
setCollect
Sets the data collector to use.- Parameters:
collect
- The data collector to use.
-
getDiag
Gets the path to the diagnostics file to use.- Returns:
- The path to the diagnostics file to use.
-
setDiag
Sets the path to the diagnostics file to use.- Parameters:
diag
- The path to the diagnostics file to use.
-
getFilter
Gets the filter expression to use.- Returns:
- The filter expression to use.
-
setFilter
Sets the filter expression to use.- Parameters:
filter
- The filter expression to use.
-
getFramework
Gets the target framework moniker to use.- Returns:
- The target framework moniker to use.
-
setFramework
Sets the target framework moniker to use.- Parameters:
framework
- The target framework moniker to use.
-
isListTests
public boolean isListTests()Determines whether discovered tests should be listed.- Returns:
true
when discovered tests are listed;false
otherwise.
-
setListTests
@DataBoundSetter public void setListTests(boolean listTests) Determines whether discovered tests should be listed.- Parameters:
listTests
-true
to list discovered tests;false
otherwise.
-
getLogger
Gets the logger to use.- Returns:
- The logger to use.
-
setLogger
Sets the logger to use.- Parameters:
logger
- The logger to use.
-
isNoBuild
public boolean isNoBuild()Determines whether a build should be performed before running tests.- Returns:
true
when neither a restore nor a build will be performed before running tests;false
otherwise.
-
setNoBuild
@DataBoundSetter public void setNoBuild(boolean noBuild) Determines whether a build should be performed before running tests.- Parameters:
noBuild
-true
to perform neither a restore nor a build before running tests;false
otherwise.
-
isNoRestore
public boolean isNoRestore()Determines whether an implicit restore should be executed as part of this command.- Returns:
true
when the implicit restore is disabled;false
otherwise.
-
setNoRestore
@DataBoundSetter public void setNoRestore(boolean noRestore) Determines whether an implicit restore should be executed as part of this command.- Parameters:
noRestore
-true
to disable the implicit restore;false
otherwise.
-
getResultsDirectory
Gets the directory to store test results in.- Returns:
- The directory to store test results in.
-
setResultsDirectory
Sets the directory to store test results in.- Parameters:
resultsDirectory
- The directory to store test results in.
-
getRunSettings
Gets the inline run settings to use.- Returns:
- The inline run settings to use.
- Throws:
IOException
- When there is a problem loading the run settings into a JavaProperties
object.
-
setRunSettings
@DataBoundSetter public void setRunSettings(@CheckForNull Map<String, String> runSettings) throws IOExceptionSets the inline run settings to use.- Parameters:
runSettings
- The inline run settings to use.- Throws:
IOException
- When there is a problem using aProperties
object to generate a string form for the map.
-
getRunSettingsString
Gets the inline run settings to use.- Returns:
- The inline run settings to use.
-
setRunSettingsString
Sets the inline run settings to use.- Parameters:
runSettings
- The inline run settings to use.
-
getRuntime
Gets the runtime identifier to use.- Returns:
- The runtime identifier to use.
-
setRuntime
Sets the runtime identifier to use.- Parameters:
runtime
- The runtime identifier to use.
-
getSettings
Gets the.runsettings
file to use.- Returns:
- The
.runsettings
file to use.
-
setSettings
Sets the.runsettings
file to use.- Parameters:
settings
- The.runsettings
file to use.
-
getTestAdapterPath
Gets the path to search for test adapters.- Returns:
- The path to search for test adapters.
-
setTestAdapterPath
Sets the path to search for test adapters.- Parameters:
testAdapterPath
- The path to search for test adapters.
-