Migrate to .NET Core
* Remove auto capturing. * Remove interactive, shell, custom adapter. * Remove beacon sink.
This commit is contained in:
Родитель
5387ff0781
Коммит
ecec89e28d
|
@ -1,37 +1,65 @@
|
|||
###############################################################################
|
||||
# Set default behavior to automatically normalize line endings.
|
||||
###############################################################################
|
||||
|
||||
[attr]wintext text eol=crlf
|
||||
|
||||
* text=auto
|
||||
###############################################################################
|
||||
# Set default behavior for command prompt diff.
|
||||
#
|
||||
# This is need for earlier builds of msysgit that does not have it on by
|
||||
# default for csharp files.
|
||||
# Note: This is only used by command line
|
||||
###############################################################################
|
||||
#*.cs diff=csharp
|
||||
|
||||
# Default
|
||||
*.* wintext
|
||||
###############################################################################
|
||||
# Set the merge driver for project and solution files
|
||||
#
|
||||
# Merging from the command prompt will add diff markers to the files if there
|
||||
# are conflicts (Merging from VS is not affected by the settings below, in VS
|
||||
# the diff markers are never inserted). Diff markers may cause the following
|
||||
# file extensions to fail to load in VS. An alternative would be to treat
|
||||
# these files as binary and thus will always conflict and require user
|
||||
# intervention with every merge. To do so, just uncomment the entries below
|
||||
###############################################################################
|
||||
#*.sln merge=binary
|
||||
#*.csproj merge=binary
|
||||
#*.vbproj merge=binary
|
||||
#*.vcxproj merge=binary
|
||||
#*.vcproj merge=binary
|
||||
#*.dbproj merge=binary
|
||||
#*.fsproj merge=binary
|
||||
#*.lsproj merge=binary
|
||||
#*.wixproj merge=binary
|
||||
#*.modelproj merge=binary
|
||||
#*.sqlproj merge=binary
|
||||
#*.wwaproj merge=binary
|
||||
|
||||
# Build Specifications
|
||||
*.sln wintext
|
||||
*.csproj wintext
|
||||
###############################################################################
|
||||
# behavior for image files
|
||||
#
|
||||
# image files are treated as binary by default.
|
||||
###############################################################################
|
||||
#*.jpg binary
|
||||
#*.png binary
|
||||
#*.gif binary
|
||||
|
||||
# Sources (Managed)
|
||||
*.cs wintext
|
||||
*.ptfconfig wintext
|
||||
###############################################################################
|
||||
# diff behavior for common document formats
|
||||
#
|
||||
# Convert binary document formats to text before diffing them. This feature
|
||||
# is only available from the command line. Turn it on by uncommenting the
|
||||
# entries below.
|
||||
###############################################################################
|
||||
#*.doc diff=astextplain
|
||||
#*.DOC diff=astextplain
|
||||
#*.docx diff=astextplain
|
||||
#*.DOCX diff=astextplain
|
||||
#*.dot diff=astextplain
|
||||
#*.DOT diff=astextplain
|
||||
#*.pdf diff=astextplain
|
||||
#*.PDF diff=astextplain
|
||||
#*.rtf diff=astextplain
|
||||
#*.RTF diff=astextplain
|
||||
|
||||
# Sources (Script)
|
||||
*.cmd wintext
|
||||
|
||||
# Configuration
|
||||
*.gitattributes wintext
|
||||
*.gitignore wintext
|
||||
|
||||
#Binaries
|
||||
*.exe binary
|
||||
*.dll binary
|
||||
*.obj binary
|
||||
*.pdb binary
|
||||
*.res binary
|
||||
*.man binary
|
||||
|
||||
#Images (Binary)
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
# Force bash scripts to always use lf line endings
|
||||
*.sh text eol=lf
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.rsuser
|
||||
*.suo
|
||||
|
@ -252,6 +257,7 @@ ServiceFabricBackup/
|
|||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
*- Backup*.rdl
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
@ -332,12 +338,8 @@ ASALocalRun/
|
|||
# Local History for Visual Studio
|
||||
.localhistory/
|
||||
|
||||
# BeatPulse healthcheck temp database
|
||||
# BeatPulse healthcheck temp database
|
||||
healthchecksdb
|
||||
|
||||
# Generated files
|
||||
src/testtools.extendedlogging/Microsoft.Protocols.TestTools.ExtendedLogging.XML
|
||||
src/testtools.extension/Microsoft.Protocols.TestTools.Extension.XML
|
||||
src/testtools.messages.runtime/Microsoft.Protocols.TestTools.Messages.Runtime.XML
|
||||
src/testtools.vsts/Microsoft.Protocols.TestTools.VSTS.XML
|
||||
src/testtools/Microsoft.Protocols.TestTools.XML
|
||||
# Backup folder for Package Reference Convert tool in Visual Studio 2017
|
||||
MigrationBackup/
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.421
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TestFramework", "TestFramework\TestFramework.csproj", "{88CEBF69-2B62-4449-8B36-9B766BC5D418}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "UnitTest", "UnitTest\UnitTest.csproj", "{EC877C6C-D944-42E9-8A37-739A27211142}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{88CEBF69-2B62-4449-8B36-9B766BC5D418}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{88CEBF69-2B62-4449-8B36-9B766BC5D418}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{88CEBF69-2B62-4449-8B36-9B766BC5D418}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{88CEBF69-2B62-4449-8B36-9B766BC5D418}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EC877C6C-D944-42E9-8A37-739A27211142}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EC877C6C-D944-42E9-8A37-739A27211142}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EC877C6C-D944-42E9-8A37-739A27211142}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EC877C6C-D944-42E9-8A37-739A27211142}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {031D1F97-663A-43F8-BB3D-4767AEFE6F5E}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,8 +0,0 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Reflection;
|
||||
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("Protocol Test Framework")]
|
||||
[assembly: AssemblyVersion("1.0.7000.0")]
|
|
@ -1,12 +1,10 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Runtime.Remoting.Proxies;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Reflection;
|
||||
using System.Security.Permissions;
|
||||
using System.Security;
|
||||
|
@ -14,17 +12,16 @@ using System.Security;
|
|||
namespace Microsoft.Protocols.TestTools
|
||||
{
|
||||
/// <summary>
|
||||
/// Only for internal use. An abstract base class for adapter implementations based on transparent
|
||||
/// Only for internal use. An abstract base class for adapter implementations based on dispatch
|
||||
/// proxies. Implements adapter standard methods.
|
||||
/// </summary>
|
||||
public abstract class AdapterProxyBase : RealProxy
|
||||
public abstract class AdapterProxyBase : DispatchProxy
|
||||
{
|
||||
|
||||
MethodBase adapterInitializeMethod;
|
||||
MethodBase adapterGetSiteMethod;
|
||||
MethodBase adapterResetMethod;
|
||||
MethodBase disposableDisposeMethod;
|
||||
MethodBase objectGetHashCodeMethod;
|
||||
MethodInfo adapterInitializeMethod;
|
||||
MethodInfo adapterGetSiteMethod;
|
||||
MethodInfo adapterResetMethod;
|
||||
MethodInfo disposableDisposeMethod;
|
||||
MethodInfo objectGetHashCodeMethod;
|
||||
|
||||
/// <summary>
|
||||
/// Adapter interface type.
|
||||
|
@ -42,64 +39,49 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <summary>
|
||||
/// The test site which is defined after initialization has been performed.
|
||||
/// </summary>
|
||||
[SuppressMessage("Microsoft.Design", "CA1051:DoNotDeclareVisibleInstanceFields")]
|
||||
protected ITestSite TestSite;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance of AdapterProxyBase.
|
||||
/// </summary>
|
||||
/// <param name="typeToProxy">The Type of the remote object for which to create a proxy.</param>
|
||||
protected AdapterProxyBase(Type typeToProxy)
|
||||
: base(typeToProxy)
|
||||
protected static void SetParameters(AdapterProxyBase proxy, Type typeToProxy)
|
||||
{
|
||||
proxyType = typeToProxy;
|
||||
adapterInitializeMethod = typeof(IAdapter).GetMethod("Initialize");
|
||||
adapterGetSiteMethod = typeof(IAdapter).GetMethod("get_Site");
|
||||
adapterResetMethod = typeof(IAdapter).GetMethod("Reset");
|
||||
disposableDisposeMethod = typeof(IDisposable).GetMethod("Dispose");
|
||||
objectGetHashCodeMethod = typeof(object).GetMethod("GetHashCode");
|
||||
proxy.proxyType = typeToProxy;
|
||||
proxy.adapterInitializeMethod = typeof(IAdapter).GetMethod("Initialize");
|
||||
proxy.adapterGetSiteMethod = typeof(IAdapter).GetMethod("get_Site");
|
||||
proxy.adapterResetMethod = typeof(IAdapter).GetMethod("Reset");
|
||||
proxy.disposableDisposeMethod = typeof(IDisposable).GetMethod("Dispose");
|
||||
proxy.objectGetHashCodeMethod = typeof(object).GetMethod("GetHashCode");
|
||||
|
||||
if (!typeof(IAdapter).IsAssignableFrom(typeToProxy))
|
||||
throw new InvalidOperationException(String.Format("Type '{0}' is not a valid adapter type.", typeToProxy));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implements Invoke method of RealProxy. Delegates standard adapter methods to the equivalent proxy methods,
|
||||
/// and delegates all other invocations to abstract invoke method.
|
||||
/// Implements Invoke method of DispatchProxy. Delegates standard adapter methods to the equivalent proxy methods,
|
||||
/// and delegates all other invocations to abstract invoke method.
|
||||
/// </summary>
|
||||
/// <param name="msg">An IMessage that contains a IDictionary of information about the method call. </param>
|
||||
/// <returns>The message returned by the delegated method, containing the return value and any out or ref parameter.</returns>
|
||||
public override IMessage Invoke(IMessage msg)
|
||||
protected override object Invoke(MethodInfo targetMethod, object[] args)
|
||||
{
|
||||
if (targetMethod == null)
|
||||
throw new ArgumentNullException("targetMethod");
|
||||
|
||||
if (msg == null)
|
||||
throw new ArgumentNullException("msg");
|
||||
|
||||
IMethodCallMessage methodCall = msg as IMethodCallMessage;
|
||||
|
||||
if (msg == null)
|
||||
{
|
||||
throw new InvalidOperationException("Method call is expected.");
|
||||
}
|
||||
|
||||
if (methodCall.MethodBase == adapterInitializeMethod)
|
||||
return Initialize(methodCall);
|
||||
if (methodCall.MethodBase == adapterGetSiteMethod)
|
||||
return GetSite(methodCall);
|
||||
if (methodCall.MethodBase == adapterResetMethod)
|
||||
return Reset(methodCall);
|
||||
if (methodCall.MethodBase == disposableDisposeMethod)
|
||||
return Dispose(methodCall);
|
||||
if (methodCall.MethodBase == objectGetHashCodeMethod)
|
||||
return GetHashCode(methodCall);
|
||||
if (targetMethod == adapterInitializeMethod)
|
||||
return Initialize(targetMethod, args);
|
||||
if (targetMethod == adapterGetSiteMethod)
|
||||
return GetSite(targetMethod);
|
||||
if (targetMethod == adapterResetMethod)
|
||||
return Reset(targetMethod);
|
||||
if (targetMethod == disposableDisposeMethod)
|
||||
return Dispose(targetMethod);
|
||||
if (targetMethod == objectGetHashCodeMethod)
|
||||
return GetHashCode(targetMethod);
|
||||
|
||||
if (TestSite == null)
|
||||
throw new InvalidOperationException("Calling method on uninitialized adapter");
|
||||
|
||||
TestSite.CheckErrors();
|
||||
|
||||
return Invoke(methodCall);
|
||||
|
||||
return ExecuteMethod(targetMethod, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -108,8 +90,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
/// <param name="methodCall">An IMessage that contains a IDictionary of information about the method call.</param>
|
||||
/// <returns>The message returned by the Invoke implementation.</returns>
|
||||
protected abstract IMessage Invoke(IMethodCallMessage methodCall);
|
||||
|
||||
protected abstract object ExecuteMethod(MethodInfo targetMethod, object[] args);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the instance of AdapterProxyBase.
|
||||
|
@ -121,10 +102,10 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </remarks>
|
||||
/// <param name="methodCall">An IMessage that contains a IDictionary of information about the method call.</param>
|
||||
/// <returns>The message returned by the Initialize implementation.</returns>
|
||||
protected virtual IMessage Initialize(IMethodCallMessage methodCall)
|
||||
protected virtual object Initialize(MethodInfo targetMethod, object[] args)
|
||||
{
|
||||
TestSite = (ITestSite)methodCall.Args[0];
|
||||
return new ReturnMessage(null, null, 0, methodCall.LogicalCallContext, methodCall);
|
||||
TestSite = (ITestSite)args[0];
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -132,9 +113,9 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
/// <param name="methodCall">An IMessage that contains a IDictionary of information about the method call.</param>
|
||||
/// <returns>The message returned by the GetSite implementation.</returns>
|
||||
protected virtual IMessage GetSite(IMethodCallMessage methodCall)
|
||||
protected virtual object GetSite(MethodInfo targetMethod)
|
||||
{
|
||||
return new ReturnMessage(TestSite, null, 0, methodCall.LogicalCallContext, methodCall);
|
||||
return TestSite;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -142,9 +123,9 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
/// <param name="methodCall">An IMessage that contains a IDictionary of information about the method call.</param>
|
||||
/// <returns>The message returned by the Reset implementation.</returns>
|
||||
protected virtual IMessage Reset(IMethodCallMessage methodCall)
|
||||
protected virtual object Reset(MethodInfo targetMethod)
|
||||
{
|
||||
return new ReturnMessage(null, null, 0, methodCall.LogicalCallContext, methodCall);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -152,9 +133,9 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
/// <param name="methodCall">An IMessage that contains a IDictionary of information about the method call.</param>
|
||||
/// <returns>The message returned by the Dispose implementation.</returns>
|
||||
protected virtual IMessage Dispose(IMethodCallMessage methodCall)
|
||||
protected virtual object Dispose(MethodInfo targetMethod)
|
||||
{
|
||||
return new ReturnMessage(null, null, 0, methodCall.LogicalCallContext, methodCall);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -162,9 +143,9 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
/// <param name="methodCall">An IMessage that contains a IDictionary of information about the method call.</param>
|
||||
/// <returns>The message returned by the Dispose implementation.</returns>
|
||||
protected virtual IMessage GetHashCode(IMethodCallMessage methodCall)
|
||||
protected virtual object GetHashCode(MethodInfo targetMethod)
|
||||
{
|
||||
return new ReturnMessage(GetHashCode(), null, 0, methodCall.LogicalCallContext, methodCall);
|
||||
return GetHashCode();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,11 +1,10 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
|
||||
namespace Microsoft.Protocols.TestTools
|
||||
{
|
||||
|
@ -16,14 +15,14 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
/// <param name="methodCall">The method call message from the adapter proxy.</param>
|
||||
/// <returns>The help message content.</returns>
|
||||
internal static string GetHelpMessage(IMethodCallMessage methodCall)
|
||||
internal static string GetHelpMessage(MethodInfo targetMethod)
|
||||
{
|
||||
if (methodCall == null)
|
||||
if (targetMethod == null)
|
||||
{
|
||||
throw new ArgumentNullException("methodCall");
|
||||
throw new ArgumentNullException("targetMethod");
|
||||
}
|
||||
// Find the MethodHelp attribute and the corresponding message.
|
||||
object[] attrs = methodCall.MethodBase.GetCustomAttributes(typeof(MethodHelpAttribute), false);
|
||||
object[] attrs = targetMethod.GetCustomAttributes(typeof(MethodHelpAttribute), false);
|
||||
if (attrs.Length > 0)
|
||||
{
|
||||
return ((MethodHelpAttribute)attrs[0]).HelpMessage;
|
||||
|
@ -53,7 +52,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
|
||||
MethodInfo mi;
|
||||
// Specially processing String type.
|
||||
if (type == typeof(String))
|
||||
if (type == typeof(String))
|
||||
{
|
||||
// Ingore String type.
|
||||
return result;
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
|
@ -1,11 +1,10 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
|
||||
namespace Microsoft.Protocols.TestTools
|
||||
{
|
||||
|
@ -19,15 +18,15 @@ namespace Microsoft.Protocols.TestTools
|
|||
#region IAdapter Members
|
||||
|
||||
/// <summary>
|
||||
/// Implements <see cref="IAdapter.Site"/>.
|
||||
/// </summary>
|
||||
/// Implements <see cref="IAdapter.Site"/>.
|
||||
/// </summary>
|
||||
public ITestSite Site
|
||||
{
|
||||
get { return site; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implements <see cref="IAdapter.Initialize"/>.
|
||||
/// Implements <see cref="IAdapter.Initialize"/>.
|
||||
/// </summary>
|
||||
/// <remarks >
|
||||
/// This method is called automatically by <see cref="DefaultTestSite.GetAdapter"/>. User needs not call it directly.
|
||||
|
@ -103,7 +102,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
Dispose(true);
|
||||
// This object will be cleaned up by the Dispose method.
|
||||
// Therefore, you should call GC.SupressFinalize to
|
||||
// take this object off the finalization queue
|
||||
// take this object off the finalization queue
|
||||
// and prevent finalization code for this object
|
||||
// from executing a second time.
|
||||
GC.SuppressFinalize(this);
|
||||
|
@ -116,8 +115,8 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// can be disposed.
|
||||
/// </summary>
|
||||
/// <param name="disposing">
|
||||
/// If disposing equals false, the method is called by the
|
||||
/// runtime from inside the finalizer and you should not reference
|
||||
/// If disposing equals false, the method is called by the
|
||||
/// runtime from inside the finalizer and you should not reference
|
||||
/// other objects. Only unmanaged resources can be disposed.
|
||||
/// </param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
|
@ -125,16 +124,16 @@ namespace Microsoft.Protocols.TestTools
|
|||
// Check to see if Dispose has already been called.
|
||||
if (!this.disposed)
|
||||
{
|
||||
// If disposing equals true, dispose all managed
|
||||
// If disposing equals true, dispose all managed
|
||||
// and unmanaged resources.
|
||||
if (disposing)
|
||||
{
|
||||
site = null;
|
||||
}
|
||||
|
||||
// Call the appropriate methods to clean up
|
||||
// Call the appropriate methods to clean up
|
||||
// unmanaged resources here.
|
||||
// If disposing is false,
|
||||
// If disposing is false,
|
||||
// only the following code is executed.
|
||||
}
|
||||
disposed = true;
|
||||
|
@ -157,40 +156,41 @@ namespace Microsoft.Protocols.TestTools
|
|||
#endregion
|
||||
}
|
||||
|
||||
class ManagedAdapterProxy : AdapterProxyBase
|
||||
public class ManagedAdapterProxy : AdapterProxyBase
|
||||
{
|
||||
private ManagedAdapterBase instance;
|
||||
private Type trueType;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new managed adapter proxy.
|
||||
/// </summary>
|
||||
/// <param name="adapterType">The managed adapter type</param>
|
||||
/// <param name="typeToProxy">The type of adapter which the proxy works for.</param>
|
||||
public ManagedAdapterProxy(Type adapterType, Type typeToProxy)
|
||||
: base(typeToProxy)
|
||||
public static T Wrap<T>(Type adapterType, Type typeToProxy) where T : IAdapter
|
||||
{
|
||||
trueType = adapterType;
|
||||
object proxy = Create<T, ManagedAdapterProxy>();
|
||||
ManagedAdapterProxy self = (ManagedAdapterProxy)proxy;
|
||||
|
||||
AdapterProxyBase.SetParameters((ManagedAdapterProxy)proxy, typeToProxy);
|
||||
self.trueType = adapterType;
|
||||
|
||||
try
|
||||
{
|
||||
instance = TestToolHelpers.CreateInstanceFromTypeName(adapterType.FullName) as ManagedAdapterBase;
|
||||
self.instance = TestToolHelpers.CreateInstanceFromTypeName(adapterType.FullName) as ManagedAdapterBase;
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
}
|
||||
|
||||
if (instance == null)
|
||||
if (self.instance == null)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
String.Format("Adapter {0} instance creation failed",
|
||||
typeToProxy.FullName));
|
||||
}
|
||||
else if (!typeToProxy.IsAssignableFrom(instance.GetType()))
|
||||
else if (!typeToProxy.IsAssignableFrom(self.instance.GetType()))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
String.Format("Adapter {0} does not implement {1}",
|
||||
adapterType.Name, typeToProxy.FullName));
|
||||
}
|
||||
|
||||
return (T)proxy;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -200,19 +200,19 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
/// <param name="methodCall"></param>
|
||||
/// <returns></returns>
|
||||
protected override IMessage Initialize(IMethodCallMessage methodCall)
|
||||
protected override object Initialize(MethodInfo targetMethod, object[] args)
|
||||
{
|
||||
base.Initialize(methodCall);
|
||||
base.Initialize(targetMethod, args);
|
||||
TestSite.Log.Add(LogEntryKind.Comment,
|
||||
String.Format("Adapter {0} implements {1}",
|
||||
trueType.FullName, ProxyType.FullName));
|
||||
TestSite.Log.Add(LogEntryKind.EnterAdapter,
|
||||
"Managed adapter: {0}, method: {1}",
|
||||
ProxyType.Name,
|
||||
methodCall.MethodName);
|
||||
targetMethod.Name);
|
||||
try
|
||||
{
|
||||
instance.Initialize((ITestSite)methodCall.Args[0]);
|
||||
instance.Initialize((ITestSite)args[0]);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -224,9 +224,9 @@ namespace Microsoft.Protocols.TestTools
|
|||
TestSite.Log.Add(LogEntryKind.ExitAdapter,
|
||||
"Managed adapter: {0}, method: {1}",
|
||||
ProxyType.Name,
|
||||
methodCall.MethodName);
|
||||
targetMethod.Name);
|
||||
}
|
||||
return new ReturnMessage(null, null, 0, methodCall.LogicalCallContext, methodCall);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -234,9 +234,9 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
/// <param name="methodCall"></param>
|
||||
/// <returns></returns>
|
||||
protected override IMessage GetSite(IMethodCallMessage methodCall)
|
||||
protected override object GetSite(MethodInfo targetMethod)
|
||||
{
|
||||
return new ReturnMessage(TestSite, null, 0, methodCall.LogicalCallContext, methodCall);
|
||||
return base.GetSite(targetMethod);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -244,12 +244,12 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
/// <param name="methodCall"></param>
|
||||
/// <returns></returns>
|
||||
protected override IMessage Reset(IMethodCallMessage methodCall)
|
||||
protected override object Reset(MethodInfo targetMethod)
|
||||
{
|
||||
TestSite.Log.Add(LogEntryKind.EnterAdapter,
|
||||
"Managed adapter: {0}, method: {1}",
|
||||
ProxyType.Name,
|
||||
methodCall.MethodName);
|
||||
targetMethod.Name);
|
||||
try
|
||||
{
|
||||
instance.Reset();
|
||||
|
@ -264,9 +264,9 @@ namespace Microsoft.Protocols.TestTools
|
|||
TestSite.Log.Add(LogEntryKind.ExitAdapter,
|
||||
"Managed adapter: {0}, method: {1}",
|
||||
ProxyType.Name,
|
||||
methodCall.MethodName);
|
||||
targetMethod.Name);
|
||||
}
|
||||
return new ReturnMessage(null, null, 0, methodCall.LogicalCallContext, methodCall);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -274,7 +274,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
/// <param name="methodCall"></param>
|
||||
/// <returns></returns>
|
||||
protected override IMessage Dispose(IMethodCallMessage methodCall)
|
||||
protected override object Dispose(MethodInfo targetMethod)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -282,9 +282,9 @@ namespace Microsoft.Protocols.TestTools
|
|||
}
|
||||
finally
|
||||
{
|
||||
base.Dispose(methodCall);
|
||||
base.Dispose(targetMethod);
|
||||
}
|
||||
return new ReturnMessage(null, null, 0, methodCall.LogicalCallContext, methodCall);
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -292,29 +292,28 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
/// <param name="methodCall">The IMethodCallMessage containing method invoking data.</param>
|
||||
/// <returns>The IMessage containing method return data.</returns>
|
||||
protected override IMessage Invoke(IMethodCallMessage methodCall)
|
||||
protected override object ExecuteMethod(MethodInfo targetMethod, object[] args)
|
||||
{
|
||||
object retVal = null;
|
||||
object[] args = methodCall.Args;
|
||||
// Check if this is a method from IAdapter. Any IAdapter methods should be ignored.
|
||||
if (!AdapterType.IsAdapterTypeFullName(methodCall.MethodBase.DeclaringType.FullName)
|
||||
&& (methodCall.MethodBase.DeclaringType.FullName != typeof(IDisposable).FullName)
|
||||
if (!AdapterType.IsAdapterTypeFullName(targetMethod.DeclaringType.FullName)
|
||||
&& (targetMethod.DeclaringType.FullName != typeof(IDisposable).FullName)
|
||||
)
|
||||
{
|
||||
TestSite.Log.Add(LogEntryKind.EnterAdapter,
|
||||
"Managed adapter: {0}, method: {1}",
|
||||
ProxyType.Name,
|
||||
methodCall.MethodName);
|
||||
targetMethod.Name);
|
||||
|
||||
try
|
||||
{
|
||||
if (methodCall.MethodBase.IsStatic)
|
||||
if (targetMethod.IsStatic)
|
||||
{
|
||||
retVal = methodCall.MethodBase.Invoke(null, args);
|
||||
retVal = targetMethod.Invoke(null, args);
|
||||
}
|
||||
else
|
||||
{
|
||||
retVal = methodCall.MethodBase.Invoke(instance, args);
|
||||
retVal = targetMethod.Invoke(instance, args);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -337,16 +336,11 @@ namespace Microsoft.Protocols.TestTools
|
|||
TestSite.Log.Add(LogEntryKind.ExitAdapter,
|
||||
"Managed adapter: {0}, method: {1}",
|
||||
ProxyType.Name,
|
||||
methodCall.MethodName);
|
||||
targetMethod.Name);
|
||||
}
|
||||
}
|
||||
ReturnMessage mret = new ReturnMessage(
|
||||
retVal,
|
||||
args,
|
||||
methodCall.ArgCount,
|
||||
methodCall.LogicalCallContext,
|
||||
methodCall);
|
||||
return mret;
|
||||
|
||||
return retVal;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -14,7 +14,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
public sealed class MethodHelpAttribute : Attribute
|
||||
{
|
||||
readonly string helpMessage;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Disables the default constructor.
|
||||
/// </summary>
|
|
@ -0,0 +1,576 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Data;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using Microsoft.Win32;
|
||||
using System.Management.Automation.Runspaces;
|
||||
using System.Management.Automation;
|
||||
|
||||
namespace Microsoft.Protocols.TestTools
|
||||
{
|
||||
/// <summary>
|
||||
/// A class which is used as proxy for constructing IAdapter of PowerShell script type
|
||||
/// and executing methods in IAdapter.
|
||||
/// </summary>
|
||||
public class PowerShellAdapterProxy : AdapterProxyBase
|
||||
{
|
||||
private string scriptDirectory;
|
||||
|
||||
public static T Wrap<T>(string scriptDirectory, Type typeToProxy) where T : IAdapter
|
||||
{
|
||||
object proxy = Create<T, PowerShellAdapterProxy>();
|
||||
PowerShellAdapterProxy self = (PowerShellAdapterProxy)proxy;
|
||||
|
||||
AdapterProxyBase.SetParameters(self, typeToProxy);
|
||||
self.scriptDirectory = scriptDirectory;
|
||||
|
||||
return (T)proxy;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Can be overridden by extenders to do special initialization code.
|
||||
/// Call base to ensure the test site is initialized.
|
||||
/// </summary>
|
||||
/// <param name="mcall"></param>
|
||||
/// <returns></returns>
|
||||
protected override object Initialize(MethodInfo targetMethod, object[] args)
|
||||
{
|
||||
base.Initialize(targetMethod, args);
|
||||
return this.ExecuteMethod(targetMethod, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Can be overridden by extenders to do special processing of Reset.
|
||||
/// </summary>
|
||||
/// <param name="mcall"></param>
|
||||
/// <returns></returns>
|
||||
protected override object Reset(MethodInfo targetMethod)
|
||||
{
|
||||
return this.ExecuteMethod(targetMethod, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Proxy method for substitution of executing methods in adapter interface.
|
||||
/// </summary>
|
||||
/// <param name="mcall">The IMethodCallMessage containing method invoking data.</param>
|
||||
/// <returns>The IMessage containing method return data.</returns>
|
||||
protected override object ExecuteMethod(MethodInfo targetMethod, object[] args)
|
||||
{
|
||||
//get help message from attribute
|
||||
string methodhelp = AdapterProxyHelpers.GetHelpMessage(targetMethod);
|
||||
|
||||
bool compactMode = ((targetMethod.Name == "Initialize" || targetMethod.Name == "Reset")
|
||||
&& AdapterType.IsAdapterTypeFullName(targetMethod.DeclaringType.FullName)
|
||||
);
|
||||
|
||||
if (compactMode)
|
||||
return ExecuteMethodCompact(targetMethod, methodhelp);
|
||||
|
||||
object retVal = null;
|
||||
object[] outArgs = args;
|
||||
|
||||
// Check if this is a method from IAdapter. Any IAdapter methods should be ignored.
|
||||
if (!AdapterType.IsAdapterTypeFullName(targetMethod.DeclaringType.FullName)
|
||||
&& (targetMethod.DeclaringType.FullName != typeof(IDisposable).FullName)
|
||||
)
|
||||
{
|
||||
TestSite.Log.Add(LogEntryKind.EnterAdapter,
|
||||
"PowerShell adapter: {0}, method: {1}",
|
||||
ProxyType.Name,
|
||||
targetMethod.Name);
|
||||
|
||||
try
|
||||
{
|
||||
string path = LookupScript(targetMethod.Name);
|
||||
if (path == null)
|
||||
{
|
||||
TestSite.Assume.Fail(
|
||||
"PowerShell script file ({0}.ps1) can not be found.",
|
||||
targetMethod.Name);
|
||||
}
|
||||
else
|
||||
{
|
||||
PSParameterBuilder builder = InvokeScript(path, targetMethod, args, methodhelp);
|
||||
if (builder != null)
|
||||
{
|
||||
retVal = builder.RetValue;
|
||||
|
||||
if (builder.OutArguments != null)
|
||||
{
|
||||
int argsIndex = 0;
|
||||
int outArgsIndex = 0;
|
||||
foreach (ParameterInfo pi in targetMethod.GetParameters())
|
||||
{
|
||||
if (pi.ParameterType.IsByRef)
|
||||
{
|
||||
outArgs[argsIndex] = builder.OutArguments[outArgsIndex++];
|
||||
}
|
||||
argsIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
//clear builder
|
||||
builder = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TestSite.Log.Add(LogEntryKind.Debug, ex.ToString());
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
TestSite.Log.Add(LogEntryKind.ExitAdapter,
|
||||
"PowerShell adapter: {0}, method: {1}",
|
||||
ProxyType.Name,
|
||||
targetMethod.Name);
|
||||
}
|
||||
}
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Proxy method for substitution of executing Initialize/Reset methods in adapter interface.
|
||||
/// </summary>
|
||||
/// <param name="mcall">The IMethodCallMessage containing method invoking data.</param>
|
||||
/// <param name="helpMessage">The help message from the attribute</param>
|
||||
/// <returns>Always void.</returns>
|
||||
private object ExecuteMethodCompact(MethodInfo targetMethod, string helpMessage)
|
||||
{
|
||||
string path = LookupScript(targetMethod.Name);
|
||||
if (path != null)
|
||||
{
|
||||
TestSite.Log.Add(LogEntryKind.EnterAdapter,
|
||||
"PowerShell adapter: {0}, method: {1}",
|
||||
ProxyType.Name,
|
||||
targetMethod.Name);
|
||||
|
||||
try
|
||||
{
|
||||
PSParameterBuilder builder = InvokeScript(path, targetMethod, null, helpMessage);
|
||||
//should always return null
|
||||
TestSite.Assert.IsNull(builder, "Compact mode should always return null");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
TestSite.Log.Add(LogEntryKind.Debug, ex.ToString());
|
||||
throw;
|
||||
}
|
||||
finally
|
||||
{
|
||||
TestSite.Log.Add(LogEntryKind.ExitAdapter,
|
||||
"Power Shell adapter: {0}, method: {1}",
|
||||
ProxyType.Name,
|
||||
targetMethod.Name);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
TestSite.Log.Add(LogEntryKind.Debug,
|
||||
"Power Shell adapter: {0}, method: {1} not found, skipped.",
|
||||
ProxyType.Name,
|
||||
targetMethod.Name);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
#region private methods
|
||||
|
||||
private string LookupScript(string methodname)
|
||||
{
|
||||
string dir = scriptDirectory;
|
||||
|
||||
string foundFile = Path.Combine(dir, methodname + ".ps1");
|
||||
if (File.Exists(foundFile))
|
||||
{
|
||||
return foundFile;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void SetPTFVariables(
|
||||
SessionStateProxy proxy)
|
||||
{
|
||||
//set all properties as variables
|
||||
foreach (string key in this.TestSite.Properties.AllKeys)
|
||||
{
|
||||
string propName = "PTFProp_" + key.Replace(".", "_");
|
||||
proxy.SetVariable(propName, this.TestSite.Properties[key]);
|
||||
}
|
||||
}
|
||||
|
||||
private KeyValuePair<string, object> GetRetValueFromCollection(Collection<PSObject> returnedCollection)
|
||||
{
|
||||
if (returnedCollection.Count == 0)
|
||||
{
|
||||
throw new InvalidOperationException("Return value is not found, please return a value in your sript");
|
||||
}
|
||||
|
||||
//get the returned object value, the type is PSObject
|
||||
//skip other output in pipeline, and treat the last value as return value.
|
||||
object realReturnValue = null;
|
||||
string realReturnType = null;
|
||||
|
||||
for (int i = 0; i < returnedCollection.Count; i++)
|
||||
{
|
||||
PSObject psPipelineObject = returnedCollection[i];
|
||||
object realObject = null;
|
||||
string realType = null;
|
||||
string format = "PowerShell adapter pipeline element[{0}] type:'{1}' value:'{2}'";
|
||||
|
||||
if (psPipelineObject != null)
|
||||
{
|
||||
realObject = psPipelineObject.ImmediateBaseObject;
|
||||
Collection<string> typeNames = psPipelineObject.TypeNames;
|
||||
realType = typeNames[0];
|
||||
|
||||
this.TestSite.Log.Add(LogEntryKind.Comment, format, i + 1, realType, realObject);
|
||||
}
|
||||
else
|
||||
{
|
||||
realObject = null;
|
||||
realType = null;
|
||||
this.TestSite.Log.Add(LogEntryKind.Comment, format, i + 1, "null", "null");
|
||||
}
|
||||
|
||||
//treated the last pipeline value as return value;
|
||||
if (i == returnedCollection.Count - 1)
|
||||
{
|
||||
realReturnType = realType;
|
||||
realReturnValue = realObject;
|
||||
}
|
||||
}
|
||||
return new KeyValuePair<string, object>(realReturnType, realReturnValue);
|
||||
}
|
||||
|
||||
private void CheckErrorsInPipeline(Pipeline pipeline)
|
||||
{
|
||||
PipelineReader<object> pErrors = pipeline.Error;
|
||||
|
||||
if (pErrors != null)
|
||||
{
|
||||
int errorCount = pErrors.Count;
|
||||
|
||||
if (errorCount > 0)
|
||||
{
|
||||
Collection<object> errors = pErrors.Read(errorCount);
|
||||
|
||||
if (errors == null)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Invoke Read method from System.Management.Automation.Runspaces.PipelineReader<T> fail.");
|
||||
}
|
||||
|
||||
foreach (object error in errors)
|
||||
{
|
||||
object errorRecordInstance = (error as PSObject).ImmediateBaseObject;
|
||||
|
||||
if (errorRecordInstance != null)
|
||||
{
|
||||
object invocationInfoInstance = (errorRecordInstance as ErrorRecord).InvocationInfo;
|
||||
|
||||
if (invocationInfoInstance != null)
|
||||
{
|
||||
string positionMessage = (invocationInfoInstance as InvocationInfo).PositionMessage;
|
||||
TestSite.Log.Add(LogEntryKind.CheckFailed, "PowerShell script write error '{0}' {1}", error, positionMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invokde script by given file path and arguments.
|
||||
/// </summary>
|
||||
/// <param name="path">The file path to the cmd script.</param>
|
||||
/// <param name="arguments">The argument to be passed to the script.</param>
|
||||
/// <returns>The return value of script executation.</returns>
|
||||
private PSParameterBuilder InvokeScript(string path, MethodInfo targetMethod, object[] args, string helpMessage)
|
||||
{
|
||||
//the patameter builder to handle all parameters
|
||||
PSParameterBuilder builder = null;
|
||||
|
||||
//use the Dot operation in PowerShell to make all variables can be accessed in whole runspace.
|
||||
string scriptContent = string.Format(". \"{0}\"", Path.GetFullPath(path));
|
||||
|
||||
//call static method, and create the instance of runspace type
|
||||
Runspace runspace = RunspaceFactory.CreateRunspace();
|
||||
|
||||
//open run space
|
||||
runspace.Open();
|
||||
|
||||
//call runspace.CreatePipeline to create an instance of Pipeline
|
||||
Pipeline pipeline = runspace.CreatePipeline();
|
||||
pipeline.Commands.AddScript(scriptContent);
|
||||
|
||||
SessionStateProxy sessionStateProxy = runspace.SessionStateProxy;
|
||||
//set variables which can be used in PowerShell script
|
||||
SetPTFVariables(sessionStateProxy);
|
||||
|
||||
//set all parameters as variables which can be used
|
||||
//by users directly in the PowerShell script
|
||||
builder = new PSParameterBuilder(targetMethod);
|
||||
builder.SetAllParametersAsVariables(sessionStateProxy, args, helpMessage);
|
||||
|
||||
try
|
||||
{
|
||||
if (builder != null)
|
||||
{
|
||||
//invoke script and get the return value and out/ref parameters
|
||||
if (builder.HasRetValue)
|
||||
{
|
||||
Collection<PSObject> returnValueCollection = pipeline.Invoke();
|
||||
|
||||
//get return value object
|
||||
KeyValuePair<string, object> retValue = GetRetValueFromCollection(returnValueCollection);
|
||||
|
||||
if (retValue.Value != null)
|
||||
{
|
||||
if (builder.RetType.IsInstanceOfType(retValue.Value))
|
||||
{
|
||||
builder.RetValue = retValue.Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InvalidOperationException("The returned type is mismatched");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.RetValue = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
pipeline.Invoke();
|
||||
}
|
||||
|
||||
//get out parameters values
|
||||
builder.GetAllOutParameterValues(
|
||||
sessionStateProxy,
|
||||
targetMethod.GetParameters().Length);
|
||||
}
|
||||
else
|
||||
{
|
||||
pipeline.Invoke();
|
||||
}
|
||||
|
||||
//check errors in the error pipeline
|
||||
CheckErrorsInPipeline(pipeline);
|
||||
}
|
||||
catch (RuntimeException ex)
|
||||
{
|
||||
string errorMessage = ex.Message;
|
||||
string traceInfo = ex.ErrorRecord.InvocationInfo.PositionMessage;
|
||||
string ptfAdFailureMessage = string.Format(
|
||||
"Exception thrown in PowerShell Adapter: {0} {1}", errorMessage, traceInfo);
|
||||
throw new InvalidOperationException(ptfAdFailureMessage);
|
||||
}
|
||||
|
||||
//close runspace and release resources
|
||||
runspace.Close();
|
||||
|
||||
return builder;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A class that stores parameter information of the invoked adapter method.
|
||||
/// This class is only for PowerShell adapter internal use.
|
||||
/// </summary>
|
||||
class PSParameterBuilder
|
||||
{
|
||||
private MethodInfo methodInfo;
|
||||
private Type retType;
|
||||
private object retValue;
|
||||
private List<string> outParameterNames;
|
||||
private object[] outArguments;
|
||||
private bool hasRetValue;
|
||||
|
||||
/// <summary>
|
||||
/// Constructor of the PowerShell parameter builder class.
|
||||
/// </summary>
|
||||
/// <param name="methodCall">Method call message</param>
|
||||
public PSParameterBuilder(
|
||||
MethodInfo methodInfo)
|
||||
{
|
||||
//initialize
|
||||
this.outParameterNames = new List<string>();
|
||||
this.methodInfo = methodInfo;
|
||||
|
||||
//get return value information
|
||||
if (methodInfo.ReturnType != typeof(void))
|
||||
{
|
||||
retType = methodInfo.ReturnParameter.ParameterType;
|
||||
hasRetValue = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.retType = typeof(void);
|
||||
}
|
||||
}
|
||||
|
||||
#region properties
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether the invoked method has return value.
|
||||
/// </summary>
|
||||
public bool HasRetValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return hasRetValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the return type.
|
||||
/// </summary>
|
||||
public Type RetType
|
||||
{
|
||||
get
|
||||
{
|
||||
return retType;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the return value.
|
||||
/// </summary>
|
||||
public object RetValue
|
||||
{
|
||||
get
|
||||
{
|
||||
return retValue;
|
||||
}
|
||||
set
|
||||
{
|
||||
retValue = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the out/ref parameters.
|
||||
/// </summary>
|
||||
public object[] OutArguments
|
||||
{
|
||||
get
|
||||
{
|
||||
return outArguments;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Sets all parameters/properties as variables.
|
||||
/// </summary>
|
||||
/// <param name="setVariable">SessionStateProxy.SetVariable method</param>
|
||||
/// <param name="proxyInstance">SessionStateProxy instance</param>
|
||||
internal void SetAllParametersAsVariables(SessionStateProxy proxy, object[] args, string helpMessage)
|
||||
{
|
||||
//set help message as variable
|
||||
proxy.SetVariable("PtfHelpMessage", helpMessage);
|
||||
|
||||
//set all parameters as variables
|
||||
foreach (ParameterInfo pi in methodInfo.GetParameters())
|
||||
{
|
||||
string parameterName = pi.Name;
|
||||
object argumentValue = null;
|
||||
if (pi.ParameterType.IsByRef)
|
||||
{
|
||||
if (pi.IsOut)
|
||||
{
|
||||
//sets all "out" parameters by default value
|
||||
argumentValue = pi.DefaultValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
argumentValue = args[pi.Position];
|
||||
}
|
||||
|
||||
//stores all out/ref parameters
|
||||
outParameterNames.Add(parameterName);
|
||||
}
|
||||
else
|
||||
{
|
||||
argumentValue = args[pi.Position];
|
||||
}
|
||||
|
||||
proxy.SetVariable(parameterName, argumentValue);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets all the out/ref parameter values.
|
||||
/// </summary>
|
||||
/// <param name="sessionStateProxy">Type of SessionStateProxy</param>
|
||||
/// <param name="paramsLength">Length of parameters</param>
|
||||
/// <param name="proxyInstance">SessionStateProxy instance</param>
|
||||
/// <param name="sysMgmtAutoAssembly">System management automation assembly</param>
|
||||
internal void GetAllOutParameterValues(SessionStateProxy proxy, int paramsLength)
|
||||
{
|
||||
if (paramsLength > 0)
|
||||
{
|
||||
int outParamIndex = 0;
|
||||
if (outParameterNames.Count > 0)
|
||||
{
|
||||
outArguments = new object[outParameterNames.Count];
|
||||
|
||||
foreach (string outParam in outParameterNames)
|
||||
{
|
||||
object outArgument = proxy.GetVariable(outParam);
|
||||
if (outArgument != null)
|
||||
{
|
||||
if (outArgument.GetType().IsValueType)
|
||||
{
|
||||
outArguments[outParamIndex++] = outArgument;
|
||||
}
|
||||
else
|
||||
{
|
||||
outArguments[outParamIndex++] = ResolveObjectFromPSObject(outArgument);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
outArguments[outParamIndex++] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A helper method which resolve psobject to real object.
|
||||
/// </summary>
|
||||
/// <param name="sysMgmtAutoAssembly">System management automation assembly</param>
|
||||
/// <param name="psObjectInstance">psobject instance</param>
|
||||
/// <returns>Returns the real object</returns>
|
||||
internal static object ResolveObjectFromPSObject(object psObjectInstance)
|
||||
{
|
||||
if (psObjectInstance.GetType() != typeof(PSObject))
|
||||
{
|
||||
return psObjectInstance;
|
||||
}
|
||||
|
||||
return (psObjectInstance as PSObject).ImmediateBaseObject;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -11,7 +11,6 @@ using System.Collections.Specialized;
|
|||
using System.Xml.Schema;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using Microsoft.Protocols.TestTools.Config;
|
||||
using Microsoft.Win32;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Runtime.InteropServices;
|
||||
|
@ -101,7 +100,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <returns>string array which contrains the names of configuration files</returns>
|
||||
private static string[] GetConfigFileShortNames(string testSuiteName)
|
||||
{
|
||||
return new string[]
|
||||
return new string[]
|
||||
{
|
||||
"site.ptfconfig",
|
||||
testSuiteName + ".ptfconfig",
|
||||
|
@ -161,7 +160,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets config file based on the path of PTF installation directory which is specified by
|
||||
/// Gets config file based on the path of PTF installation directory which is specified by
|
||||
/// <see cref="ConfigurationDataProvider.InstallRegistryKey"/> or <see cref="ConfigurationDataProvider.Wow64InstallRegistryKey"/>.
|
||||
/// Gets config file based on the path of PTF installation directory which is specified by <see cref="ConfigurationDataProvider.InstallRegistryKey"/>.
|
||||
/// </summary>
|
||||
|
@ -171,6 +170,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
{
|
||||
string[] files = null;
|
||||
|
||||
/*
|
||||
RegistryKey hklm = null;
|
||||
string registryKey = InstallRegistryKey;
|
||||
if (Environment.Is64BitProcess)
|
||||
|
@ -223,6 +223,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
"Or you need to reinstall PTF.");
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (files != null && files.Length > 0)
|
||||
return files[0];
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -8,7 +8,7 @@ using System.Text;
|
|||
namespace Microsoft.Protocols.TestTools
|
||||
{
|
||||
/// <summary>
|
||||
/// A static class which contains the XML node names in the PTF configuration files.
|
||||
/// A static class which contains the XML node names in the PTF configuration files.
|
||||
/// </summary>
|
||||
public static class ConfigurationPropertyName
|
||||
{
|
||||
|
@ -17,21 +17,16 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
public const string ServerName = "ServerComputerName";
|
||||
|
||||
/// <summary>
|
||||
/// Beacon log target server name
|
||||
/// </summary>
|
||||
public const string BeaconLogServerName = "BeaconLogTargetServer";
|
||||
|
||||
/// <summary>
|
||||
/// Feature name
|
||||
/// </summary>
|
||||
public const string ProtocolName = "FeatureName";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Version
|
||||
/// </summary>
|
||||
public const string ProtocolVersion = "Version";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Test suite name
|
||||
/// </summary>
|
||||
|
@ -43,8 +38,8 @@ namespace Microsoft.Protocols.TestTools
|
|||
public const string ExceptionFilter = "ExceptionFilter";
|
||||
|
||||
/// <summary>
|
||||
/// Regex filter to judge the result together with condition
|
||||
/// Regex filter to judge the result together with condition
|
||||
/// </summary>
|
||||
public const string BypassFilter = "BypassFilter";
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -11,7 +11,6 @@ using System.Collections.Specialized;
|
|||
using System.Xml.Schema;
|
||||
using System.Text;
|
||||
using System.Collections;
|
||||
using Microsoft.Protocols.TestTools.Config;
|
||||
using Microsoft.Win32;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
|
@ -20,7 +19,7 @@ using System.Runtime.InteropServices;
|
|||
namespace Microsoft.Protocols.TestTools
|
||||
{
|
||||
/// <summary>
|
||||
/// This class is used to read from test configuration files, get general
|
||||
/// This class is used to read from test configuration files, get general
|
||||
/// properties and information about adapters, sinks, etc.
|
||||
/// </summary>
|
||||
class ConfigurationReader : IConfigurationData, ICheckerConfig
|
||||
|
@ -209,26 +208,12 @@ namespace Microsoft.Protocols.TestTools
|
|||
DefaultSchemaInstance
|
||||
);
|
||||
|
||||
// Create proxy for default type adapter.
|
||||
if (type.Equals("interactive", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
adapter = new InteractiveAdapterConfig(adapterName);
|
||||
}
|
||||
|
||||
// Create proxy for PowerShell script type adapter
|
||||
else if (type.Equals("powershell", StringComparison.CurrentCultureIgnoreCase))
|
||||
if (type.Equals("powershell", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
string scriptdir = this.GetAdapterAttribute(adapterName, "scriptdir", "");
|
||||
adapter = new PowerShellAdapterConfig(adapterName, scriptdir);
|
||||
string psdir = this.GetAdapterAttribute(adapterName, "scriptdir", "");
|
||||
adapter = new PowerShellAdapterConfig(adapterName, psdir);
|
||||
}
|
||||
|
||||
// Create proxy for Shell script type adapter
|
||||
else if (type.Equals("shell", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
string scriptdir = this.GetAdapterAttribute(adapterName, "scriptdir", "");
|
||||
adapter = new ShellAdapterConfig(adapterName, scriptdir);
|
||||
}
|
||||
|
||||
// Create instance for dot net type adapter.
|
||||
else if (type.Equals("managed", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
|
@ -237,7 +222,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
bool disablevalidation = false;
|
||||
if (!String.IsNullOrEmpty(disablevalidationstring))
|
||||
{
|
||||
Boolean.TryParse(disablevalidationstring, out disablevalidation);
|
||||
Boolean.TryParse(disablevalidationstring, out disablevalidation);
|
||||
}
|
||||
adapter = new ManagedAdapterConfig(adapterName, adapterTypeName, disablevalidation);
|
||||
}
|
||||
|
@ -435,7 +420,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
private int assertFailuresBeforeThrowException;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the configuration which specifies the max bypassed failure messages
|
||||
/// Gets the configuration which specifies the max bypassed failure messages
|
||||
/// will be displayed in error message.
|
||||
/// </summary>
|
||||
public int MaxFailuresToDisplayPerTestCase
|
||||
|
@ -530,7 +515,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
{
|
||||
throw new ArgumentException("At least two PTF config files should be passed in.");
|
||||
}
|
||||
|
||||
|
||||
Logging.ApplicationLog.TraceLog("Try to load " + configFileNames.Length + " config files.");
|
||||
|
||||
XmlDocument docBase = new XmlDocument();
|
||||
|
@ -768,7 +753,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the adapter attribute from test configuration file. This method is used for getting necessary
|
||||
/// Gets the adapter attribute from test configuration file. This method is used for getting necessary
|
||||
/// parameters in construction of adapters.
|
||||
/// </summary>
|
||||
/// <param name="adapterName">The name of adapter requested.</param>
|
||||
|
@ -790,7 +775,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tries to get adapter attribute from test configuration file. This method is used for getting optional
|
||||
/// Tries to get adapter attribute from test configuration file. This method is used for getting optional
|
||||
/// parameters in the construction of adapters.
|
||||
/// </summary>
|
||||
/// <param name="adapterName">The name of adapter requested.</param>
|
||||
|
@ -917,8 +902,10 @@ namespace Microsoft.Protocols.TestTools
|
|||
schemaSet = new XmlSchemaSet();
|
||||
if (schemaFileName == null)
|
||||
{
|
||||
TextReader tr = new StringReader(PTFConfig.TestConfig);
|
||||
schemaSet.Add(null, XmlReader.Create(tr, new XmlReaderSettings() { XmlResolver = null }));
|
||||
|
||||
throw new NotImplementedException("resource file is currently not supported");
|
||||
//TextReader tr = new StringReader(PTFConfig.TestConfig);
|
||||
//schemaSet.Add(null, XmlReader.Create(tr, new XmlReaderSettings() { XmlResolver = null }));
|
||||
}
|
||||
else
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -328,62 +328,48 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// Implements <see cref="ITestSite.GetAdapter"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// For script and interactive adapter, test site provides the default implementations in PTF.
|
||||
/// For managed adapter, test site provides the class instances according to the configuration, and if no class type is defined, it returns null.
|
||||
/// The <see cref="IAdapter.Initialize"/> method is automatically called before the instances is returned.
|
||||
/// This method calls the <see cref="ITestSite.GetAdapter"/> method.
|
||||
/// </remarks>
|
||||
/// <param name="adapterType">The adapter interface type.</param>
|
||||
/// <typeparam name="T">The type of the adapter.</typeparam>
|
||||
/// <returns>An adapter instance of the given type.</returns>
|
||||
public virtual IAdapter GetAdapter(Type adapterType)
|
||||
public virtual T GetAdapter<T>() where T : IAdapter
|
||||
{
|
||||
IAdapter adapter = null;
|
||||
// Set default value for compiling.
|
||||
T adapter = default(T);
|
||||
Type adapterType = typeof(T);
|
||||
|
||||
if (this.configData == null)
|
||||
{
|
||||
// Configuration files do not present.
|
||||
return adapter;
|
||||
throw new InvalidOperationException("Configuration files is not present");
|
||||
}
|
||||
|
||||
// Check if target type adapter is already created.
|
||||
if (adapters.ContainsKey(adapterType))
|
||||
{
|
||||
return adapters[adapterType];
|
||||
return (T)adapters[adapterType];
|
||||
}
|
||||
|
||||
// Get target adapter type.
|
||||
AdapterConfig adapterConfig = this.configData.GetAdapterConfig(adapterType.Name);
|
||||
|
||||
// Create proxy for default type adapter.
|
||||
if (adapterConfig is InteractiveAdapterConfig)
|
||||
{
|
||||
adapter = (IAdapter)new InteractiveAdapterProxy(adapterType).GetTransparentProxy();
|
||||
}
|
||||
|
||||
// Create proxy for PowerShell script type adapter
|
||||
else if (adapterConfig is PowerShellAdapterConfig)
|
||||
if (adapterConfig is PowerShellAdapterConfig)
|
||||
{
|
||||
adapter = (IAdapter)new PowerShellAdapterProxy(
|
||||
adapter = PowerShellAdapterProxy.Wrap<T>(
|
||||
((PowerShellAdapterConfig)adapterConfig).ScriptDir,
|
||||
adapterType).GetTransparentProxy();
|
||||
}
|
||||
|
||||
// Create proxy for Shell script type adapter
|
||||
else if (adapterConfig is ShellAdapterConfig)
|
||||
{
|
||||
adapter = (IAdapter)new ShellAdapterProxy(
|
||||
((ShellAdapterConfig)adapterConfig).ScriptDir,
|
||||
adapterType).GetTransparentProxy();
|
||||
adapterType);
|
||||
}
|
||||
|
||||
// Create instance for dot net type adapter.
|
||||
else if (adapterConfig is ManagedAdapterConfig)
|
||||
if (adapterConfig is ManagedAdapterConfig)
|
||||
{
|
||||
try
|
||||
{
|
||||
string adapterTypeName = ((ManagedAdapterConfig)adapterConfig).AdapterType;
|
||||
if (adapterType.IsGenericType)
|
||||
{
|
||||
adapter = TestToolHelpers.CreateInstanceFromTypeName(adapterTypeName) as IAdapter;
|
||||
IAdapter instance = TestToolHelpers.CreateInstanceFromTypeName(adapterTypeName) as IAdapter;
|
||||
adapter = (T)instance;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -391,7 +377,8 @@ namespace Microsoft.Protocols.TestTools
|
|||
if (adapterImplType == null)
|
||||
throw new InvalidOperationException(
|
||||
String.Format("Can't find assembly \"{0}\"", adapterTypeName));
|
||||
adapter = (new ManagedAdapterProxy(adapterImplType, adapterType).GetTransparentProxy()) as IAdapter;
|
||||
|
||||
adapter = ManagedAdapterProxy.Wrap<T>(adapterImplType, adapterType);
|
||||
}
|
||||
// adapter is null if as operator fails due to an object can't be converted to IAdapter type
|
||||
if (adapter == null)
|
||||
|
@ -435,26 +422,6 @@ namespace Microsoft.Protocols.TestTools
|
|||
return adapter;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implements <see cref="ITestSite.GetAdapter"/>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This method calls the <see cref="ITestSite.GetAdapter"/> method.
|
||||
/// </remarks>
|
||||
/// <typeparam name="T">The type of the adapter.</typeparam>
|
||||
/// <returns>An adapter instance of the given type.</returns>
|
||||
public virtual T GetAdapter<T>() where T : IAdapter
|
||||
{
|
||||
// Set default value for compiling.
|
||||
T adapter = default(T);
|
||||
|
||||
IAdapter result = GetAdapter(typeof(T));
|
||||
if (result != null)
|
||||
adapter = (T)result;
|
||||
|
||||
return adapter;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implements <see cref="ITestSite.ReportAsyncErrorToTcm"/>.
|
||||
/// </summary>
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -7,11 +7,10 @@ using System.Text;
|
|||
|
||||
namespace Microsoft.Protocols.TestTools
|
||||
{
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// An interface that every adapter must implement.
|
||||
/// </summary>
|
||||
[Microsoft.SpecExplorer.Runtime.Testing.TestAdapter]
|
||||
public interface IAdapter : IDisposable
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -29,7 +28,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
void Initialize(ITestSite testSite);
|
||||
|
||||
/// <summary>
|
||||
/// This method is called before each test case runs. User dose not need to call it directly.
|
||||
/// This method is called before each test case runs. User does not need to call it directly.
|
||||
/// </summary>
|
||||
void Reset();
|
||||
}
|
||||
|
@ -40,7 +39,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
public sealed class AdapterType
|
||||
{
|
||||
/// <summary>
|
||||
/// The adapter base type's full name.
|
||||
/// The adapter base type's full name.
|
||||
/// </summary>
|
||||
private static string fullName = typeof(IAdapter).FullName;
|
||||
|
||||
|
@ -60,7 +59,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a bool value which indicates whether the specified string is the full name of the adapter base type .
|
||||
/// Gets a bool value which indicates whether the specified string is the full name of the adapter base type .
|
||||
/// </summary>
|
||||
/// <param name="typeFullName">The full name of the type.</param>
|
||||
/// <returns>true if it equals the adapter base type's full name; otherwise, false.</returns>
|
|
@ -1,9 +1,7 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.Protocols.TestTools
|
||||
{
|
||||
|
@ -40,13 +38,13 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// test code should not and does not need to provide extra logging output related to an assertion pass or failure.
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// All assertion methods are required to have a message string format parameter and an optional array of objects which is applied to
|
||||
/// that message format using <see cref="String.Format(string, object[])"/>. These methods does not support omitting that message, and also does not support
|
||||
/// All assertion methods are required to have a message string format parameter and an optional array of objects which is applied to
|
||||
/// that message format using <see cref="String.Format(string, object[])"/>. These methods does not support omitting that message, and also does not support
|
||||
/// giving a simple string instead of a format string. Therefore, formatting characters must be always escaped
|
||||
/// in the format string (write "{{" for "{" and "}}" for "}").
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public interface IChecker
|
||||
public interface IChecker
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the test site which this checker object is hosted on.
|
||||
|
@ -59,14 +57,14 @@ namespace Microsoft.Protocols.TestTools
|
|||
void CheckErrors();
|
||||
|
||||
/// <summary>
|
||||
/// Raises a failure assertion.
|
||||
/// Raises a failure assertion.
|
||||
/// </summary>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array containing one or more objects to format.</param>
|
||||
void Fail(string message, params object[] parameters);
|
||||
|
||||
/// <summary>
|
||||
/// Raises a successful assertion.
|
||||
/// Raises a successful assertion.
|
||||
/// </summary>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array containing one or more objects to format.</param>
|
||||
|
@ -76,10 +74,10 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// Raises an inconclusive assertion.
|
||||
/// </summary>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array containing one or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array containing one or more objects to format.</param>
|
||||
void Inconclusive(string message, params object[] parameters);
|
||||
|
||||
/// <summary>Verifies that two specified values are equal.
|
||||
/// <summary>Verifies that two specified values are equal.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the objects to compare</typeparam>
|
||||
/// <param name="expected">The first object to compare. This is the object the test expects.</param>
|
||||
|
@ -90,31 +88,31 @@ namespace Microsoft.Protocols.TestTools
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that two specified values are not equal.
|
||||
/// Verifies that two specified values are not equal.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of the objects to compare</typeparam>
|
||||
/// <param name="expected">The first object to compare. This is the object the test expects.</param>
|
||||
/// <param name="actual">The second object to compare. This is the object the test produced.</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
void AreNotEqual<T>(T expected, T actual, string message, params object[] parameters);
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that two specified object references refer to the same object.
|
||||
/// Verifies that two specified object references refer to the same object.
|
||||
/// </summary>
|
||||
/// <param name="expected">The first object to compare. This is the object the test expects.</param>
|
||||
/// <param name="actual">The second object to compare. This is the object the test produced.</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
void AreSame(object expected, object actual, string message, params object[] parameters);
|
||||
|
||||
/// <summary>
|
||||
/// Verifies that two specified object references do not refer to the same object.
|
||||
/// Verifies that two specified object references do not refer to the same object.
|
||||
/// </summary>
|
||||
/// <param name="expected">The first object to compare. This is the object the test expects.</param>
|
||||
/// <param name="actual">The second object to compare. This is the object the test produced.</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
void AreNotSame(object expected, object actual, string message, params object[] parameters);
|
||||
|
||||
/// <summary>
|
||||
|
@ -122,7 +120,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
/// <param name="value">The bool value to check</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
void IsTrue(bool value, string message, params object[] parameters);
|
||||
|
||||
/// <summary>
|
||||
|
@ -130,7 +128,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
/// <param name="value">The bool value to check</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
void IsFalse(bool value, string message, params object[] parameters);
|
||||
|
||||
/// <summary>
|
||||
|
@ -155,7 +153,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <param name="value">The object value to check</param>
|
||||
/// <param name="type">The object type to check</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
void IsInstanceOfType(object value, Type type, string message, params object[] parameters);
|
||||
|
||||
/// <summary>
|
||||
|
@ -164,7 +162,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <param name="value">The object value to check</param>
|
||||
/// <param name="type">The object type to check</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
void IsNotInstanceOfType(object value, Type type, string message, params object[] parameters);
|
||||
|
||||
|
||||
|
@ -173,15 +171,14 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
/// <param name="hresult">The HRESULT value to check</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
void IsSuccess(int hresult, string message, params object[] parameters);
|
||||
|
||||
/// <summary>
|
||||
/// Indicates something that could not be verified currently.
|
||||
/// Indicates something that could not be verified currently.
|
||||
/// </summary>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array containing zero or more objects to format.</param>
|
||||
void Unverified(string message, params object[] parameters);
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -107,22 +107,6 @@ namespace Microsoft.Protocols.TestTools
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An abstract class which stores interactive adapter information
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class InteractiveAdapterConfig : AdapterConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Constructs an interactive adapter instance
|
||||
/// </summary>
|
||||
/// <param name="name">Adapter name</param>
|
||||
public InteractiveAdapterConfig(string name)
|
||||
: base(name)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An abstract class which stores PowerShell script adapter information
|
||||
/// </summary>
|
||||
|
@ -151,34 +135,6 @@ namespace Microsoft.Protocols.TestTools
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An abstract class which stores Shell script adapter information
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class ShellAdapterConfig : AdapterConfig
|
||||
{
|
||||
private string scriptDir;
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a Shell adapter instance
|
||||
/// </summary>
|
||||
/// <param name="name">Adapter name</param>
|
||||
/// <param name="scriptDir">The directory name of the Shell scripts path</param>
|
||||
public ShellAdapterConfig(string name, string scriptDir)
|
||||
: base(name)
|
||||
{
|
||||
this.scriptDir = scriptDir;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the directory name of the Shell script path
|
||||
/// </summary>
|
||||
public string ScriptDir
|
||||
{
|
||||
get { return this.scriptDir; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An abstract class which stores log sink config information
|
||||
/// </summary>
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -15,14 +15,14 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <remarks>
|
||||
/// This interface describes a set of methods for test logging. A fixed number of test log entry
|
||||
/// kinds is supported. The single point to add a log entry is the <see cref="ILogger.Add"/> method.
|
||||
/// <para>
|
||||
/// <para>
|
||||
/// Explicit logging in test code can usually be narrowed to a minimum because validation logic using the <see cref="IChecker"/>
|
||||
/// API automatically takes care of logging. Also, adapters as obtained by the test site (<see cref="ITestSite"/>) take
|
||||
/// API automatically takes care of logging. Also, adapters as obtained by the test site (<see cref="ITestSite"/>) take
|
||||
/// care of logging calls to the underlying SUT (log entry type <see cref="LogEntryKind.EnterAdapter"/>).
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// Which kind of log messages are actually processed and which targets they are directed to depends on the
|
||||
/// logging profile which is defined in the test configuration of the test site. Test code can explicitly change
|
||||
/// logging profile which is defined in the test configuration of the test site. Test code can explicitly change
|
||||
/// the logging profile using the <see cref="ILogger.ActiveLoggingProfile"/> property.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
|
@ -38,10 +38,10 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
/// <param name="kind">The log message kind.</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array containing one or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array containing one or more objects to format.</param>
|
||||
/// <remarks>
|
||||
/// The <paramref name="message"/> parameter uses an extended format string for logging.
|
||||
/// In addition to the standard formats (see <see cref="System.String.Format(string, object[])"/>),
|
||||
/// The <paramref name="message"/> parameter uses an extended format string for logging.
|
||||
/// In addition to the standard formats (see <see cref="System.String.Format(string, object[])"/>),
|
||||
/// the following codes are provided:
|
||||
/// <list type="bullet">
|
||||
/// <item>
|
||||
|
@ -71,7 +71,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
|
||||
/// <summary>
|
||||
/// Gets or sets the active logging profile. A logging profile is defined in the test configuration and
|
||||
/// describes what entries are actually logged and in which way (e.g. send beacon packages, etc.).
|
||||
/// describes what entries are actually logged and in which way.
|
||||
/// </summary>
|
||||
string ActiveLoggingProfile { get; set; }
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
|
||||
|
||||
/// <summary>
|
||||
/// An enumeration type which represents the types of message log entries.
|
||||
/// An enumeration type which represents the types of message log entries.
|
||||
/// </summary>
|
||||
public enum LogEntryKind
|
||||
{
|
||||
|
@ -123,14 +123,14 @@ namespace Microsoft.Protocols.TestTools
|
|||
CheckUnverified,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates entering test adapter code. Generally, PTF automatically logs this kind, and user should
|
||||
/// Indicates entering test adapter code. Generally, PTF automatically logs this kind, and user should
|
||||
/// not explicitly log it. The only exception is PTF can not log for managed adapter whose interface definition
|
||||
/// contains generic type.
|
||||
/// </summary>
|
||||
EnterAdapter,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates exiting test adapter code. Generally, PTF automatically logs this kind, and user should
|
||||
/// Indicates exiting test adapter code. Generally, PTF automatically logs this kind, and user should
|
||||
/// not explicitly log it. The only exception is PTF can not log for managed adapter whose interface definition
|
||||
/// contains generic type.
|
||||
/// </summary>
|
||||
|
@ -162,7 +162,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
Warning,
|
||||
|
||||
/// <summary>
|
||||
/// A free-style log entry for debugging information.
|
||||
/// A free-style log entry for debugging information.
|
||||
/// </summary>
|
||||
Debug,
|
||||
|
||||
|
@ -340,4 +340,4 @@ namespace Microsoft.Protocols.TestTools
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -15,12 +15,12 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <summary>
|
||||
/// Test case failed
|
||||
/// </summary>
|
||||
Failed = 0,
|
||||
Failed = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Test case status is inconclusive
|
||||
/// </summary>
|
||||
Inconclusive,
|
||||
Inconclusive,
|
||||
|
||||
/// <summary>
|
||||
/// Test case passed
|
||||
|
@ -35,7 +35,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <summary>
|
||||
/// Test case encounters an error
|
||||
/// </summary>
|
||||
Error,
|
||||
Error,
|
||||
|
||||
/// <summary>
|
||||
/// Test case is time out
|
||||
|
@ -50,7 +50,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <summary>
|
||||
/// Test case status is unknown
|
||||
/// </summary>
|
||||
Unknown,
|
||||
Unknown,
|
||||
}
|
||||
|
||||
/// <summary>
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -8,7 +8,7 @@ using System.Text;
|
|||
namespace Microsoft.Protocols.TestTools
|
||||
{
|
||||
/// <summary>
|
||||
/// An interface which provides methods for protocol tests' initialization and cleaning up.
|
||||
/// An interface which provides methods for protocol tests' initialization and cleaning up.
|
||||
/// </summary>
|
||||
public interface IProtocolTestNotify
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -12,10 +12,10 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// An interface which provides logging, assertions, and SUT adapters for test code onto its execution context.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This interface constitutes the anchor for the communication of test code with its execution context.
|
||||
/// This interface constitutes the anchor for the communication of test code with its execution context.
|
||||
/// It provides information about the currently executing test, the logger to use, the assertion verifier to use,
|
||||
/// and the adapters to the underlying SUT. It also provides generic access to properties defined in the test
|
||||
/// configuration.
|
||||
/// configuration.
|
||||
/// </remarks>
|
||||
public interface ITestSite
|
||||
{
|
||||
|
@ -75,13 +75,6 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <returns>An adapter instance of the given type</returns>
|
||||
T GetAdapter<T>() where T : IAdapter;
|
||||
|
||||
/// <summary>
|
||||
/// Returns an adapter implementation for the given adapter interface type.
|
||||
/// </summary>
|
||||
/// <param name="adapterType">The adapter interface type.</param>
|
||||
/// <returns>An adapter of the given type.</returns>
|
||||
IAdapter GetAdapter(Type adapterType);
|
||||
|
||||
/// <summary>
|
||||
/// Reports the error message to Tcm.
|
||||
/// This method is obsolete.
|
||||
|
@ -133,7 +126,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <param name="description">The description of requirement</param>
|
||||
/// <param name="requirementType">Type of the requirement(May, Should, Must or Product)</param>
|
||||
void CaptureRequirementIfAreEqual<T>(
|
||||
T expected, T actual,
|
||||
T expected, T actual,
|
||||
string protocolDocShortName,
|
||||
int requirementId, string description, RequirementType requirementType = RequirementType.Undefined);
|
||||
|
||||
|
@ -148,7 +141,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <param name="description">The description of requirement</param>
|
||||
/// <param name="requirementType">Type of the requirement(May, Should, Must or Product).</param>
|
||||
void CaptureRequirementIfAreNotEqual<T>(
|
||||
T expected, T actual,
|
||||
T expected, T actual,
|
||||
string protocolDocShortName,
|
||||
int requirementId, string description, RequirementType requirementType = RequirementType.Undefined);
|
||||
|
||||
|
@ -162,7 +155,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <param name="description">The description of requirement</param>
|
||||
/// <param name="requirementType">Type of the requirement(May, Should, Must or Product).</param>
|
||||
void CaptureRequirementIfAreSame(
|
||||
object expected, object actual,
|
||||
object expected, object actual,
|
||||
string protocolDocShortName,
|
||||
int requirementId, string description, RequirementType requirementType = RequirementType.Undefined);
|
||||
|
||||
|
@ -176,7 +169,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <param name="description">The description of requirement</param>
|
||||
/// <param name="requirementType">Type of the requirement(May, Should, Must or Product).</param>
|
||||
void CaptureRequirementIfAreNotSame(
|
||||
object expected, object actual,
|
||||
object expected, object actual,
|
||||
string protocolDocShortName,
|
||||
int requirementId, string description, RequirementType requirementType = RequirementType.Undefined);
|
||||
|
||||
|
@ -238,7 +231,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <param name="description">The description of requirement</param>
|
||||
/// <param name="requirementType">Type of the requirement(May, Should, Must or Product).</param>
|
||||
void CaptureRequirementIfIsInstanceOfType(
|
||||
object value, Type type,
|
||||
object value, Type type,
|
||||
string protocolDocShortName,
|
||||
int requirementId, string description, RequirementType requirementType = RequirementType.Undefined);
|
||||
|
||||
|
@ -252,7 +245,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <param name="description">The description of requirement</param>
|
||||
/// <param name="requirementType">Type of the requirement(May, Should, Must or Product).</param>
|
||||
void CaptureRequirementIfIsNotInstanceOfType(
|
||||
object value, Type type,
|
||||
object value, Type type,
|
||||
string protocolDocShortName,
|
||||
int requirementId, string description, RequirementType requirementType = RequirementType.Undefined);
|
||||
|
||||
|
@ -415,7 +408,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <summary>
|
||||
/// Indicates the statistics of the results of the executed test cases
|
||||
/// </summary>
|
||||
Dictionary<PtfTestOutcome, int> TestResultsStatistics {get;}
|
||||
Dictionary<PtfTestOutcome, int> TestResultsStatistics { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the runtime test related properties, such as current test case name.
|
||||
|
@ -514,15 +507,15 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <summary>
|
||||
/// Must requirement
|
||||
/// </summary>
|
||||
Must,
|
||||
Must,
|
||||
/// <summary>
|
||||
/// Should requirement
|
||||
/// </summary>
|
||||
Should,
|
||||
Should,
|
||||
/// <summary>
|
||||
/// May requirement
|
||||
/// </summary>
|
||||
May,
|
||||
May,
|
||||
/// <summary>
|
||||
/// Product behavior
|
||||
/// </summary>
|
||||
|
@ -530,5 +523,6 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <summary>
|
||||
/// Default requirement type
|
||||
/// </summary>
|
||||
Undefined }
|
||||
Undefined,
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -15,21 +15,21 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
{
|
||||
/// <summary>
|
||||
/// This class contains supporting PTF application log.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
internal static class ApplicationLog
|
||||
{
|
||||
//Output file stream name
|
||||
private const string logFileName = "PTFApplicationLog.txt";
|
||||
|
||||
//Output file stream
|
||||
private static TextWriterTraceListener textListener;
|
||||
private static TextWriterTraceListener textListener;
|
||||
|
||||
//Log message format
|
||||
private const string timeStampFormat = "{0:D4}-{1:D2}-{2:D2} {3:D2}:{4:D2}:{5:D2}.{6:D3}";
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Static Constructor for ApplicationLog.
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
/// Failure on application log should not prevent the PTF from executing
|
||||
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes")]
|
||||
static ApplicationLog()
|
||||
|
@ -38,8 +38,8 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
{
|
||||
//Initialize trace listener
|
||||
FileStream logFileStream = new FileStream(logFileName,
|
||||
FileMode.Append,
|
||||
FileAccess.Write,
|
||||
FileMode.Append,
|
||||
FileAccess.Write,
|
||||
FileShare.ReadWrite);
|
||||
|
||||
if (logFileStream != null)
|
||||
|
@ -51,10 +51,10 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
}
|
||||
catch(Exception)
|
||||
{
|
||||
//We shouldn't catch general exception, but failure on application
|
||||
//We shouldn't catch general exception, but failure on application
|
||||
//log should not prevent the PTF from executing.
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -76,10 +76,10 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
timeStamp.Second,
|
||||
timeStamp.Millisecond);
|
||||
|
||||
string logMessage = string.Format("[PTF Internal Trace Log][{0}] {1}",
|
||||
timeStampInfo,
|
||||
string logMessage = string.Format("[PTF Internal Trace Log][{0}] {1}",
|
||||
timeStampInfo,
|
||||
message);
|
||||
|
||||
|
||||
//Write the message into trace listeners
|
||||
try
|
||||
{
|
||||
|
@ -92,9 +92,9 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
}
|
||||
catch (Exception)
|
||||
{
|
||||
//We shouldn't catch general exception, but application on internal
|
||||
//We shouldn't catch general exception, but application on internal
|
||||
//log should not prevent the PTF from executing.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -16,7 +16,6 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
internal const string ProtocolName = "ProtocolName";
|
||||
internal const string ProtocolVersion = "ProtocolVersion";
|
||||
|
||||
internal const string ServerName = ConfigurationPropertyName.BeaconLogServerName;
|
||||
internal const string ServerIPInfo = "ServerIPAddress";
|
||||
internal const string ServerOSInfo = "ServerOS";
|
||||
internal const string ServerOSVendor = "ServerOSVendor";
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -39,7 +39,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
{
|
||||
get { return profilesMap; }
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of LogProfile.
|
||||
/// </summary>
|
||||
|
@ -119,7 +119,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
{
|
||||
throw new ArgumentException("The log sink doesn't exist.", "sinkName");
|
||||
}
|
||||
|
||||
|
||||
if (!profilesMap.ContainsKey(profileName))
|
||||
{
|
||||
throw new ArgumentException(String.Format("The profile \"{0}\" does not exist.", profileName), "profileName");
|
||||
|
@ -140,7 +140,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
entry[sinkName] = logNeededKinds;
|
||||
}
|
||||
|
||||
// Add a log-needed kind into the
|
||||
// Add a log-needed kind into the
|
||||
if (!logNeededKinds.Contains(kind))
|
||||
{
|
||||
logNeededKinds.Add(kind);
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -281,9 +281,9 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
}
|
||||
|
||||
private void AddFileSink(
|
||||
string name,
|
||||
string directory,
|
||||
string file,
|
||||
string name,
|
||||
string directory,
|
||||
string file,
|
||||
string format)
|
||||
{
|
||||
if (!Directory.Exists(directory))
|
||||
|
@ -308,7 +308,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
}
|
||||
|
||||
private void AddCustomSink(
|
||||
string name,
|
||||
string name,
|
||||
string type)
|
||||
{
|
||||
// Create instance of custom type sink from a assembly.
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -48,11 +48,11 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
/// <param name="timeStamp">The timestamp when the log information is created.</param>
|
||||
/// <param name="testProperties">The current test runtime properties.</param>
|
||||
public virtual void PrepareLogInformation(
|
||||
LogEntryKind kind,
|
||||
string message,
|
||||
LogEntryKind kind,
|
||||
string message,
|
||||
DateTime timeStamp,
|
||||
Dictionary<string, Object> testProperties)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -35,161 +35,12 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
}
|
||||
}
|
||||
|
||||
internal class SafeNativeMethods
|
||||
{
|
||||
private SafeNativeMethods()
|
||||
{
|
||||
}
|
||||
|
||||
[DllImport("netapi32.dll", SetLastError = true)]
|
||||
public static extern int NetWkstaGetInfo(
|
||||
[MarshalAs(UnmanagedType.LPWStr)]string servername,
|
||||
int level, out IntPtr lpBuffer);
|
||||
|
||||
[DllImport("Netapi32.dll", SetLastError = true)]
|
||||
public static extern int NetApiBufferFree(IntPtr Buffer);
|
||||
|
||||
}
|
||||
|
||||
internal class ServerInfoLogProvider : LogProvider
|
||||
{
|
||||
private string serverName;
|
||||
private IPAddress serverIP;
|
||||
private OperatingSystem serverOsInfo;
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
private struct WKSTA_INFO_100
|
||||
{
|
||||
public int wki102_platform_id;
|
||||
|
||||
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
|
||||
public string wki102_computername;
|
||||
|
||||
[MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
|
||||
public string wki102_langroup;
|
||||
|
||||
public int wki102_ver_major;
|
||||
|
||||
public int wki102_ver_minor;
|
||||
}
|
||||
|
||||
public override void Initialize(ITestSite testSite)
|
||||
{
|
||||
base.Initialize(testSite);
|
||||
|
||||
// Gets the server name
|
||||
serverName = testSite.Properties[ConfigurationPropertyName.BeaconLogServerName];
|
||||
|
||||
info.Add(LogInformationName.ServerOSVendor, "Microsoft");
|
||||
}
|
||||
|
||||
public override Dictionary<string, object> Information
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!info.ContainsKey(LogInformationName.ServerOSInfo))
|
||||
{
|
||||
// Make sure the server information can be obtained.
|
||||
if (GetServerInfo())
|
||||
{
|
||||
info.Add(LogInformationName.ServerOSInfo, serverOsInfo);
|
||||
}
|
||||
}
|
||||
|
||||
if (!info.ContainsKey(LogInformationName.ServerIPInfo))
|
||||
{
|
||||
// Make sure the server information can be obtained.
|
||||
if (GetServerIP())
|
||||
{
|
||||
info.Add(LogInformationName.ServerIPInfo, serverIP);
|
||||
}
|
||||
}
|
||||
return info;
|
||||
}
|
||||
}
|
||||
|
||||
private bool GetServerInfo()
|
||||
{
|
||||
if (serverName != null && serverOsInfo == null)
|
||||
{
|
||||
IntPtr buffer = new IntPtr(); //represents the struct pointer.
|
||||
|
||||
WKSTA_INFO_100 wksInfo;
|
||||
|
||||
// Call Win32 API NetWkstaGetInfo to get the server OS information.
|
||||
int result = SafeNativeMethods.NetWkstaGetInfo(serverName, 100, out buffer);
|
||||
|
||||
// 0 indicates succeeded.
|
||||
if (result == 0)
|
||||
{
|
||||
Int32 pointer = buffer.ToInt32();
|
||||
wksInfo = (WKSTA_INFO_100)Marshal.PtrToStructure(
|
||||
new IntPtr(pointer), typeof(WKSTA_INFO_100));
|
||||
|
||||
// Free unmanaged buffer.
|
||||
SafeNativeMethods.NetApiBufferFree(buffer);
|
||||
|
||||
serverOsInfo = new OperatingSystem(
|
||||
PlatformIDToEnum(wksInfo.wki102_platform_id),
|
||||
new Version(wksInfo.wki102_ver_major, wksInfo.wki102_ver_minor)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// If NetWkstaGetInfo failed, set the this information to null silently.
|
||||
serverOsInfo = null;
|
||||
}
|
||||
}
|
||||
return (serverOsInfo != null);
|
||||
}
|
||||
|
||||
private static PlatformID PlatformIDToEnum(int platformValue)
|
||||
{
|
||||
//PLATFORM_ID_DOS 300
|
||||
//PLATFORM_ID_OS2 400
|
||||
//PLATFORM_ID_NT 500
|
||||
//PLATFORM_ID_OSF 600
|
||||
//PLATFORM_ID_VMS 700
|
||||
switch (platformValue)
|
||||
{
|
||||
|
||||
case 500:
|
||||
return PlatformID.Win32NT;
|
||||
//break;
|
||||
case 300:
|
||||
case 400:
|
||||
case 600:
|
||||
case 700:
|
||||
default:
|
||||
throw new FormatException(String.Format("PlatformID ({0}) is not a valid platform id.", platformValue));
|
||||
}
|
||||
}
|
||||
|
||||
private bool GetServerIP()
|
||||
{
|
||||
if (serverName != null && serverIP == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
serverIP = Dns.GetHostEntry(serverName).AddressList[0];
|
||||
}
|
||||
catch (SocketException)
|
||||
{
|
||||
// An error is encountered when resolving the host name, then set serverIP to null silently,
|
||||
// and try to resolve next time.
|
||||
serverIP = null;
|
||||
}
|
||||
}
|
||||
return (serverIP != null);
|
||||
}
|
||||
}
|
||||
|
||||
internal class TestInfoLogProvider : LogProvider
|
||||
{
|
||||
private enum TestStatus
|
||||
{
|
||||
Framework,
|
||||
Running,
|
||||
Running,
|
||||
Start,
|
||||
Stop
|
||||
}
|
||||
|
@ -203,23 +54,23 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
Error,
|
||||
Timeout,
|
||||
Aborted,
|
||||
Unknown
|
||||
Unknown
|
||||
}
|
||||
|
||||
private TestResult testResult = TestResult.Unknown;
|
||||
private TestStatus testStatus = TestStatus.Framework;
|
||||
private string testCaseName;
|
||||
private string testCaseName;
|
||||
|
||||
|
||||
|
||||
public override void Initialize(ITestSite testSite)
|
||||
{
|
||||
base.Initialize(testSite);
|
||||
info[LogInformationName.TestName] = testSite.TestName;
|
||||
info[LogInformationName.TestName] = testSite.TestName;
|
||||
}
|
||||
|
||||
public override void PrepareLogInformation(
|
||||
LogEntryKind kind,
|
||||
string message,
|
||||
LogEntryKind kind,
|
||||
string message,
|
||||
DateTime timeStamp,
|
||||
Dictionary<string, Object> testProperties)
|
||||
{
|
||||
|
@ -241,7 +92,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
UpdateStatus(currentTestOutcome);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public override Dictionary<string, object> Information
|
||||
{
|
||||
get
|
||||
|
@ -258,7 +109,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
{
|
||||
info[LogInformationName.TestCaseName] = testCaseName;
|
||||
}
|
||||
|
||||
|
||||
info[LogInformationName.TestResult] = testResult;
|
||||
info[LogInformationName.TestStatus] = testStatus;
|
||||
|
||||
|
@ -318,8 +169,8 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
result = TestResult.InProgress;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return result;
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -27,16 +27,16 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
EntryMode,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates logging a message as the beginning of a logging group.
|
||||
/// Indicates logging a message as the beginning of a logging group.
|
||||
/// For example, LogEntryKind.BeginGroup, LogEntryKind.EnterAdapter, LogEntryKind.EnterMethod, etc.
|
||||
/// </summary>
|
||||
BeginGroupMode,
|
||||
BeginGroupMode,
|
||||
|
||||
/// <summary>
|
||||
/// Indicates logging a message as the end of a logging group.
|
||||
/// For example, LogEntryKind.ExitGroup, LogEntryKind.ExitAdapter, LogEntryKind.ExitMethod, etc.
|
||||
/// For example, LogEntryKind.ExitGroup, LogEntryKind.ExitAdapter, LogEntryKind.ExitMethod, etc.
|
||||
/// </summary>
|
||||
EndGroupMode
|
||||
EndGroupMode
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -70,7 +70,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
|
||||
/// <summary>
|
||||
/// The stack for logged begin group entries to verify if they match correct end group entries.
|
||||
/// Should push a kind when logging a begin group entry and pop
|
||||
/// Should push a kind when logging a begin group entry and pop
|
||||
/// </summary>
|
||||
private Stack<LogEntryKind> loggedBeginGroupEntries = new Stack<LogEntryKind>();
|
||||
|
||||
|
@ -115,7 +115,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
protected abstract void OnWriteEntry(Dictionary<string, object> information);
|
||||
|
||||
/// <summary>
|
||||
/// Writes a message as the beginning of a log group into the current log sink.
|
||||
/// Writes a message as the beginning of a log group into the current log sink.
|
||||
/// Entering and existing of a group logging message must be matched.
|
||||
/// </summary>
|
||||
/// <param name="information">The information of the log entry.</param>
|
||||
|
@ -127,7 +127,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes a message as the end of a log group into the current log sink.
|
||||
/// Writes a message as the end of a log group into the current log sink.
|
||||
/// Entering and existing of a group logging message must be matched.
|
||||
/// </summary>
|
||||
/// <param name="information">The information of the log entry.</param>
|
||||
|
@ -202,7 +202,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
for (int i = 0; i < message.Length; i++)
|
||||
{
|
||||
ch = message[i];
|
||||
|
||||
|
||||
//Refer to REC-xml-20040204 section 2.2
|
||||
//Available at http://www.w3.org/TR/2004/REC-xml-20040204/#charsets
|
||||
if ((ch >= 0x0020 && ch <= 0xD7FF) ||
|
||||
|
@ -231,7 +231,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructs a new instance of the <see cref="LogSink"/> class.
|
||||
/// Constructs a new instance of the <see cref="LogSink"/> class.
|
||||
/// </summary>
|
||||
/// <param name="name">The specified sink name.</param>
|
||||
protected LogSink(string name)
|
||||
|
@ -248,12 +248,12 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Flushes the logging information into the current sink.
|
||||
/// Flushes the logging information into the current sink.
|
||||
/// </summary>
|
||||
public abstract void Flush();
|
||||
|
||||
/// <summary>
|
||||
/// Closes the current sink and releases resources.
|
||||
/// Closes the current sink and releases resources.
|
||||
/// </summary>
|
||||
public void Close()
|
||||
{
|
||||
|
@ -289,8 +289,8 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
/// can be disposed.
|
||||
/// </summary>
|
||||
/// <param name="disposing">
|
||||
/// If disposing equals false, the method is called by the
|
||||
/// runtime from inside the finalizer and you should not reference
|
||||
/// If disposing equals false, the method is called by the
|
||||
/// runtime from inside the finalizer and you should not reference
|
||||
/// other objects. Only unmanaged resources can be disposed.
|
||||
/// </param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
|
@ -303,21 +303,21 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||
/// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
Dispose(true);
|
||||
// This object will be cleaned up by the Dispose method.
|
||||
// Therefore, you should call GC.SupressFinalize to
|
||||
// take this object off the finalization queue
|
||||
// take this object off the finalization queue
|
||||
// and prevent finalization code for this object
|
||||
// from executing a second time.
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This destructor will run only if the Dispose method
|
||||
/// This destructor will run only if the Dispose method
|
||||
/// does not get called.
|
||||
/// It gives your base class the opportunity to finalize.
|
||||
/// Do not provide destructors in types derived from this class.
|
||||
|
@ -350,8 +350,8 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
protected const string newLine = "\r\n";
|
||||
|
||||
/// <summary>
|
||||
/// The string to be inserted for an indent.
|
||||
/// Can be several spaces or tabs.
|
||||
/// The string to be inserted for an indent.
|
||||
/// Can be several spaces or tabs.
|
||||
/// </summary>
|
||||
private string indent = " ";
|
||||
|
||||
|
@ -393,7 +393,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
|
||||
/// <summary>
|
||||
/// Implements <see cref="LogSink.Flush"/>.
|
||||
/// Flushes <see cref="TextSink.Writer"/>.
|
||||
/// Flushes <see cref="TextSink.Writer"/>.
|
||||
/// </summary>
|
||||
public override void Flush()
|
||||
{
|
||||
|
@ -404,8 +404,8 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
/// Implements <see cref="LogSink.Dispose(bool)"/>.
|
||||
/// </summary>
|
||||
/// <param name="disposing">
|
||||
/// If disposing equals false, the method is called by the
|
||||
/// runtime from inside the finalizer and you should not reference
|
||||
/// If disposing equals false, the method is called by the
|
||||
/// runtime from inside the finalizer and you should not reference
|
||||
/// other objects. Only unmanaged resources can be disposed.
|
||||
/// </param>
|
||||
protected override void Dispose(bool disposing)
|
||||
|
@ -478,8 +478,8 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Replaces the format item in a specified message with the text equivalent
|
||||
/// of the value of a corresponding object instance in a specified array.
|
||||
/// Replaces the format item in a specified message with the text equivalent
|
||||
/// of the value of a corresponding object instance in a specified array.
|
||||
/// </summary>
|
||||
/// <param name="message">A string containing zero or more format items. </param>
|
||||
/// <param name="args">An object array containing zero or more objects to format.</param>
|
||||
|
@ -539,7 +539,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
|
||||
/// <summary>
|
||||
/// Implements <see cref="LogSink.Flush"/>.
|
||||
/// Flushes <see cref="XmlSink.Writer"/>.
|
||||
/// Flushes <see cref="XmlSink.Writer"/>.
|
||||
/// </summary>
|
||||
public override void Flush()
|
||||
{
|
||||
|
@ -550,8 +550,8 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
/// Implements <see cref="LogSink.Dispose(bool)"/>.
|
||||
/// </summary>
|
||||
/// <param name="disposing">
|
||||
/// If disposing equals false, the method is called by the
|
||||
/// runtime from inside the finalizer and you should not reference
|
||||
/// If disposing equals false, the method is called by the
|
||||
/// runtime from inside the finalizer and you should not reference
|
||||
/// other objects. Only unmanaged resources can be disposed.
|
||||
/// </param>
|
||||
protected override void Dispose(bool disposing)
|
||||
|
@ -594,7 +594,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
}
|
||||
string testCaseName = string.Empty;
|
||||
if (information.ContainsKey(TestPropertyNames.CurrentTestCaseName))
|
||||
{
|
||||
{
|
||||
testCaseName = (string)information[TestPropertyNames.CurrentTestCaseName];
|
||||
}
|
||||
WriteEntry(
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -97,7 +97,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Reads and processes log messages
|
||||
/// </summary>
|
||||
|
@ -212,7 +212,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registers a log provider to the current logger. The registered providers' properties
|
||||
/// Registers a log provider to the current logger. The registered providers' properties
|
||||
/// is to be appended into the information property bag and be delivered to log sinks.
|
||||
/// </summary>
|
||||
/// <param name="provider">The log provider instance to be registered.</param>
|
||||
|
@ -239,7 +239,6 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
{
|
||||
RegisterLogProvider(new ConfigPropertyLogProvider());
|
||||
RegisterLogProvider(new ClientInfoLogProvider());
|
||||
RegisterLogProvider(new ServerInfoLogProvider());
|
||||
RegisterLogProvider(new TestInfoLogProvider());
|
||||
RegisterLogProvider(new ReqInfoLogProvider());
|
||||
}
|
||||
|
@ -324,8 +323,8 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
/// This method will close all log sinks.
|
||||
/// </summary>
|
||||
/// <param name="disposing">
|
||||
/// If disposing equals false, the method is called by the
|
||||
/// runtime from inside the finalizer and you should not reference
|
||||
/// If disposing equals false, the method is called by the
|
||||
/// runtime from inside the finalizer and you should not reference
|
||||
/// other objects. Only unmanaged resources can be disposed.
|
||||
/// </param>
|
||||
protected virtual void Dispose(bool disposing)
|
||||
|
@ -410,7 +409,7 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
/// </summary>
|
||||
/// <param name="kind">The log message kind.</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array containing one or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array containing one or more objects to format.</param>
|
||||
public void Add(LogEntryKind kind, string message, params object[] parameters)
|
||||
{
|
||||
AvoidInvalidCall();
|
||||
|
@ -490,24 +489,24 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
}
|
||||
|
||||
Add(LogEntryKind.Comment, "begin output test statistics.");
|
||||
|
||||
|
||||
int executedTests = 0;
|
||||
foreach (int count in Site.TestResultsStatistics.Values)
|
||||
{
|
||||
executedTests += count;
|
||||
}
|
||||
|
||||
|
||||
Add(LogEntryKind.Comment, "PTFTestResult.{0}: {1}",
|
||||
LogInformationName.TestsExecuted, executedTests);
|
||||
|
||||
foreach (KeyValuePair<PtfTestOutcome, int> kvp in Site.TestResultsStatistics)
|
||||
{
|
||||
Add(LogEntryKind.Comment,
|
||||
Add(LogEntryKind.Comment,
|
||||
"PTFTestResult.{0}: {1}",
|
||||
LogInformationName.TestStatusName[kvp.Key],
|
||||
LogInformationName.TestStatusName[kvp.Key],
|
||||
kvp.Value);
|
||||
}
|
||||
|
||||
|
||||
outputStatistics[testSite] = false;
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -31,7 +31,9 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
/// <returns>The corresponding string in the resource.</returns>
|
||||
public static string GetString(string name, params object[] parameters)
|
||||
{
|
||||
string str = Messages.ResourceManager.GetString(name);
|
||||
//string str = Messages.ResourceManager.GetString(name);
|
||||
System.Reflection.FieldInfo field = typeof(Messages).GetField(name);
|
||||
string str = (string)field.GetValue(null);
|
||||
return String.Format(str, parameters);
|
||||
}
|
||||
|
||||
|
@ -75,6 +77,6 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
return logEntryKind;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,63 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
namespace Microsoft.Protocols.TestTools.Logging
|
||||
{
|
||||
/// <summary>
|
||||
/// A static class which contains the XML node names in the PTF configuration files.
|
||||
/// </summary>
|
||||
public static class Messages
|
||||
{
|
||||
// TODO: it seems dotnet core does not support l10n right now
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Expected: <{0}>, Actual: <{1}>. {2}.
|
||||
/// </summary>
|
||||
public const string AreEqualFailMsg = "Expected: <{0}>, Actual: <{1}>. {2}";
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Expected: <{0}>, Actual: <{1}>. {2}.
|
||||
/// </summary>
|
||||
public const string AreNotEqualFailMsg = "Expected: <{0}>, Actual: <{1}>. {2}";
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0}.{1} failed. {2}.
|
||||
/// </summary>
|
||||
public const string CheckFailed = "{0}.{1} failed. {2}";
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0}.{1} failed on requirement {2}. {3}.
|
||||
/// </summary>
|
||||
public const string CheckFailedOnReqId = "{0}.{1} failed on requirement {2}. {3}";
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0}.{1} is inconclusive. {2}.
|
||||
/// </summary>
|
||||
public const string CheckInconclusive = "{0}.{1} is inconclusive. {2}";
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to {0}.{1} succeeded. {2}.
|
||||
/// </summary>
|
||||
public const string CheckSucceeded = "{0}.{1} succeeded. {2}";
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to The kind of message log entry must match..
|
||||
/// </summary>
|
||||
public const string EntryKindMissMatch = "The kind of message log entry must match.";
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to entryType does not implement the ILogEntry interface.
|
||||
/// </summary>
|
||||
public const string EntryTypeLogFilterArguementMessage = "entryType does not implement the ILogEntry interface";
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Expected Type: <{0}>, Actual Type: <{1}>. {2}.
|
||||
/// </summary>
|
||||
public const string IsInstanceOfFailMsg = "Expected Type: <{0}>, Actual Type: <{1}>. {2}";
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Wrong Type: <{0}>, Actual Type: <{1}>. {2}.
|
||||
/// </summary>
|
||||
public const string IsNotInstanceOfFailMsg = "Wrong Type: <{0}>, Actual Type: <{1}>. {2}";
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -132,15 +132,15 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
/// can be disposed.
|
||||
/// </summary>
|
||||
/// <param name="disposing">
|
||||
/// If disposing equals false, the method is called by the
|
||||
/// runtime from inside the finalizer and you should not reference
|
||||
/// If disposing equals false, the method is called by the
|
||||
/// runtime from inside the finalizer and you should not reference
|
||||
/// other objects. Only unmanaged resources can be disposed.
|
||||
/// </param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
|
||||
// Should not access managed resouses if Dispose is called from the finalizer
|
||||
// Should not access managed resouses if Dispose is called from the finalizer
|
||||
// when disposing is true.
|
||||
if (disposing && writer != null)
|
||||
{
|
||||
|
@ -199,8 +199,8 @@ namespace Microsoft.Protocols.TestTools.Logging
|
|||
/// can be disposed.
|
||||
/// </summary>
|
||||
/// <param name="disposing">
|
||||
/// If disposing equals false, the method is called by the
|
||||
/// runtime from inside the finalizer and you should not reference
|
||||
/// If disposing equals false, the method is called by the
|
||||
/// runtime from inside the finalizer and you should not reference
|
||||
/// other objects. Only unmanaged resources can be disposed.
|
||||
/// </param>
|
||||
protected override void Dispose(bool disposing)
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -31,7 +31,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
{
|
||||
return TestSiteProvider.GetTestSite(testSuiteName);
|
||||
}
|
||||
|
||||
|
||||
public void TestsRunCleanup()
|
||||
{
|
||||
TestSiteProvider.Cleanup();
|
||||
|
@ -44,11 +44,11 @@ namespace Microsoft.Protocols.TestTools
|
|||
|
||||
public IProtocolTestNotify GetProtocolTestNotify(string testSuiteName)
|
||||
{
|
||||
|
||||
|
||||
return TestSiteProvider.GetProtocolTestNotify(testSuiteName);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -10,7 +10,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
{
|
||||
/// <summary>
|
||||
/// A class which creates the unified message for captured requirements.
|
||||
/// This class can be used from modeling code as well as from test suite code.
|
||||
/// This class can be used from modeling code as well as from test suite code.
|
||||
/// </summary>
|
||||
public static class RequirementId
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <returns>The requirement id. Format <docShortName>_R<number>.</returns>
|
||||
public static string Make(string docShortName, int number, string description)
|
||||
{
|
||||
if (String.IsNullOrEmpty(description) ||
|
||||
if (String.IsNullOrEmpty(description) ||
|
||||
String.IsNullOrEmpty(description.Trim()))
|
||||
{
|
||||
throw new ArgumentException("description can't be null or empty", "description");
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -7,8 +7,6 @@ using System.Text;
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.ComponentModel;
|
||||
using Microsoft.Win32;
|
||||
using Microsoft.Protocols.TestTools.Logging;
|
||||
|
||||
namespace Microsoft.Protocols.TestTools
|
||||
{
|
||||
|
@ -39,7 +37,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
throw new ArgumentNullException("context", "Test context cannot be null.");
|
||||
}
|
||||
|
||||
Initialize(config, context.TestDeploymentDir, testSuiteName, testAssemblyName);
|
||||
Initialize(config, context.TestDeploymentDir, testSuiteName, testAssemblyName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -66,7 +64,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
|
||||
private static void InitializeTestSite(
|
||||
IConfigurationData config,
|
||||
string configPath,
|
||||
string configPath,
|
||||
string testSuiteName,
|
||||
PtfTestOutcome currentTestOutCome,
|
||||
string testAssemblyName)
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -16,27 +16,27 @@ namespace Microsoft.Protocols.TestTools
|
|||
public static class TestToolHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Resolves the Type with the specified name, performing a case-sensitive search
|
||||
/// Resolves the Type with the specified name, performing a case-sensitive search
|
||||
/// in the assemblies in the current AppDomain or specified assembly.
|
||||
/// </summary>
|
||||
/// <param name="nameOfType">The name of the assembly-qualified name of the Type. </param>
|
||||
/// <param name="assemblyLoadDir">Specified directory where to search the assembly.</param>
|
||||
/// <returns>The Type with the specified name, if found.</returns>
|
||||
/// <remarks>This method first searches the type in assemblies loaded in current AppDomain, then, if fails,
|
||||
/// <remarks>This method first searches the type in assemblies loaded in current AppDomain, then, if fails,
|
||||
/// searches into the assembly specified in the assembly qualified type name.</remarks>
|
||||
internal static Type ResolveTypeFromAssemblies(string nameOfType, string assemblyLoadDir)
|
||||
{
|
||||
Type type = null;
|
||||
|
||||
Assembly[] cands =AppDomain.CurrentDomain.GetAssemblies();
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
// Resolves the requesting type from the assemblies in the current AppDomain.
|
||||
// Resolves the requesting type from the assemblies in the current AppDomain.
|
||||
foreach (Assembly assm in cands)
|
||||
{
|
||||
type = assm.GetType(nameOfType, false);
|
||||
|
||||
|
||||
if (type != null)
|
||||
break;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
{
|
||||
type = ResolveTypeByLoadAssembly(nameOfType, Environment.CurrentDirectory);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return type;
|
||||
|
@ -128,7 +128,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// Creates an instance of the specified type using the constructor that best matches the specified parameters.
|
||||
/// </summary>
|
||||
/// <param name="nameOfType">The type name of object to create. </param>
|
||||
/// <param name="args">An array of arguments that matches in number, order, and type the parameters
|
||||
/// <param name="args">An array of arguments that matches in number, order, and type the parameters
|
||||
/// of the constructor to invoke.</param>
|
||||
/// <returns>A reference to the newly created object. </returns>
|
||||
internal static object CreateInstanceFromTypeName(string nameOfType, params object[] args)
|
||||
|
@ -238,7 +238,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
|
@ -34,13 +34,6 @@
|
|||
<xs:attribute name="description" type="xs:string" use="optional"/>
|
||||
</xs:complexType>
|
||||
|
||||
<!-- Interactive Adapter -->
|
||||
<xs:complexType name="interactive">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="tc:adapterBase" />
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<!-- PowerShell Script Adapter -->
|
||||
<xs:complexType name="powershell">
|
||||
<xs:complexContent>
|
||||
|
@ -51,16 +44,6 @@
|
|||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<!-- Shell Script Adapter -->
|
||||
<xs:complexType name="shell">
|
||||
<xs:complexContent>
|
||||
<xs:extension base="tc:adapterBase">
|
||||
<!-- Attribute "scriptdir" is the scripts' location. -->
|
||||
<xs:attribute name="scriptdir" type="xs:string" use="required"/>
|
||||
</xs:extension>
|
||||
</xs:complexContent>
|
||||
</xs:complexType>
|
||||
|
||||
<!-- Managed Adapter -->
|
||||
<xs:complexType name="managed">
|
||||
<xs:complexContent>
|
|
@ -0,0 +1,23 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<AssemblyName>Microsoft.Protocols.TestTools</AssemblyName>
|
||||
<RootNamespace>Microsoft.Protocols.TestTools</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.1.3" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="*.ptfconfig">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="*.xsd">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -13,7 +13,7 @@ elementFormDefault="qualified" attributeFormDefault="unqualified">
|
|||
<xs:attribute name="timeStamp" type="xs:dateTime" use="required" />
|
||||
<xs:attribute name ="testCase" type="xs:string" use ="optional" />
|
||||
</xs:complexType>
|
||||
|
||||
|
||||
<!-- Root element, attributes of this element should not be changed. -->
|
||||
<xs:element name="TestLog">
|
||||
<xs:complexType>
|
|
@ -1,11 +1,10 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.Protocols.TestTools.Checking;
|
||||
using System.Reflection;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
|
@ -25,7 +24,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
public readonly Exception exception;
|
||||
public readonly string stackTraceString;
|
||||
|
||||
public ErrorDescriptor(Exception exception,
|
||||
public ErrorDescriptor(Exception exception,
|
||||
string stackTraceString)
|
||||
{
|
||||
this.exception = exception;
|
||||
|
@ -60,7 +59,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <param name="maxFailuresToDisplayPerTestCase">The maxNumber of failure messages displayed.</param>
|
||||
public AsynchronousErrorProcessor(int assertFailuresBeforeThrowException, int maxFailuresToDisplayPerTestCase)
|
||||
{
|
||||
// The thread in which the AsynchronousErrorProcessor is created
|
||||
// The thread in which the AsynchronousErrorProcessor is created
|
||||
// will be set as the main thread by default.
|
||||
mainThread = Thread.CurrentThread;
|
||||
this.assertFailuresBeforeThrowException = assertFailuresBeforeThrowException;
|
||||
|
@ -97,7 +96,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
}
|
||||
|
||||
private string GenerateBypassedErrorMessage()
|
||||
{
|
||||
{
|
||||
string message = string.Empty;
|
||||
if (errors.Count > 0)
|
||||
{
|
||||
|
@ -149,7 +148,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
string message = GenerateBypassedErrorMessage();
|
||||
object exception = Activator.CreateInstance(type, message);
|
||||
|
||||
// Error list must be cleaned here.
|
||||
// Error list must be cleaned here.
|
||||
errors.Clear();
|
||||
throw (Exception)exception;
|
||||
}
|
||||
|
@ -157,7 +156,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Adds the exception reported by checkers to the error list and terminates the current thread if current thread is not main thread.
|
||||
/// Adds the exception reported by checkers to the error list and terminates the current thread if current thread is not main thread.
|
||||
/// </summary>
|
||||
/// <param name="checkerException">The exception generated by checkers.</param>
|
||||
public void ReportAsyncException(Exception checkerException)
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -28,8 +28,8 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
/// Initializes a new instance of TestDebugException with a specified error message and an inner exception.
|
||||
/// </summary>
|
||||
/// <param name="message">The error message that explains the reason for the exception.</param>
|
||||
/// <param name="inner">The exception that is the cause of the current exception. If the parameter is not a
|
||||
/// null reference, the current exception is raised in a catch block that handles
|
||||
/// <param name="inner">The exception that is the cause of the current exception. If the parameter is not a
|
||||
/// null reference, the current exception is raised in a catch block that handles
|
||||
/// the inner exception. </param>
|
||||
public TestDebugException(string message, Exception inner) : base(message, inner) { }
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
|
@ -35,8 +35,8 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
Inconclusive
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// An abstract base class of checkers which implements IChecker.
|
||||
/// </summary>
|
||||
|
@ -70,10 +70,10 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
/// <param name="inconclusiveLogKind">The log entry kind for logging an inconclusive check.</param>
|
||||
/// <param name="checkerConfig">The checker confuguration to crate async error processor.</param>
|
||||
protected DefaultChecker(
|
||||
ITestSite testSite,
|
||||
ITestSite testSite,
|
||||
string checkerName,
|
||||
LogEntryKind failedLogKind,
|
||||
LogEntryKind succeededLogKind,
|
||||
LogEntryKind failedLogKind,
|
||||
LogEntryKind succeededLogKind,
|
||||
LogEntryKind inconclusiveLogKind,
|
||||
ICheckerConfig checkerConfig)
|
||||
{
|
||||
|
@ -145,7 +145,7 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
//Do not need default.
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
testSite.Log.Add(
|
||||
kind,
|
||||
|
@ -156,7 +156,7 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
LogFailingStacks();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dumps the call stacks of the calling assembly to logs.
|
||||
|
@ -164,7 +164,7 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
private void LogFailingStacks()
|
||||
{
|
||||
// The call stack frame count of PTF if there is a call to here. Currently there are 3 frames of DefaultChecker`2
|
||||
const int skipFrames = 3;
|
||||
const int skipFrames = 3;
|
||||
|
||||
StackTrace st = new StackTrace(skipFrames, true);
|
||||
if (st.FrameCount <= 0)
|
||||
|
@ -211,8 +211,8 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
switch (checkResult)
|
||||
{
|
||||
case CheckResult.Succeeded:
|
||||
return LoggingHelper.GetString("CheckSucceeded", checkerName, checkMethodName, text);
|
||||
|
||||
return LoggingHelper.GetString("CheckSucceeded", checkerName, checkMethodName, text);
|
||||
|
||||
case CheckResult.Failed:
|
||||
if (null == requirementId)
|
||||
{
|
||||
|
@ -220,7 +220,7 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
}
|
||||
else
|
||||
{
|
||||
return LoggingHelper.GetString("CheckFailedOnReqId",
|
||||
return LoggingHelper.GetString("CheckFailedOnReqId",
|
||||
checkerName, checkMethodName, requirementId, text);
|
||||
}
|
||||
|
||||
|
@ -341,7 +341,7 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
/// <param name="message">A message that describes the exception.</param>
|
||||
/// <returns>The instance of TInconclusiveException type</returns>
|
||||
protected abstract TInconclusiveException CreateInconclusiveException(string message);
|
||||
|
||||
|
||||
#region IChecker Members
|
||||
|
||||
/// <summary>
|
||||
|
@ -384,7 +384,7 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
/// This method generates a log entry and throws an inconclusive exception if failed.
|
||||
/// </summary>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array which contains one or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array which contains one or more objects to format.</param>
|
||||
public void Inconclusive(string message, params object[] parameters)
|
||||
{
|
||||
string text = GetInformationString(CheckResult.Inconclusive, "Inconclusive", message, parameters);
|
||||
|
@ -447,7 +447,7 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
/// <param name="expected">The first object to compare. This is the object the test expects.</param>
|
||||
/// <param name="actual">The second object to compare. This is the object the test produced.</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array which contains zero or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array which contains zero or more objects to format.</param>
|
||||
public void AreNotEqual<T>(T expected, T actual, string message, params object[] parameters)
|
||||
{
|
||||
// Set text and res to the default values of successful condition.
|
||||
|
@ -478,14 +478,14 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
/// <param name="expected">The first object to compare. This is the object the test expects.</param>
|
||||
/// <param name="actual">The second object to compare. This is the object the test produced.</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array which contains zero or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array which contains zero or more objects to format.</param>
|
||||
public void AreSame(object expected, object actual, string message, params object[] parameters)
|
||||
{
|
||||
// Set text and res to the default values of successful condition.
|
||||
string text = (message == null) ? string.Empty : message; // To store additional information
|
||||
|
||||
// We don't need additional information in this case.
|
||||
CheckResult res = object.ReferenceEquals(expected, actual) ?
|
||||
CheckResult res = object.ReferenceEquals(expected, actual) ?
|
||||
CheckResult.Succeeded : CheckResult.Failed; // The result of the check.
|
||||
|
||||
text = GetInformationString(res, "AreSame", text, parameters);
|
||||
|
@ -500,7 +500,7 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
/// <param name="expected">The first object to compare. This is the object the test expects.</param>
|
||||
/// <param name="actual">The second object to compare. This is the object the test produced.</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array which contains zero or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array which contains zero or more objects to format.</param>
|
||||
public void AreNotSame(object expected, object actual, string message, params object[] parameters)
|
||||
{
|
||||
// Set text and res to the default values of successful condition.
|
||||
|
@ -521,7 +521,7 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
/// </summary>
|
||||
/// <param name="value">The bool value to check.</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array which contains zero or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array which contains zero or more objects to format.</param>
|
||||
public void IsTrue(bool value, string message, params object[] parameters)
|
||||
{
|
||||
// Set text and res to the default values of successful condition.
|
||||
|
@ -542,7 +542,7 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
/// </summary>
|
||||
/// <param name="value">The bool value to check.</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array which contains zero or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array which contains zero or more objects to format.</param>
|
||||
public void IsFalse(bool value, string message, params object[] parameters)
|
||||
{
|
||||
// Set text and res to the default values of successful condition.
|
||||
|
@ -606,7 +606,7 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
/// <param name="value">The object value to check.</param>
|
||||
/// <param name="type">The object type to check.</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array which contains zero or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array which contains zero or more objects to format.</param>
|
||||
public void IsInstanceOfType(object value, Type type, string message, params object[] parameters)
|
||||
{
|
||||
// Set text and res to the default values of successful condition.
|
||||
|
@ -677,7 +677,7 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
/// </summary>
|
||||
/// <param name="hresult">The HRESULT value to check.</param>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array which contains zero or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array which contains zero or more objects to format.</param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly")]
|
||||
public void IsSuccess(int hresult, string message, params object[] parameters)
|
||||
{
|
||||
|
@ -697,7 +697,7 @@ namespace Microsoft.Protocols.TestTools.Checking
|
|||
/// Implements <see cref="IChecker.Unverified"/>
|
||||
/// </summary>
|
||||
/// <param name="message">A composite format string.</param>
|
||||
/// <param name="parameters">An Object array which contains zero or more objects to format.</param>
|
||||
/// <param name="parameters">An Object array which contains zero or more objects to format.</param>
|
||||
public void Unverified(string message, params object[] parameters)
|
||||
{
|
||||
testSite.Log.Add(LogEntryKind.CheckUnverified, message, parameters);
|
|
@ -1,18 +1,16 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using Microsoft.Protocols.TestTools.Checking;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Microsoft.Protocols.TestTools;
|
||||
using Microsoft.Protocols.TestTools.Logging;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.Protocols.TestTools.Checking;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.Protocols.TestTools
|
||||
{
|
||||
|
@ -22,27 +20,12 @@ namespace Microsoft.Protocols.TestTools
|
|||
[TestClass]
|
||||
public abstract class TestClassBase
|
||||
{
|
||||
[DllImport("kernel32.dll", EntryPoint = "AllocConsole", SetLastError = true,
|
||||
CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
|
||||
private static extern int AllocConsole();
|
||||
|
||||
[DllImport("kernel32.dll", EntryPoint = "GetConsoleWindow", SetLastError = true)]
|
||||
private static extern IntPtr GetConsoleWindow();
|
||||
|
||||
[DllImport("user32.dll", EntryPoint = "IsWindowVisible", CharSet = CharSet.Auto)]
|
||||
private static extern bool IsWindowVisible(IntPtr hWnd);
|
||||
|
||||
[DllImport("user32.dll", EntryPoint = "ShowWindow", CharSet = CharSet.Auto)]
|
||||
private static extern bool ShowWindow(IntPtr hWnd, uint nCmdShow);
|
||||
|
||||
private TestContext context;
|
||||
private TestContext context;
|
||||
private ITestSite testSite;
|
||||
private IProtocolTestContext ptfTestContext;
|
||||
private IProtocolTestNotify ptfTestNotify;
|
||||
//private Type testClass;
|
||||
private string testSuiteName;
|
||||
// Instance of AutoCapture class
|
||||
private static IAutoCapture autoCapture;
|
||||
// Holds list of test cases for which the netmon trace should be captured
|
||||
private static List<string> selectedTestCases = new List<string>();
|
||||
// Holds the start time of the testsuite execution
|
||||
|
@ -59,7 +42,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// <summary>
|
||||
/// Constructor uses the default test suit name
|
||||
/// </summary>
|
||||
protected TestClassBase()
|
||||
protected TestClassBase()
|
||||
{
|
||||
|
||||
IProtocolTestsManager manager = ProtocolTestsManagerFactory.TestsManager;
|
||||
|
@ -73,14 +56,6 @@ namespace Microsoft.Protocols.TestTools
|
|||
testSuiteName = suiteNameCache[this.GetType()];
|
||||
testSite = manager.GetTestSite(testSuiteName);
|
||||
ptfTestNotify = manager.GetProtocolTestNotify(testSuiteName);
|
||||
if (testSite == null)
|
||||
{
|
||||
StringBuilder errorMsg = new StringBuilder();
|
||||
errorMsg.AppendFormat("Cannot get the test site {0}.", testSuiteName)
|
||||
.AppendLine()
|
||||
.Append("If you are running test suite from Visual Studio, please make sure that the TestSettings file is selected in TEST\\Test Settings menu.");
|
||||
throw new InvalidOperationException(errorMsg.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -88,7 +63,6 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
/// <param name="configPath">Configuration path</param>
|
||||
/// <param name="testSuiteName">Test suite name</param>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters")]
|
||||
protected TestClassBase(string configPath, string testSuiteName)
|
||||
{
|
||||
}
|
||||
|
@ -96,7 +70,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
#region VSTS properties and methods
|
||||
|
||||
/// <summary>
|
||||
/// Only for internal use. This property is to support the VSTS infrastructure.
|
||||
/// Only for internal use. This property is to support the VSTS infrastructure.
|
||||
/// Don't use this property in your test code.
|
||||
/// </summary>
|
||||
public TestContext TestContext
|
||||
|
@ -146,7 +120,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
#region TSD methods
|
||||
/// <summary>
|
||||
|
@ -197,15 +171,6 @@ namespace Microsoft.Protocols.TestTools
|
|||
//on test start
|
||||
string testName = this.GetType().FullName + "." + ProtocolTestContext.TestMethodName;
|
||||
this.ptfTestNotify.OnTestStarted(this, testName, ProtocolTestContext.TestOutcome, AssertExceptionHandler);
|
||||
try
|
||||
{
|
||||
if (autoCapture != null) autoCapture.StartCapture(ProtocolTestContext.TestMethodName);
|
||||
}
|
||||
catch (AutoCaptureException e)
|
||||
{
|
||||
baseTestSite.Log.Add(LogEntryKind.Warning, "Auto capture start capture Error: " + e.Message);
|
||||
if (e.StopRunning) throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -215,23 +180,14 @@ namespace Microsoft.Protocols.TestTools
|
|||
/// </summary>
|
||||
[TestCleanup]
|
||||
public void BaseTestCleanup()
|
||||
{
|
||||
{
|
||||
//on test finished
|
||||
string testName = this.GetType().FullName + "." + ProtocolTestContext.TestMethodName;
|
||||
this.ptfTestNotify.OnTestFinished(this, testName, ProtocolTestContext.TestOutcome, AssertExceptionHandler);
|
||||
try
|
||||
{
|
||||
if (autoCapture != null) autoCapture.StopCapture();
|
||||
}
|
||||
catch (AutoCaptureException e)
|
||||
{
|
||||
baseTestSite.Log.Add(LogEntryKind.Warning, "Auto capture cleanup Error: " + e.Message);
|
||||
if (e.StopRunning) throw;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the test suite base class.
|
||||
/// Initializes the test suite base class.
|
||||
/// This method must be called by class initialize method in your test class.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
|
@ -264,7 +220,7 @@ namespace Microsoft.Protocols.TestTools
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the test suite base class with explicitly given test suite name.
|
||||
/// Initializes the test suite base class with explicitly given test suite name.
|
||||
/// This method must be called by class initialize method in your test class.
|
||||
/// </summary>
|
||||
/// <param name="testContext">VSTS test context.</param>
|
||||
|
@ -283,8 +239,14 @@ namespace Microsoft.Protocols.TestTools
|
|||
if (null == manager.GetTestSite(staticTestSuiteName))
|
||||
{
|
||||
string testAssemblyName;
|
||||
IConfigurationData config = ConfigurationDataProvider.GetConfigurationData(
|
||||
testContext.TestDeploymentDir, testSuiteName);
|
||||
IConfigurationData config = null;
|
||||
|
||||
string assemblyPath = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath;
|
||||
string testDeploymentDir = Path.GetDirectoryName(assemblyPath);
|
||||
|
||||
config = ConfigurationDataProvider.GetConfigurationData(
|
||||
testDeploymentDir, testSuiteName);
|
||||
|
||||
if (isUseDefaultSuiteName)
|
||||
{
|
||||
testAssemblyName = testSuiteName;
|
||||
|
@ -299,21 +261,6 @@ namespace Microsoft.Protocols.TestTools
|
|||
|
||||
baseTestSite = manager.GetTestSite(testSuiteName);
|
||||
|
||||
if (IsCommandlineConsoleRulePresent(config.Profiles))
|
||||
{
|
||||
AllocConsole();
|
||||
IntPtr hWnd = GetConsoleWindow();
|
||||
bool visible = IsWindowVisible(hWnd);
|
||||
if (!visible) ShowWindow(hWnd, 9); // 9 SW_RESTORE. Make the console visible.
|
||||
Console.WriteLine("Test Results:");
|
||||
Console.WriteLine("==============");
|
||||
string consoleWidth = baseTestSite.Properties.Get("ConsoleWidth");
|
||||
if (consoleWidth != null) Console.WindowWidth = Convert.ToInt32(consoleWidth);
|
||||
string consoleHeight = baseTestSite.Properties.Get("ConsoleHeight");
|
||||
if (consoleHeight != null) Console.WindowHeight = Convert.ToInt32(consoleHeight);
|
||||
string consoleBufferHeight = baseTestSite.Properties.Get("ConsoleBufferHeight");
|
||||
if (consoleBufferHeight != null) Console.BufferHeight = Convert.ToInt32(consoleBufferHeight);
|
||||
}
|
||||
ITestSite site = manager.GetTestSite(testSuiteName);
|
||||
|
||||
//registry all checkers
|
||||
|
@ -329,49 +276,10 @@ namespace Microsoft.Protocols.TestTools
|
|||
* Log expected execution time of the test suite in the log file *
|
||||
**************************************************************************************/
|
||||
baseTestSite.Log.Add(LogEntryKind.Comment, "Expected execution time of the test suite (in seconds) is: " + baseTestSite.Properties.Get("ExpectedExecutionTime"));
|
||||
|
||||
//************* Automatic network message capture.*************
|
||||
if (Convert.ToBoolean(baseTestSite.Properties.Get("PTF.NetworkCapture.Enabled")))
|
||||
{
|
||||
string assemblyFile = baseTestSite.Properties.Get("PTF.NetworkCapture.Assembly");
|
||||
if (assemblyFile == null)
|
||||
{
|
||||
// Use logman to capture by default.
|
||||
autoCapture = new LogmanCapture();
|
||||
}
|
||||
else
|
||||
{
|
||||
Assembly assembly = Assembly.LoadFrom(assemblyFile);
|
||||
string className = baseTestSite.Properties.Get("PTF.NetworkCapture.Class");
|
||||
if (className != null)
|
||||
{
|
||||
autoCapture = (IAutoCapture)assembly.CreateInstance(className);
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (Type type in assembly.GetTypes())
|
||||
{
|
||||
if (type.IsClass && typeof(IAutoCapture).IsAssignableFrom(type))
|
||||
{
|
||||
autoCapture = (IAutoCapture)Activator.CreateInstance(type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
if (autoCapture != null) autoCapture.Initialize(baseTestSite.Properties, testSuiteName);
|
||||
}
|
||||
catch (AutoCaptureException e)
|
||||
{
|
||||
baseTestSite.Log.Add(LogEntryKind.Warning, "Auto capture initialize Error: " + e.Message);
|
||||
if (e.StopRunning) throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cleans up the test suite.
|
||||
/// Cleans up the test suite.
|
||||
/// User must call this method in ClassCleanup method.
|
||||
/// </summary>
|
||||
public static void Cleanup()
|
||||
|
@ -379,21 +287,6 @@ namespace Microsoft.Protocols.TestTools
|
|||
classCount--;
|
||||
if (classCount == 0)
|
||||
{
|
||||
//************* Automatic network message capture.*************
|
||||
if (autoCapture != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
autoCapture.Cleanup();
|
||||
}
|
||||
catch (AutoCaptureException e)
|
||||
{
|
||||
baseTestSite.Log.Add(LogEntryKind.Warning, "Auto capture cleanup Error: " + e.Message);
|
||||
if (e.StopRunning) throw;
|
||||
}
|
||||
autoCapture = null;
|
||||
}
|
||||
|
||||
/********************* Display expected runtime of the testsuite **************************
|
||||
* Calculates the actual time taken for the test suite execution and logs it in log file *
|
||||
******************************************************************************************/
|
||||
|
@ -502,29 +395,5 @@ namespace Microsoft.Protocols.TestTools
|
|||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private static bool IsCommandlineConsoleRulePresent(Collection<ProfileConfig> profiles)
|
||||
{
|
||||
foreach (ProfileConfig profile in profiles)
|
||||
{
|
||||
Collection<ProfileRuleConfig> rules = profile.Rules;
|
||||
foreach (ProfileRuleConfig rule in rules)
|
||||
{
|
||||
// if there is at least 1 rule that uses "CommandlineConsole" sink which is not a deletion entry
|
||||
// delete=true implies the rule is deleted. So a rule with delete=true need not be counted
|
||||
switch (rule.Sink.ToLower())
|
||||
{
|
||||
case "redconsole":
|
||||
case "greenconsole":
|
||||
case "whiteconsole":
|
||||
case "yellowconsole":
|
||||
case "commandlineconsole":
|
||||
if(rule.Delete == false) return true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,8 +1,10 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
|
@ -15,22 +17,19 @@ namespace Microsoft.Protocols.TestTools
|
|||
|
||||
public VstsTestContext(TestContext context)
|
||||
{
|
||||
this.context = context;
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
#region IProtocolTestContext Members
|
||||
|
||||
public string TestDeploymentDir
|
||||
{
|
||||
get
|
||||
get
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"The Protocol Test Context can't be null");
|
||||
}
|
||||
string assemblyPath = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath;
|
||||
string testDeploymentDir = Path.GetDirectoryName(assemblyPath);
|
||||
|
||||
return context.TestDeploymentDir;
|
||||
return testDeploymentDir;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
||||
<TestSite xmlns="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
|
@ -12,7 +12,6 @@
|
|||
<Sinks>
|
||||
<Console id="Console"/>
|
||||
<Console id="CommandLineConsole"/>
|
||||
<Sink id="Beacon" type="Microsoft.Protocols.TestTools.Logging.BeaconLogSink" assembly="Microsoft.Protocols.TestTools"/>
|
||||
</Sinks>
|
||||
<Profiles>
|
||||
<Profile name="Error">
|
|
@ -1,10 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<TestSite xmlns="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig.xsd">
|
||||
|
||||
<Properties>
|
||||
<Property name="BasePropertyName" value="BasePropertyValue" />
|
||||
<Property name="BasePropertyName" value="BasePropertyValue" />
|
||||
<Property name="DuplicatePropertyName" value="Base" />
|
||||
</Properties>
|
||||
</TestSite>
|
|
@ -0,0 +1,6 @@
|
|||
#############################################################################
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#############################################################################
|
||||
|
||||
return $value
|
|
@ -0,0 +1,6 @@
|
|||
#############################################################################
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#############################################################################
|
||||
|
||||
return $number
|
|
@ -0,0 +1,6 @@
|
|||
#############################################################################
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#############################################################################
|
||||
|
||||
return $str
|
|
@ -0,0 +1,7 @@
|
|||
#############################################################################
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#############################################################################
|
||||
|
||||
# Throw an exception
|
||||
throw $exceptionMessage
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<TestSite xmlns="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig.xsd">
|
||||
|
@ -9,10 +9,8 @@ xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/T
|
|||
<Property name="FeatureName" value="PTF:Adapter" />
|
||||
</Properties>
|
||||
<Adapters>
|
||||
<Adapter xsi:type="managed" name="IManagedAdapter" adaptertype="Microsoft.Protocols.TestTools.Test.TestAdapter.ManagedAdapter"/>
|
||||
<Adapter xsi:type="shell" name="IShellAdapter" scriptdir=".\"/>
|
||||
<Adapter xsi:type="powershell" name="IPowershellAdapter" scriptdir=".\"/>
|
||||
<Adapter xsi:type="interactive" name="IInteractiveAdapter"/>
|
||||
<Adapter xsi:type="managed" name="IManagedAdapter" adaptertype="Microsoft.Protocols.TestTools.UnitTest.TestAdapter.ManagedAdapter"/>
|
||||
<Adapter xsi:type="powershell" name="IPowershellAdapter" scriptdir=".\PowerShell\"/>
|
||||
</Adapters>
|
||||
<!-- The default profile name. Provide maximum logging. -->
|
||||
<TestLog defaultprofile="Verbose">
|
|
@ -1,13 +1,13 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.Protocols.TestTools;
|
||||
using Microsoft.Protocols.TestTools.Checking;
|
||||
using Microsoft.Protocols.TestTools.Test.Utilities;
|
||||
using Microsoft.Protocols.TestTools.UnitTest.Utilities;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace Microsoft.Protocols.TestTools.Test.TestChecker
|
||||
namespace Microsoft.Protocols.TestTools.UnitTest.TestChecker
|
||||
{
|
||||
/// <summary>
|
||||
/// A class used for testing.
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<TestSite xmlns="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig.xsd">
|
||||
|
@ -10,7 +10,7 @@ xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/T
|
|||
<Sinks>
|
||||
<Console id="Console" />
|
||||
</Sinks>
|
||||
|
||||
|
||||
<Profiles>
|
||||
<!-- Name of the profile. extends indicates the profile will be included.-->
|
||||
<Profile name="Verbose" extends="Error">
|
|
@ -1,14 +1,14 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using Microsoft.Protocols.TestTools;
|
||||
using Microsoft.Protocols.TestTools.Logging;
|
||||
using Microsoft.Protocols.TestTools.Test.Utilities;
|
||||
using Microsoft.Protocols.TestTools.UnitTest.Utilities;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace Microsoft.Protocols.TestTools.Test.TestLogging
|
||||
namespace Microsoft.Protocols.TestTools.UnitTest.TestLogging
|
||||
{
|
||||
/// <summary>
|
||||
/// Defines a custom log sink.
|
|
@ -1,44 +1,32 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<TestSite xmlns="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig.xsd">
|
||||
|
||||
|
||||
<Properties>
|
||||
<!-- Test suite properties which value not changed when running in different test environments -->
|
||||
<Property name="FeatureName" value="PTF:Logging" />
|
||||
|
||||
<!-- Enable automatic network capturing -->
|
||||
<Group name="PTF">
|
||||
<Group name="NetworkCapture">
|
||||
<Property name="Enabled" value="true" />
|
||||
<Property name="CaptureFileFolder" value="C:\PTFCaptureFileFolder" />
|
||||
<Property name="StopRunningOnError" value="false" />
|
||||
</Group>
|
||||
</Group>
|
||||
|
||||
|
||||
<!-- This feature enables a user to display expected/actual runtime of the test suite on the console. -->
|
||||
<Property name="ExpectedExecutionTime" value="5000" />
|
||||
|
||||
</Properties>
|
||||
|
||||
|
||||
<!-- The default profile name. Provide maximum logging. -->
|
||||
<TestLog defaultprofile="Verbose">
|
||||
<Sinks>
|
||||
<!-- Custom log -->
|
||||
<Sink id="MySink" type="Microsoft.Protocols.TestTools.Test.TestLogging.MySink" />
|
||||
|
||||
<!-- Beacon Log sink-->
|
||||
<Sink id="Beacon" type="Microsoft.Protocols.TestTools.Logging.BeaconLogSink"/>
|
||||
|
||||
<Sink id="MySink" type="Microsoft.Protocols.TestTools.UnitTest.TestLogging.MySink" />
|
||||
|
||||
<!-- File log sink. Id is name, directory is the dir which log will stored in. file is the name of log. Format can be text or xml-->
|
||||
<File id="MyLog" directory="..\..\" file="MyLog.txt" format="text"/>
|
||||
<File id="MyXMLLog" directory="..\..\" file="MyXmlLog.xml" format="xml"/>
|
||||
|
||||
|
||||
<!-- Color console log sink -->
|
||||
<Console id="RedConsole" />
|
||||
<Console id="GreenConsole" />
|
||||
<Console id="YellowConsole" />
|
||||
<Console id="WhiteConsole" />
|
||||
<Console id="WhiteConsole" />
|
||||
</Sinks>
|
||||
|
||||
<Profiles>
|
||||
|
@ -57,8 +45,8 @@ xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/T
|
|||
<Rule kind="TestInconclusive" sink="Console" delete="false"/>
|
||||
<Rule kind="TestPassed" sink="Console" delete="false"/>
|
||||
<Rule kind="BeginGroup" sink="Console" delete="false"/>
|
||||
<Rule kind="EndGroup" sink="Console" delete="false"/>
|
||||
|
||||
<Rule kind="EndGroup" sink="Console" delete="false"/>
|
||||
|
||||
<!-- Command line Console & Color console logging -->
|
||||
<!-- Console logging lets the user see the log of the test run as it proceeds. The user can terminate a running test case by looking at its progress. -->
|
||||
<!-- Color Console Logging makes Log message displayed in the Console can be colorized. -->
|
||||
|
@ -76,23 +64,6 @@ xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/T
|
|||
<Rule kind="BeginGroup" sink="CommandLineConsole" delete="false"/>
|
||||
<Rule kind="EndGroup" sink="CommandLineConsole" delete="false"/>
|
||||
|
||||
<!-- Beacon logging -->
|
||||
<!-- Beacon logging provides a way for PTF users to log necessary log messages as network packets.
|
||||
A user can define a beacon logging sink in the PTF Config file which is similar with other log sinks, and then the log messages are sent to the UDP broadcast address using port 58727. -->
|
||||
<Rule kind="TestStep" sink="Beacon" delete="false"/>
|
||||
<Rule kind="Checkpoint" sink="Beacon" delete="false"/>
|
||||
<Rule kind="CheckSucceeded" sink="Beacon" delete="false"/>
|
||||
<Rule kind="CheckFailed" sink="Beacon" delete="false"/>
|
||||
<Rule kind="CheckInconclusive" sink="Beacon" delete="false"/>
|
||||
<Rule kind="Comment" sink="Beacon" delete="false"/>
|
||||
<Rule kind="Warning" sink="Beacon" delete="false"/>
|
||||
<Rule kind="Debug" sink="Beacon" delete="false"/>
|
||||
<Rule kind="TestFailed" sink="Beacon" delete="false"/>
|
||||
<Rule kind="TestInconclusive" sink="Beacon" delete="false"/>
|
||||
<Rule kind="TestPassed" sink="Beacon" delete="false"/>
|
||||
<Rule kind="BeginGroup" sink="Beacon" delete="false"/>
|
||||
<Rule kind="EndGroup" sink="Beacon" delete="false"/>
|
||||
|
||||
<!-- Custom logging: MySink -->
|
||||
<Rule kind="TestStep" sink="MySink" delete="false"/>
|
||||
<Rule kind="Checkpoint" sink="MySink" delete="false"/>
|
||||
|
@ -107,7 +78,7 @@ xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/T
|
|||
<Rule kind="TestPassed" sink="MySink" delete="false"/>
|
||||
<Rule kind="BeginGroup" sink="MySink" delete="false"/>
|
||||
<Rule kind="EndGroup" sink="MySink" delete="false"/>
|
||||
|
||||
|
||||
<!-- File Logging: text -->
|
||||
<!-- File logging provides a way for PTF users to log necessary messages to files. PTF provides two logging file formats, plain text and XML. -->
|
||||
<!-- The plain text format is suitable for viewing the log file using text editors. -->
|
||||
|
@ -123,8 +94,8 @@ xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/T
|
|||
<Rule kind="TestInconclusive" sink="MyLog" delete="false"/>
|
||||
<Rule kind="TestPassed" sink="MyLog" delete="false"/>
|
||||
<Rule kind="BeginGroup" sink="MyLog" delete="false"/>
|
||||
<Rule kind="EndGroup" sink="MyLog" delete="false"/>
|
||||
|
||||
<Rule kind="EndGroup" sink="MyLog" delete="false"/>
|
||||
|
||||
<!-- File Logging: XML -->
|
||||
<!-- File logging provides a way for PTF users to log necessary messages to files. PTF provides two logging file formats, plain text and XML. -->
|
||||
<!-- The XML format is for analysing the test log using tools, such as the Reporting Tool. -->
|
||||
|
@ -140,7 +111,7 @@ xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/T
|
|||
<Rule kind="TestInconclusive" sink="MyXMLLog" delete="false"/>
|
||||
<Rule kind="TestPassed" sink="MyXMLLog" delete="false"/>
|
||||
<Rule kind="BeginGroup" sink="MyXMLLog" delete="false"/>
|
||||
<Rule kind="EndGroup" sink="MyXMLLog" delete="false"/>
|
||||
<Rule kind="EndGroup" sink="MyXMLLog" delete="false"/>
|
||||
</Profile>
|
||||
</Profiles>
|
||||
</TestLog>
|
|
@ -1,16 +1,16 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.Protocols.TestTools;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.Protocols.TestTools.Test.Utilities;
|
||||
using Microsoft.Protocols.TestTools.UnitTest.Utilities;
|
||||
|
||||
namespace Microsoft.Protocols.TestTools.Test.TestAdapter
|
||||
namespace Microsoft.Protocols.TestTools.UnitTest.TestAdapter
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface definition of a managed adapter
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public interface IManagedAdapter : IAdapter
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -75,7 +75,7 @@ namespace Microsoft.Protocols.TestTools.Test.TestAdapter
|
|||
{
|
||||
BaseTestSite.Assert.AreEqual(
|
||||
3 + 4,
|
||||
managedAdapter.Sum(3, 4),
|
||||
managedAdapter.Sum(3, 4),
|
||||
"Managed adapter should return 7");
|
||||
}
|
||||
|
|
@ -1,16 +1,16 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.Protocols.TestTools;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.Protocols.TestTools.Test.Utilities;
|
||||
using Microsoft.Protocols.TestTools.UnitTest.Utilities;
|
||||
|
||||
namespace Microsoft.Protocols.TestTools.Test.TestAdapter
|
||||
namespace Microsoft.Protocols.TestTools.UnitTest.TestAdapter
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface definition of a powershell adapter
|
||||
/// </summary>
|
||||
/// </summary>
|
||||
public interface IPowershellAdapter : IAdapter
|
||||
{
|
||||
[MethodHelp("Powershell script will throw an exception.")]
|
||||
|
@ -74,7 +74,7 @@ namespace Microsoft.Protocols.TestTools.Test.TestAdapter
|
|||
{
|
||||
BaseTestSite.Assert.AreEqual(
|
||||
0,
|
||||
powershellAdapter.ReturnInt(0),
|
||||
powershellAdapter.ReturnInt(0),
|
||||
"Powershell adapter should return 0");
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ namespace Microsoft.Protocols.TestTools.Test.TestAdapter
|
|||
{
|
||||
BaseTestSite.Assert.AreEqual(
|
||||
"PTF",
|
||||
powershellAdapter.ReturnString("PTF"),
|
||||
powershellAdapter.ReturnString("PTF"),
|
||||
"Powershell adapter should return PTF");
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ namespace Microsoft.Protocols.TestTools.Test.TestAdapter
|
|||
public void PowershellAdapterReturnBool()
|
||||
{
|
||||
BaseTestSite.Assert.IsTrue(
|
||||
powershellAdapter.ReturnBool(true),
|
||||
powershellAdapter.ReturnBool(true),
|
||||
"Powershell adapter should return true");
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.Protocols.TestTools;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace Microsoft.Protocols.TestTools.Test.TestProperties
|
||||
namespace Microsoft.Protocols.TestTools.UnitTest.TestProperties
|
||||
{
|
||||
/// <summary>
|
||||
/// Test cases to test reading properties defined in .ptfconfig file
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<TestSite xmlns="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig.xsd">
|
||||
|
||||
<Properties>
|
||||
<Property name="DeploymentPropertyName" value="DeploymentPropertyValue" />
|
||||
<Property name="DeploymentPropertyName" value="DeploymentPropertyValue" />
|
||||
</Properties>
|
||||
</TestSite>
|
|
@ -1,12 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<TestSite xmlns="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig.xsd">
|
||||
|
||||
|
||||
<Include>
|
||||
<File name="Base.ptfconfig"/>
|
||||
</Include>
|
||||
|
||||
|
||||
<Properties>
|
||||
<!-- Properties for testing -->
|
||||
<Group name="Root">
|
||||
|
@ -24,7 +24,7 @@ xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/T
|
|||
<!-- Test suite properties which value not changed when running in different test environments -->
|
||||
<Property name="FeatureName" value="PTF:Properties" />
|
||||
</Properties>
|
||||
|
||||
|
||||
<!-- The default profile name. Provide maximum logging. -->
|
||||
<TestLog defaultprofile="Verbose">
|
||||
<Profiles>
|
|
@ -1,12 +1,12 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.Protocols.TestTools;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.Protocols.TestTools.Test.Utilities;
|
||||
using Microsoft.Protocols.TestTools.UnitTest.Utilities;
|
||||
|
||||
namespace Microsoft.Protocols.TestTools.Test.TestRequirementCapture
|
||||
namespace Microsoft.Protocols.TestTools.UnitTest.TestRequirementCapture
|
||||
{
|
||||
/// <summary>
|
||||
/// Test cases to test PTF RequirementCapture
|
||||
|
@ -20,7 +20,7 @@ namespace Microsoft.Protocols.TestTools.Test.TestRequirementCapture
|
|||
TestClassBase.Initialize(testContext, "TestRequirementCapture");
|
||||
BaseTestSite.DefaultProtocolDocShortName = "TestRequirementCapture";
|
||||
}
|
||||
|
||||
|
||||
[ClassCleanup]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ namespace Microsoft.Protocols.TestTools.Test.TestRequirementCapture
|
|||
public void CaptureRequirementAddRequirement()
|
||||
{
|
||||
BaseTestSite.Log.Add(
|
||||
LogEntryKind.Checkpoint,
|
||||
LogEntryKind.Checkpoint,
|
||||
RequirementId.Make(BaseTestSite.DefaultProtocolDocShortName, 0, "Add a requirement."));
|
||||
BaseTestSite.CaptureRequirement(0, "Add a requirement.");
|
||||
}
|
||||
|
@ -46,8 +46,8 @@ namespace Microsoft.Protocols.TestTools.Test.TestRequirementCapture
|
|||
|
||||
[TestMethod]
|
||||
[TestCategory("TestRequirementCapture")]
|
||||
[PTFExpectedException(typeof(AssertFailedException), "Assert.AreEqual failed on requirement TestRequirementCapture_R2. " +
|
||||
"Expected: <1 (0x00000001)>, Actual: <2 (0x00000002)>. The two values should be equal.")]
|
||||
[PTFExpectedException(typeof(AssertFailedException), "Assert.AreEqual failed on requirement TestRequirementCapture_R2. " +
|
||||
"Expected: <1 (0x00000001)>, Actual: <2 (0x00000002)>. The two values should be equal.")]
|
||||
public void CaptureRequirementAreEqualFailed()
|
||||
{
|
||||
BaseTestSite.CaptureRequirementIfAreEqual(1, 2, 2, "The two values should be equal.");
|
||||
|
@ -143,15 +143,15 @@ namespace Microsoft.Protocols.TestTools.Test.TestRequirementCapture
|
|||
public void CaptureRequirementIsNotInstanceOfPassed()
|
||||
{
|
||||
BaseTestSite.CaptureRequirementIfIsNotInstanceOfType(
|
||||
2,
|
||||
typeof(System.String),
|
||||
2,
|
||||
typeof(System.String),
|
||||
13,
|
||||
"The type of the instance should not be System.String.");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory("TestRequirementCapture")]
|
||||
[PTFExpectedException(typeof(AssertFailedException), "Assert.IsNotInstanceOfType failed on requirement TestRequirementCapture_R14. " +
|
||||
[PTFExpectedException(typeof(AssertFailedException), "Assert.IsNotInstanceOfType failed on requirement TestRequirementCapture_R14. " +
|
||||
"Wrong Type: <System.Int32>, Actual Type: <System.Int32>. The type of the instance should not be System.Int32.")]
|
||||
public void CaptureRequirementIsNotInstanceOfFailed()
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<TestSite xmlns="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/TestConfig.xsd">
|
||||
|
@ -9,7 +9,7 @@ xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/T
|
|||
<Property name="FeatureName" value="PTF:RequirementCapture" />
|
||||
|
||||
<!--Requirements Section begins. All the property elements for the Requirements information should be in this section.-->
|
||||
|
||||
|
||||
<!-- Skip the below requirement types from getting validated: -->
|
||||
<Property name="SkipMAYRequirements" value="true"/>
|
||||
<Property name="SkipMUSTRequirements" value="true"/>
|
||||
|
@ -22,9 +22,9 @@ xsi:schemaLocation="http://schemas.microsoft.com/windows/ProtocolsTest/2007/07/T
|
|||
<!-- When an exceptional requirement fails, the test case continues running with the failure logged in entry CheckFailed and Exceptional Requirement. -->
|
||||
<!-- List the exceptional requirements as below -->
|
||||
<Property name="ExceptionalRequirements" value="TestRequirementCapture_R26,TestRequirementCapture_R27" />
|
||||
|
||||
|
||||
<!--Requirements Section ends.-->
|
||||
|
||||
|
||||
</Properties>
|
||||
<!-- The default profile name. Provide maximum logging. -->
|
||||
<TestLog defaultprofile="Verbose">
|
|
@ -0,0 +1,32 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.1</TargetFramework>
|
||||
<IsPackable>false</IsPackable>
|
||||
<AssemblyName>Microsoft.Protocols.TestTools.UnitTest</AssemblyName>
|
||||
<RootNamespace>Microsoft.Protocols.TestTools.UnitTest</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\TestFramework\TestFramework.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="*.ptfconfig">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="PowerShell\**">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -1,10 +1,10 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
namespace Microsoft.Protocols.TestTools.Test.Utilities
|
||||
namespace Microsoft.Protocols.TestTools.UnitTest.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// An attrubite used for check if an expected exception is thrown in the case.
|
||||
|
@ -33,7 +33,7 @@ namespace Microsoft.Protocols.TestTools.Test.Utilities
|
|||
|
||||
Assert.IsInstanceOfType(
|
||||
exception,
|
||||
ptfExpectedExceptionType,
|
||||
ptfExpectedExceptionType,
|
||||
"Wrong type of exception was thrown.");
|
||||
|
||||
if (!ptfExpectedExceptionMessage.Length.Equals(0))
|
36
src/ptf.sln
36
src/ptf.sln
|
@ -1,36 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27703.2042
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestTools", "testtools\TestTools.csproj", "{1CA2B935-3224-40F1-84BC-47FA1A9B242E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestTools.VSTS", "testtools.vsts\TestTools.VSTS.csproj", "{3CB878CB-0CD3-447F-8DD8-8A0C62B7C3AF}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{63D7F908-6684-4FCB-9FF3-4A0A02CBFD1E}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
SharedAssemblyInfo.cs = SharedAssemblyInfo.cs
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1CA2B935-3224-40F1-84BC-47FA1A9B242E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1CA2B935-3224-40F1-84BC-47FA1A9B242E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1CA2B935-3224-40F1-84BC-47FA1A9B242E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1CA2B935-3224-40F1-84BC-47FA1A9B242E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3CB878CB-0CD3-447F-8DD8-8A0C62B7C3AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3CB878CB-0CD3-447F-8DD8-8A0C62B7C3AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3CB878CB-0CD3-447F-8DD8-8A0C62B7C3AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3CB878CB-0CD3-447F-8DD8-8A0C62B7C3AF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {3005C0B4-5942-4167-9D63-9ACF591DB423}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,38 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<TestSettings name="Local" id="b3852d91-e8e8-46ef-a881-a0b4142b4961" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
|
||||
<Description>These are default test settings for a local test run.</Description>
|
||||
<Deployment>
|
||||
<DeploymentItem filename="..\testtools\config\site.ptfconfig" />
|
||||
<DeploymentItem filename="..\testtools\config\TestConfig.xsd" />
|
||||
<DeploymentItem filename="TestLogging\TestLogging.ptfconfig" />
|
||||
<DeploymentItem filename="TestRequirementCapture\TestRequirementCapture.ptfconfig" />
|
||||
<DeploymentItem filename="TestProperties\TestProperties.ptfconfig" />
|
||||
<DeploymentItem filename="TestProperties\TestProperties.deployment.ptfconfig" />
|
||||
<DeploymentItem filename="TestProperties\Base.ptfconfig" />
|
||||
<DeploymentItem filename="TestChecker\TestChecker.ptfconfig" />
|
||||
<DeploymentItem filename="TestAdapter\TestAdapter.ptfconfig" />
|
||||
<DeploymentItem filename="TestAdapter\Powershell\" />
|
||||
<DeploymentItem filename="TestAdapter\Shell\" />
|
||||
</Deployment>
|
||||
<Execution hostProcessPlatform="MSIL">
|
||||
<TestTypeSpecific>
|
||||
<UnitTestRunConfig testTypeId="13cdc9d9-ddb5-4fa4-a97d-d965ccfc6d4b">
|
||||
<AssemblyResolution>
|
||||
<TestDirectory useLoadContext="true" />
|
||||
</AssemblyResolution>
|
||||
</UnitTestRunConfig>
|
||||
<WebTestRunConfiguration testTypeId="4e7599fa-5ecb-43e9-a887-cd63cf72d207">
|
||||
<Browser name="Internet Explorer 7.0">
|
||||
<Headers>
|
||||
<Header name="User-Agent" value="Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)" />
|
||||
<Header name="Accept" value="*/*" />
|
||||
<Header name="Accept-Language" value="{{$IEAcceptLanguage}}" />
|
||||
<Header name="Accept-Encoding" value="GZIP" />
|
||||
</Headers>
|
||||
</Browser>
|
||||
</WebTestRunConfiguration>
|
||||
</TestTypeSpecific>
|
||||
<AgentRule name="LocalMachineDefaultRole">
|
||||
</AgentRule>
|
||||
</Execution>
|
||||
</TestSettings>
|
|
@ -1,6 +0,0 @@
|
|||
#############################################################################
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#############################################################################
|
||||
|
||||
return $value
|
|
@ -1,6 +0,0 @@
|
|||
#############################################################################
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#############################################################################
|
||||
|
||||
return $number
|
|
@ -1,6 +0,0 @@
|
|||
#############################################################################
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#############################################################################
|
||||
|
||||
return $str
|
|
@ -1,7 +0,0 @@
|
|||
#############################################################################
|
||||
# Copyright (c) Microsoft. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#############################################################################
|
||||
|
||||
# Throw an exception
|
||||
throw $exceptionMessage
|
|
@ -1,35 +0,0 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("TestAdapter")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TestAdapter")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("192855d0-6d37-4cc5-9f2e-1e0570a5e2e1")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -1,4 +0,0 @@
|
|||
# Copyright (c) Microsoft. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
echo $PTFProp_FeatureName
|
|
@ -1,6 +0,0 @@
|
|||
# Copyright (c) Microsoft. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
result=$1
|
||||
|
||||
echo $result
|
|
@ -1,6 +0,0 @@
|
|||
# Copyright (c) Microsoft. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
num=$1
|
||||
|
||||
echo $num
|
|
@ -1,6 +0,0 @@
|
|||
# Copyright (c) Microsoft. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
str=$1
|
||||
|
||||
echo $str
|
|
@ -1,8 +0,0 @@
|
|||
# Copyright (c) Microsoft. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
exception=$1
|
||||
|
||||
echo $exception >&2
|
||||
|
||||
exit 1
|
|
@ -1,79 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{CAC893D4-D83A-4574-ABC8-BF7DF25AC71B}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Microsoft.Protocols.TestTools.Test.TestAdapter</RootNamespace>
|
||||
<AssemblyName>TestAdapter</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="TestManagedAdapter.cs" />
|
||||
<Compile Include="TestInteractiveAdapter.cs" />
|
||||
<Compile Include="TestPowershellAdapter.cs" />
|
||||
<Compile Include="TestShellAdapter.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="PowerShell\ThrowException.ps1" />
|
||||
<Content Include="PowerShell\ReturnInt.ps1" />
|
||||
<Content Include="PowerShell\ReturnBool.ps1" />
|
||||
<Content Include="PowerShell\ReturnString.ps1" />
|
||||
<Content Include="Shell\GetPtfProp.sh" />
|
||||
<Content Include="Shell\ThrowException.sh" />
|
||||
<Content Include="Shell\ReturnInt.sh" />
|
||||
<Content Include="Shell\ReturnBool.sh" />
|
||||
<Content Include="Shell\ReturnString.sh" />
|
||||
<Content Include="TestAdapter.ptfconfig" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\testtools.extension\TestTools.Extension.csproj">
|
||||
<Project>{e41414b3-95f3-430f-823b-55b82f0ba198}</Project>
|
||||
<Name>TestTools.Extension</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\testtools.vsts\TestTools.VSTS.csproj">
|
||||
<Project>{3cb878cb-0cd3-447f-8dd8-8a0c62b7c3af}</Project>
|
||||
<Name>TestTools.VSTS</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\testtools\TestTools.csproj">
|
||||
<Project>{1ca2b935-3224-40f1-84bc-47fa1a9b242e}</Project>
|
||||
<Name>TestTools</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Utilities\Utilities.csproj">
|
||||
<Project>{cbe396d2-d8d0-43cd-bdb8-fd8ba46bb3fd}</Project>
|
||||
<Name>Utilities</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -1,86 +0,0 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.Protocols.TestTools;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.Protocols.TestTools.Test.Utilities;
|
||||
|
||||
namespace Microsoft.Protocols.TestTools.Test.TestAdapter
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface definition of an interactive adapter.
|
||||
/// </summary>
|
||||
public interface IInteractiveAdapter : IAdapter
|
||||
{
|
||||
[MethodHelp("Please enter the same value with \"Number\" and then press \"Continue\" button.")]
|
||||
int ReturnInt(int Number);
|
||||
|
||||
[MethodHelp("Please enter the same string with \"String\" (case sensitive) and then press \"Continue\" button.")]
|
||||
string ReturnString(string String);
|
||||
|
||||
[MethodHelp("Please press \"Abort\" button.")]
|
||||
void Abort();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test cases to test PTF adapter: Interactive adapter
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class TestInteractiveAdapter : TestClassBase
|
||||
{
|
||||
IInteractiveAdapter interactiveAdapter;
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
TestClassBase.Initialize(testContext, "TestAdapter");
|
||||
}
|
||||
|
||||
[ClassCleanup]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
TestClassBase.Cleanup();
|
||||
}
|
||||
|
||||
protected override void TestInitialize()
|
||||
{
|
||||
interactiveAdapter = BaseTestSite.GetAdapter<IInteractiveAdapter>();
|
||||
}
|
||||
|
||||
protected override void TestCleanup()
|
||||
{
|
||||
interactiveAdapter.Reset();
|
||||
}
|
||||
|
||||
#region Test cases
|
||||
[TestMethod]
|
||||
[TestCategory("TestAdapter")]
|
||||
public void InteractiveAdapterReturnInt()
|
||||
{
|
||||
BaseTestSite.Assert.AreEqual(
|
||||
0,
|
||||
interactiveAdapter.ReturnInt(0),
|
||||
"Returned value should be 0");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory("TestAdapter")]
|
||||
public void InteractiveAdapterReturnString()
|
||||
{
|
||||
BaseTestSite.Assert.AreEqual(
|
||||
"PTF",
|
||||
interactiveAdapter.ReturnString("PTF"),
|
||||
"Returned value should be PTF");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory("TestAdapter")]
|
||||
[PTFExpectedException(typeof(AssertInconclusiveException))]
|
||||
public void InteractiveAdapterAbort()
|
||||
{
|
||||
interactiveAdapter.Abort();
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,142 +0,0 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using Microsoft.Protocols.TestTools;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Microsoft.Protocols.TestTools.Test.Utilities;
|
||||
|
||||
namespace Microsoft.Protocols.TestTools.Test.TestAdapter
|
||||
{
|
||||
public interface IShellAdapter : IAdapter
|
||||
{
|
||||
[MethodHelp("The script does not exist.")]
|
||||
void ScriptNotExisted();
|
||||
|
||||
[MethodHelp("Return the value of the property \"FeatureName\".")]
|
||||
string GetPtfProp();
|
||||
|
||||
[MethodHelp("Shell script will throw an exception.")]
|
||||
void ThrowException(string exceptionMessage);
|
||||
|
||||
[MethodHelp("Shell script will return an integer.")]
|
||||
int ReturnInt(int number);
|
||||
|
||||
[MethodHelp("Shell script will return a string.")]
|
||||
string ReturnString(string str);
|
||||
|
||||
[MethodHelp("Shell script will return a boolean.")]
|
||||
bool ReturnBool(bool value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Test cases to test PTF adapter: Script adapter
|
||||
/// </summary>
|
||||
[TestClass]
|
||||
public class TestShellAdapter : TestClassBase
|
||||
{
|
||||
IShellAdapter shellAdapter;
|
||||
|
||||
[ClassInitialize]
|
||||
public static void ClassInitialize(TestContext testContext)
|
||||
{
|
||||
TestClassBase.Initialize(testContext, "TestAdapter");
|
||||
}
|
||||
|
||||
[ClassCleanup]
|
||||
public static void ClassCleanup()
|
||||
{
|
||||
TestClassBase.Cleanup();
|
||||
}
|
||||
|
||||
protected override void TestInitialize()
|
||||
{
|
||||
shellAdapter = BaseTestSite.GetAdapter<IShellAdapter>();
|
||||
}
|
||||
|
||||
protected override void TestCleanup()
|
||||
{
|
||||
shellAdapter.Reset();
|
||||
}
|
||||
|
||||
#region Test cases
|
||||
[TestMethod]
|
||||
[TestCategory("TestAdapter")]
|
||||
[PTFExpectedException(typeof(AssertInconclusiveException), "Assume.Fail failed. Shell script file (ScriptNotExisted.sh) can not be found.")]
|
||||
public void ShellAdapterScriptNotExisted()
|
||||
{
|
||||
shellAdapter.ScriptNotExisted();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory("TestAdapter")]
|
||||
public void ShellAdapterGetPtfProp()
|
||||
{
|
||||
string propName = "FeatureName";
|
||||
BaseTestSite.Assert.AreEqual(
|
||||
BaseTestSite.Properties[propName],
|
||||
shellAdapter.GetPtfProp(),
|
||||
"Script adapter should return property value of {0}", propName);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory("TestAdapter")]
|
||||
[PTFExpectedException(typeof(InvalidOperationException))]
|
||||
public void ShellAdapterThrowException()
|
||||
{
|
||||
shellAdapter.ThrowException("Exception message.");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory("TestAdapter")]
|
||||
public void ShellAdapterReturnInt()
|
||||
{
|
||||
int num = 42;
|
||||
BaseTestSite.Assert.AreEqual(
|
||||
num,
|
||||
shellAdapter.ReturnInt(num),
|
||||
"Shell adapter should return " + num);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory("TestAdapter")]
|
||||
public void ShellAdpaterReturnString()
|
||||
{
|
||||
string str = "PTF";
|
||||
BaseTestSite.Assert.AreEqual(
|
||||
str,
|
||||
shellAdapter.ReturnString(str),
|
||||
"Shell adapter should return " + str);
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory("TestAdapter")]
|
||||
public void ShellAdapterReturnTrue()
|
||||
{
|
||||
BaseTestSite.Assert.IsTrue(
|
||||
shellAdapter.ReturnBool(true),
|
||||
"Shell adapter should return true");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory("TestAdapter")]
|
||||
public void ShellAdapterReturnFalse()
|
||||
{
|
||||
BaseTestSite.Assert.IsFalse(
|
||||
shellAdapter.ReturnBool(false),
|
||||
"Shell adapter should return false");
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
[TestCategory("TestAdapter")]
|
||||
public void ShellAdpaterReturnStringContainingSpecialCharaters()
|
||||
{
|
||||
string str = "It's great!!";
|
||||
BaseTestSite.Assert.AreEqual(
|
||||
str,
|
||||
shellAdapter.ReturnString(str),
|
||||
"Shell adapter should return " + str);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("TestChecker")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TestChecker")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("5f75baee-2487-4510-ac97-146c0fe23505")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -1,61 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{483F6AF6-773A-441E-B38C-E3E222692D1C}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Microsoft.Protocols.TestTools.Test.TestChecker</RootNamespace>
|
||||
<AssemblyName>TestChecker</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
<Reference Include="System" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="TestChecker.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="TestChecker.ptfconfig" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\testtools.vsts\TestTools.VSTS.csproj">
|
||||
<Project>{3cb878cb-0cd3-447f-8dd8-8a0c62b7c3af}</Project>
|
||||
<Name>TestTools.VSTS</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\testtools\TestTools.csproj">
|
||||
<Project>{1ca2b935-3224-40f1-84bc-47fa1a9b242e}</Project>
|
||||
<Name>TestTools</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Utilities\Utilities.csproj">
|
||||
<Project>{cbe396d2-d8d0-43cd-bdb8-fd8ba46bb3fd}</Project>
|
||||
<Name>Utilities</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -1,35 +0,0 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("TestLogging")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TestLogging")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("9bdbcf67-d0f8-479d-a2fb-08a0d29b17a8")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -1,63 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{07E873F6-A11C-473B-99E0-B5FA3F50B7C3}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>TestLogging</RootNamespace>
|
||||
<AssemblyName>TestLogging</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="TestLogging.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="TestLogging.ptfconfig" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\testtools.vsts\TestTools.VSTS.csproj">
|
||||
<Project>{3cb878cb-0cd3-447f-8dd8-8a0c62b7c3af}</Project>
|
||||
<Name>TestTools.VSTS</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\testtools\TestTools.csproj">
|
||||
<Project>{1ca2b935-3224-40f1-84bc-47fa1a9b242e}</Project>
|
||||
<Name>TestTools</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Utilities\Utilities.csproj">
|
||||
<Project>{cbe396d2-d8d0-43cd-bdb8-fd8ba46bb3fd}</Project>
|
||||
<Name>Utilities</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -1,82 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2012
|
||||
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A8E3F732-A7B1-4682-AFED-38FAEA818E12}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
Local.testsettings = Local.testsettings
|
||||
RunTest.cmd = RunTest.cmd
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestLogging", "TestLogging\TestLogging.csproj", "{07E873F6-A11C-473B-99E0-B5FA3F50B7C3}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestAdapter", "TestAdapter\TestAdapter.csproj", "{CAC893D4-D83A-4574-ABC8-BF7DF25AC71B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestChecker", "TestChecker\TestChecker.csproj", "{483F6AF6-773A-441E-B38C-E3E222692D1C}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestRequirementCapture", "TestRequirementCapture\TestRequirementCapture.csproj", "{5944E70C-7885-4E3C-B28E-E870A358E64E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestProperties", "TestProperties\TestProperties.csproj", "{3034A41C-79A3-4D18-8388-FD23F5594CAD}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "PTF", "PTF", "{288E5E04-8A41-4255-8C3D-FE3516C33DAE}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestTools", "..\testtools\TestTools.csproj", "{1CA2B935-3224-40F1-84BC-47FA1A9B242E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestTools.VSTS", "..\testtools.vsts\TestTools.VSTS.csproj", "{3CB878CB-0CD3-447F-8DD8-8A0C62B7C3AF}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utilities", "Utilities\Utilities.csproj", "{CBE396D2-D8D0-43CD-BDB8-FD8BA46BB3FD}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestTools.Extension", "..\testtools.extension\TestTools.Extension.csproj", "{E41414B3-95F3-430F-823B-55B82F0BA198}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{07E873F6-A11C-473B-99E0-B5FA3F50B7C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{07E873F6-A11C-473B-99E0-B5FA3F50B7C3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{07E873F6-A11C-473B-99E0-B5FA3F50B7C3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{07E873F6-A11C-473B-99E0-B5FA3F50B7C3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CAC893D4-D83A-4574-ABC8-BF7DF25AC71B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CAC893D4-D83A-4574-ABC8-BF7DF25AC71B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CAC893D4-D83A-4574-ABC8-BF7DF25AC71B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CAC893D4-D83A-4574-ABC8-BF7DF25AC71B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{483F6AF6-773A-441E-B38C-E3E222692D1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{483F6AF6-773A-441E-B38C-E3E222692D1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{483F6AF6-773A-441E-B38C-E3E222692D1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{483F6AF6-773A-441E-B38C-E3E222692D1C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5944E70C-7885-4E3C-B28E-E870A358E64E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{5944E70C-7885-4E3C-B28E-E870A358E64E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5944E70C-7885-4E3C-B28E-E870A358E64E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5944E70C-7885-4E3C-B28E-E870A358E64E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3034A41C-79A3-4D18-8388-FD23F5594CAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3034A41C-79A3-4D18-8388-FD23F5594CAD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3034A41C-79A3-4D18-8388-FD23F5594CAD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3034A41C-79A3-4D18-8388-FD23F5594CAD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1CA2B935-3224-40F1-84BC-47FA1A9B242E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1CA2B935-3224-40F1-84BC-47FA1A9B242E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1CA2B935-3224-40F1-84BC-47FA1A9B242E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1CA2B935-3224-40F1-84BC-47FA1A9B242E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{3CB878CB-0CD3-447F-8DD8-8A0C62B7C3AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3CB878CB-0CD3-447F-8DD8-8A0C62B7C3AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3CB878CB-0CD3-447F-8DD8-8A0C62B7C3AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3CB878CB-0CD3-447F-8DD8-8A0C62B7C3AF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{CBE396D2-D8D0-43CD-BDB8-FD8BA46BB3FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CBE396D2-D8D0-43CD-BDB8-FD8BA46BB3FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CBE396D2-D8D0-43CD-BDB8-FD8BA46BB3FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CBE396D2-D8D0-43CD-BDB8-FD8BA46BB3FD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E41414B3-95F3-430F-823B-55B82F0BA198}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E41414B3-95F3-430F-823B-55B82F0BA198}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E41414B3-95F3-430F-823B-55B82F0BA198}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E41414B3-95F3-430F-823B-55B82F0BA198}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{1CA2B935-3224-40F1-84BC-47FA1A9B242E} = {288E5E04-8A41-4255-8C3D-FE3516C33DAE}
|
||||
{3CB878CB-0CD3-447F-8DD8-8A0C62B7C3AF} = {288E5E04-8A41-4255-8C3D-FE3516C33DAE}
|
||||
{E41414B3-95F3-430F-823B-55B82F0BA198} = {288E5E04-8A41-4255-8C3D-FE3516C33DAE}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1,35 +0,0 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("TestProperties")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TestProperties")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("49766b6f-fd46-4a62-900b-823ef07e8220")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -1,61 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{3034A41C-79A3-4D18-8388-FD23F5594CAD}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Microsoft.Protocols.TestTools.Test.TestProperties</RootNamespace>
|
||||
<AssemblyName>TestProperties</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Base.ptfconfig" />
|
||||
<Content Include="TestProperties.ptfconfig" />
|
||||
<Content Include="TestProperties.deployment.ptfconfig" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\testtools.vsts\TestTools.VSTS.csproj">
|
||||
<Project>{3cb878cb-0cd3-447f-8dd8-8a0c62b7c3af}</Project>
|
||||
<Name>TestTools.VSTS</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\testtools\TestTools.csproj">
|
||||
<Project>{1ca2b935-3224-40f1-84bc-47fa1a9b242e}</Project>
|
||||
<Name>TestTools</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="TestProperties.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -1,35 +0,0 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("TestRequirementCapture")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("TestRequirementCapture")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2013")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("3e68134d-4eac-42c2-8ee1-6ca784ac09b6")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -1,63 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>
|
||||
</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{5944E70C-7885-4E3C-B28E-E870A358E64E}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Microsoft.Protocols.TestTools.Test.TestRequirementCapture</RootNamespace>
|
||||
<AssemblyName>TestRequirementCapture</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core">
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="TestRequirementCapture.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="TestRequirementCapture.ptfconfig" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\testtools.vsts\TestTools.VSTS.csproj">
|
||||
<Project>{3cb878cb-0cd3-447f-8dd8-8a0c62b7c3af}</Project>
|
||||
<Name>TestTools.VSTS</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\testtools\TestTools.csproj">
|
||||
<Project>{1ca2b935-3224-40f1-84bc-47fa1a9b242e}</Project>
|
||||
<Name>TestTools</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Utilities\Utilities.csproj">
|
||||
<Project>{cbe396d2-d8d0-43cd-bdb8-fd8ba46bb3fd}</Project>
|
||||
<Name>Utilities</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -1,36 +0,0 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Utilities")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Utilities")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2015")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("e07e68ac-5f71-4c39-be91-f7bb66d30568")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
|
@ -1,42 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{CBE396D2-D8D0-43CD-BDB8-FD8BA46BB3FD}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Microsoft.Protocols.TestTools.Test.Utilities</RootNamespace>
|
||||
<AssemblyName>Utilities</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="PTFExpectedException.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
|
@ -1,18 +0,0 @@
|
|||
:: Copyright (c) Microsoft. All rights reserved.
|
||||
:: Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
@echo off
|
||||
|
||||
set currentPath=%~dp0
|
||||
set PTF_Root=%currentPath%..\..\
|
||||
set PTFTEST_Root=%currentPath%..\
|
||||
call "%PTFTEST_Root%common\setBuildTool.cmd"
|
||||
if ErrorLevel 1 (
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
%buildtool% TestPTF.sln /t:clean;rebuild
|
||||
if ErrorLevel 1 (
|
||||
echo Error: Failed to build TestPTF
|
||||
exit /b 1
|
||||
)
|
|
@ -1,15 +0,0 @@
|
|||
:: Copyright (c) Microsoft. All rights reserved.
|
||||
:: Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
@echo off
|
||||
|
||||
set currentPath=%~dp0
|
||||
set PTFTEST_Root=%currentPath%..\..\
|
||||
|
||||
call "%PTFTEST_Root%src\common\setVsTestPath.cmd"
|
||||
if ErrorLevel 1 (
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
:: Does not run Interactive adapter cases in automation test
|
||||
%vstest% "TestProperties\bin\Debug\TestProperties.dll" "TestChecker\bin\Debug\TestChecker.dll" "TestLogging\bin\Debug\TestLogging.dll" "TestRequirementCapture\bin\Debug\TestRequirementCapture.dll" "TestAdapter\bin\Debug\TestAdapter.dll" /TestCaseFilter:"Name!=InteractiveAdapterAbort&Name!=InteractiveAdapterReturnInt&Name!=InteractiveAdapterReturnString" /Settings:Local.testsettings /Logger:trx
|
|
@ -1,62 +0,0 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace Microsoft.Protocols.TestTools
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents errors that occurs during running auto-capture.
|
||||
/// </summary>
|
||||
public class AutoCaptureException : Exception
|
||||
{
|
||||
/// <summary>
|
||||
/// Stops running test cases when auto-capture error occurs.
|
||||
/// </summary>
|
||||
public bool StopRunning = false;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of AutoCaptureException with error message specified.
|
||||
/// </summary>
|
||||
/// <param name="msg">Error message.</param>
|
||||
/// <param name="stopRunning">Stops running test cases when auto-capture error occurs.</param>
|
||||
public AutoCaptureException(string msg, bool stopRunning = false)
|
||||
: base(msg)
|
||||
{
|
||||
StopRunning = stopRunning;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// An interface for implementing automatic network message capture.
|
||||
/// </summary>
|
||||
public interface IAutoCapture
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes the AutoCapture class before test cases run.
|
||||
/// </summary>
|
||||
/// <param name="properties">Properties in PTF Configure file.</param>
|
||||
/// <param name="className">The test class name.</param>
|
||||
void Initialize(NameValueCollection properties, string className);
|
||||
|
||||
/// <summary>
|
||||
/// Cleans up the autocapture class after all the test cases in a class are finished.
|
||||
/// </summary>
|
||||
void Cleanup();
|
||||
|
||||
/// <summary>
|
||||
/// Starts a capture for a test case.
|
||||
/// </summary>
|
||||
/// <param name="testName">Test case name</param>
|
||||
void StartCapture(string testName);
|
||||
|
||||
/// <summary>
|
||||
/// Stops the capture for a test case.
|
||||
/// </summary>
|
||||
void StopCapture();
|
||||
}
|
||||
}
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче