Skip to content

Commit eae6bee

Browse files
committed
Versioing
1 parent 8947770 commit eae6bee

File tree

7 files changed

+66
-30
lines changed

7 files changed

+66
-30
lines changed

AgileSQLClub.tSQLtTestController/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("1.0.0.0")]
36-
[assembly: AssemblyFileVersion("1.0.0.0")]
35+
[assembly: AssemblyVersion("0.0.70.0")]
36+
[assembly: AssemblyFileVersion("0.0.70.0")]

AgileSQLClub.tSQLtTestController/TestClass.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,6 @@ public tSQLtExtendedProperty(string schemaName)
187187
public class TestFinder
188188
{
189189
private readonly List<string> _filePaths;
190-
private readonly string _lookupPath;
191190
private readonly TSqlParser _parser;
192191

193192
public TestFinder(TSqlParser parser, List<string> filePaths)

XMLTestAdapterVSIX/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@
2929
// You can specify all the values or you can default the Build and Revision Numbers
3030
// by using the '*' as shown below:
3131
// [assembly: AssemblyVersion("1.0.*")]
32-
[assembly: AssemblyVersion("1.0.0.0")]
33-
[assembly: AssemblyFileVersion("1.0.0.0")]
32+
[assembly: AssemblyVersion("0.0.70.0")]
33+
[assembly: AssemblyFileVersion("0.0.70.0")]

XMLTestAdapterVSIX/source.extension.vsixmanifest

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
33
<Metadata>
4-
<Identity Id="AgileSQLClub.tSQLtTestAdapter" Version="0.63" Language="en-US" Publisher="EdElliott" />
4+
<Identity Id="AgileSQLClub.tSQLtTestAdapter" Version="0.70" Language="en-US" Publisher="EdElliott" />
55
<DisplayName>tSQLt Test Adapter</DisplayName>
66
<Description xml:space="preserve">Unit Test Adapter for tSQLt Tests</Description>
7-
<MoreInfo>https://the.agilsql.club/projects/tSQLt-Test-Adapter</MoreInfo>
7+
<MoreInfo>https://the.agilesql.club/projects/tSQLt-Test-Adapter</MoreInfo>
88
<License>LICENSE</License>
99
<Tags>tSQLt, Test, Adapter</Tags>
1010
</Metadata>
11-
<Installation>
11+
<Installation InstalledByMsi="true">
1212
<InstallationTarget Id="Microsoft.VisualStudio.Pro" Version="[14.0,15.0)" />
1313
<InstallationTarget Version="[14.0,15.0)" Id="Microsoft.VisualStudio.Ultimate" />
1414
<InstallationTarget Version="[14.0,15.0)" Id="Microsoft.VisualStudio.Premium" />

XmlTestAdapter/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@
3232
// You can specify all the values or you can default the Build and Revision Numbers
3333
// by using the '*' as shown below:
3434
// [assembly: AssemblyVersion("1.0.*")]
35-
[assembly: AssemblyVersion("0.0.0.2")]
36-
[assembly: AssemblyFileVersion("0.0.0.2")]
35+
[assembly: AssemblyVersion("0.0.0.70")]
36+
[assembly: AssemblyFileVersion("0.0.0.70")]

XmlTestAdapter/tSQLtTestDiscoverer.cs

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,23 @@ namespace tSQLtTestAdapter
1111
{
1212
[DefaultExecutorUri(Constants.ExecutorUriString)]
1313
[FileExtension(Constants.FileExtension)]
14-
public class XmlTestDiscoverer : ITestDiscoverer
14+
public class tSQLtTestDiscoverer : ITestDiscoverer
1515
{
1616
private static readonly object _lock = new object();
1717
private static readonly TestCache _tests = new TestCache();
1818

1919
private static readonly List<Regex> _includePaths = new List<Regex>();
20+
private IMessageLogger _logger;
21+
private bool _debug;
2022

2123
public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discoveryContext, IMessageLogger logger, ITestCaseDiscoverySink discoverySink)
2224
{
23-
if (string.IsNullOrEmpty(new RunSettings(discoveryContext.RunSettings).GetSetting("TestDatabaseConnectionString")))
25+
var settings = new RunSettings(discoveryContext.RunSettings);
26+
_logger = logger;
27+
28+
_debug = settings.GetSetting("tSQLt-TestAdapter-Debug")?.ToLowerInvariant() == "true";
29+
30+
if (string.IsNullOrEmpty(settings.GetSetting("TestDatabaseConnectionString")))
2431
{
2532
logger.SendMessage(TestMessageLevel.Informational, "No RunSettings TestDatabaseConnectionString set - will not attempt to discover tests..");
2633
return;
@@ -29,11 +36,10 @@ public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discove
2936
logger.SendMessage(TestMessageLevel.Informational, "tSQLt Test Adapter, searching for tests...");
3037

3138
var includePath = new RunSettings(discoveryContext.RunSettings).GetSetting("IncludePath");
32-
SetPathFilter(includePath);
33-
39+
3440
lock (_lock)
3541
{
36-
GetTests(sources, discoverySink);
42+
GetTests(sources, discoverySink, includePath);
3743
}
3844

3945
if (_tests != null)
@@ -42,7 +48,7 @@ public void DiscoverTests(IEnumerable<string> sources, IDiscoveryContext discove
4248
logger.SendMessage(TestMessageLevel.Informational, "tSQLt Test Adapter, searching for tests...done - none found");
4349
}
4450

45-
public static void SetPathFilter(string includePath)
51+
public void SetPathFilter(string includePath)
4652
{
4753
_includePaths.Clear();
4854

@@ -52,20 +58,32 @@ public static void SetPathFilter(string includePath)
5258
{
5359
foreach (var part in includePath.Split(';'))
5460
{
61+
Debug($"tSQLt-Test-Adapter: Adding filter: {part}");
5562
_includePaths.Add(new Regex(part));
5663
}
5764
}
5865
else
5966
{
67+
Debug($"tSQLt-Test-Adapter: Adding filter: {includePath}");
6068
_includePaths.Add(new Regex(includePath));
6169
}
6270
}
6371
}
6472

65-
public static List<TestCase> GetTests(IEnumerable<string> sources, ITestCaseDiscoverySink discoverySink)
73+
private void Debug(string message)
74+
{
75+
if (_debug)
76+
_logger.SendMessage(TestMessageLevel.Informational, message);
77+
}
78+
79+
80+
public List<TestCase> GetTests(IEnumerable<string> sources, ITestCaseDiscoverySink discoverySink, string filter)
6681
{
6782
lock (_lock)
6883
{
84+
if(!String.IsNullOrEmpty(filter))
85+
SetPathFilter(filter);
86+
6987
var tests = new List<TestCase>();
7088

7189
foreach (var source in sources)
@@ -81,15 +99,15 @@ public static List<TestCase> GetTests(IEnumerable<string> sources, ITestCaseDisc
8199
foreach (var test in testClass.Tests)
82100
{
83101
var testCase = new TestCase(string.Format("{0}.{1}", testClass.Name, test.Name), tSQLtTestExecutor.ExecutorUri, test.Path);
84-
85-
102+
86103
testCase.LineNumber = test.Line;
87104
testCase.CodeFilePath = test.Path;
88105

89106
tests.Add(testCase);
90-
107+
Debug($"tSQLt-Test-Adapter Adding test case {testClass.Name}.{test.Name}");
91108
if (discoverySink != null)
92109
{
110+
Debug($"tSQLt-Test-Adapter Adding test case {testClass.Name}.{test.Name} - SENDING TO discoverSink");
93111
discoverySink.SendTestCase(testCase);
94112
}
95113
}
@@ -101,7 +119,7 @@ public static List<TestCase> GetTests(IEnumerable<string> sources, ITestCaseDisc
101119
tcClass.CodeFilePath = testClass.Path;
102120

103121
tests.Add(tcClass);
104-
122+
Debug($"tSQLt-Test-Adapter Adding test case {testClass.Name} - SENDING test class wrapper");
105123
discoverySink.SendTestCase(tcClass);
106124
}
107125
}

XmlTestAdapter/tSQLtTestExecutor.cs

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,22 @@ public class tSQLtTestExecutor : ITestExecutor
1616
{
1717
public void RunTests(IEnumerable<string> sources, IRunContext runContext, IFrameworkHandle frameworkHandle)
1818
{
19-
XmlTestDiscoverer.SetPathFilter(new RunSettings(runContext.RunSettings).GetSetting("IncludePath"));
20-
IEnumerable<TestCase> tests = XmlTestDiscoverer.GetTests(sources, null);
19+
var discoverer = new tSQLtTestDiscoverer();
20+
IEnumerable<TestCase> tests = discoverer.GetTests(sources, null, new RunSettings(runContext.RunSettings).GetSetting("IncludePath"));
2121
RunTests(tests, runContext, frameworkHandle);
2222
}
2323

2424
public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrameworkHandle frameworkHandle)
2525
{
26-
m_cancelled = false;
27-
28-
var connectionString =new RunSettings(runContext.RunSettings).GetSetting("TestDatabaseConnectionString");
26+
27+
28+
_cancelled = false;
29+
var settings = new RunSettings(runContext.RunSettings);
30+
31+
var connectionString = settings.GetSetting("TestDatabaseConnectionString");
32+
var debug = settings.GetSetting("tSQLt-TestAdapter-Debug")?.ToLowerInvariant() == "true";
33+
34+
2935
if (String.IsNullOrEmpty(connectionString))
3036
{
3137
frameworkHandle.SendMessage(TestMessageLevel.Error, @"No connection string found. You need to specify a run setting with the name ""TestDatabaseConnectionString"". Create a .runsettings file a sample is:
@@ -49,26 +55,39 @@ public void RunTests(IEnumerable<TestCase> tests, IRunContext runContext, IFrame
4955

5056
foreach (TestCase test in tests)
5157
{
52-
if (m_cancelled)
58+
if (_cancelled)
5359
break;
5460

5561
var testResult = new TestResult(test);
5662
var testSession = new tSQLtTestRunner(connectionString);
63+
64+
Debug(debug, frameworkHandle, $"running test {test.DisplayName}");
65+
5766
var result = Run(testSession, test);
5867

68+
Debug(debug, frameworkHandle, $"running test {test.DisplayName}...done");
69+
5970
if (null == result)
6071
{
6172
continue;
6273
}
6374

6475
testResult.Outcome = result.Passed() ? TestOutcome.Passed : TestOutcome.Failed;
6576
testResult.ErrorMessage += result.FailureMessages();
66-
77+
78+
Debug(debug, frameworkHandle, $"test passed: {result.Passed()} failureMessages: {result.FailureMessages()}, ErrorMessage: {testResult.ErrorMessage}");
79+
6780
frameworkHandle.RecordResult(testResult);
6881
}
6982

7083
}
7184

85+
private static void Debug(bool debug, IFrameworkHandle frameworkHandle, string message)
86+
{
87+
if(debug)
88+
frameworkHandle.SendMessage(TestMessageLevel.Informational, message);
89+
}
90+
7291
private static TestSuites Run(tSQLtTestRunner testSession, TestCase test)
7392
{
7493
if(test.DisplayName.Contains("."))
@@ -79,11 +98,11 @@ private static TestSuites Run(tSQLtTestRunner testSession, TestCase test)
7998

8099
public void Cancel()
81100
{
82-
m_cancelled = true;
101+
_cancelled = true;
83102
}
84103

85104
public static readonly Uri ExecutorUri = new Uri(Constants.ExecutorUriString);
86-
private bool m_cancelled;
105+
private bool _cancelled;
87106
}
88107

89108
public static class Constants

0 commit comments

Comments
 (0)