Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .github/workflows/buildAndTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ jobs:
with:
dotnet-version: 2.2.108
- name: Run Unit Tests
run: dotnet test --verbosity normal
run: |
docker run -d -p 8080:8080 -p 1521:1521 --name OracleDB store/oracle/database-enterprise:12.2.0.1-slim
dotnet test --verbosity normal --configuration Release

automerge:
needs: [build,test]
Expand Down
8 changes: 7 additions & 1 deletion DatabaseConnector.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29806.167
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DatabaseConnector", "DatabaseConnector\DatabaseConnector.csproj", "{9969E41B-E62C-46F8-8476-5223A85D428E}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DatabaseConnector", "DatabaseConnector\DatabaseConnector.csproj", "{9969E41B-E62C-46F8-8476-5223A85D428E}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NUnitTestDatabaseConnector", "NUnitTestDatabaseConnector\NUnitTestDatabaseConnector.csproj", "{DF81C956-9069-4F70-960B-17EDBD7B59C1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand All @@ -15,6 +17,10 @@ Global
{9969E41B-E62C-46F8-8476-5223A85D428E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9969E41B-E62C-46F8-8476-5223A85D428E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{9969E41B-E62C-46F8-8476-5223A85D428E}.Release|Any CPU.Build.0 = Release|Any CPU
{DF81C956-9069-4F70-960B-17EDBD7B59C1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DF81C956-9069-4F70-960B-17EDBD7B59C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DF81C956-9069-4F70-960B-17EDBD7B59C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DF81C956-9069-4F70-960B-17EDBD7B59C1}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
273 changes: 273 additions & 0 deletions DatabaseConnector/log.txt

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions NUnitTestDatabaseConnector/NUnitTestDatabaseConnector.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\DatabaseConnector\DatabaseConnector.csproj" />
</ItemGroup>

</Project>
88 changes: 88 additions & 0 deletions NUnitTestDatabaseConnector/QueryTestCase.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
using NUnit.Framework;
using DatabaseConnector;
using System.Collections.Generic;

namespace NUnitTestDatabaseConnector
{
public class Tests
{
private DatabaseObject dbDriver;

[SetUp]
public void SetUp()
{
string host = "8080";
string port = "1521";
string serviceName = "OracleDB";
string userID = "ORCLPDB1";
string password = "auto generated";
dbDriver = new OracleDatabase(host, port, serviceName, userID, password);
}
/// <summary>
/// The QueryExistingTestCaseWithOneRow.
/// </summary>
[Test]
public void QueryExistingTestCaseWithOneRow()
{
string collection = "AutomationFramework";
string testcase = "AutomationDatabaseTestOneRow";
string release = "1";
string query = "SELECT T.TESTCASE, T.TESTSTEPDESCRIPTION, T.STEPNUM, T.ACTIONONOBJECT, T.OBJECT, T.VALUE, T.COMMENTS, T.RELEASE, T.LOCAL_ATTEMPTS, T.LOCAL_TIMEOUT, T.CONTROL, T.COLLECTION, T.TEST_STEP_TYPE_ID, T.GOTOSTEP FROM QA_AUTOMATION.TESTCASE T WHERE T.TESTCASE = '" + testcase + "' AND T.COLLECTION = '" + collection + "' AND T.RELEASE = '" + release + "' ORDER BY T.STEPNUM";
List<List<object>> table = dbDriver.ExecuteQuery(query);
List<object> row = table[0];
string dbtestcase = row[0]?.ToString() ?? string.Empty; // TESTCASE
string testStepDesc = row[1]?.ToString() ?? string.Empty; // TESTCASEDESCRIPTION
string action = row[3]?.ToString() ?? string.Empty; // ACTIONONOBJECT (test action)
string attribValue = row[4]?.ToString() ?? string.Empty; // OBJECT
string value = row[5]?.ToString() ?? string.Empty; // VALUE (of the control/field)
string attribute = row[6]?.ToString() ?? string.Empty; // COMMENTS (selected attribute)
string dbrelease = row[7]?.ToString() ?? string.Empty; // RELEASE
string stLocAttempts = row[8]?.ToString() ?? "0"; // LOCAL_ATTEMPTS
string stLocTimeout = row[9]?.ToString() ?? "0"; // LOCAL_TIMEOUT
string control = row[10]?.ToString() ?? string.Empty; // CONTROL
string dbcollection = row[11]?.ToString() ?? string.Empty; // COLLECTION
string testStepType = row[12]?.ToString() ?? "1"; // TESTSTEPTYPE (formerly SEVERITY)
string goToStep = row[13]?.ToString() ?? string.Empty; // GOTOSTEP

Assert.AreEqual("AutomationDatabaseTestOneRow", dbtestcase, "Checking the testcase");
Assert.AreEqual("AutomationDatabaseTestOneRow", testStepDesc, "Checking the test step description");
Assert.AreEqual("Comment", action, "Checking the action");
Assert.AreEqual("Test", value, "Checking the value");
Assert.AreEqual("Test", attribute, "Checking the comments");
Assert.AreEqual("1", dbrelease, "Checking the release");
Assert.AreEqual(string.Empty, stLocAttempts, "Checking the local attempts");
Assert.AreEqual(string.Empty, stLocTimeout, "Checking the lcoal timeout");
Assert.AreEqual(string.Empty, control, "checking the control");
Assert.AreEqual("AutomationFramework", dbcollection, "Checking the collection");
Assert.AreEqual(string.Empty, testStepType, "Checking the test step type.");
Assert.AreEqual(string.Empty, goToStep, "Checking the goTOStep.");
}

/// <summary>
/// The QueryExistingTestCaseWithMoreThanOneRow.
/// </summary>
[Test]
public void QueryExistingTestCaseWithMoreThanOneRow()
{
string collection = "AutomationFramework";
string testcase = "AutomationDatabaseTestMultiRow";
string release = "1";
string query = "SELECT T.TESTCASE, T.TESTSTEPDESCRIPTION, T.STEPNUM, T.ACTIONONOBJECT, T.OBJECT, T.VALUE, T.COMMENTS, T.RELEASE, T.LOCAL_ATTEMPTS, T.LOCAL_TIMEOUT, T.CONTROL, T.COLLECTION, T.TEST_STEP_TYPE_ID, T.GOTOSTEP FROM QA_AUTOMATION.TESTCASE T WHERE T.TESTCASE = '" + testcase + "' AND T.COLLECTION = '" + collection + "' AND T.RELEASE = '" + release + "' ORDER BY T.STEPNUM";
List<List<object>> table = dbDriver.ExecuteQuery(query);
Assert.AreEqual(2, table.Count, "Count of multiple rows");
}

/// <summary>
/// The QueryNonExistingTestCase.
/// </summary>
[Test]
public void QueryNonExistingTestCase()
{
string collection = "AutomationFramework";
string testcase = "AutomationDatabaseNonExistingTestCase";
string release = "1";
string query = "SELECT T.TESTCASE, T.TESTSTEPDESCRIPTION, T.STEPNUM, T.ACTIONONOBJECT, T.OBJECT, T.VALUE, T.COMMENTS, T.RELEASE, T.LOCAL_ATTEMPTS, T.LOCAL_TIMEOUT, T.CONTROL, T.COLLECTION, T.TEST_STEP_TYPE_ID, T.GOTOSTEP FROM QA_AUTOMATION.TESTCASE T WHERE T.TESTCASE = '" + testcase + "' AND T.COLLECTION = '" + collection + "' AND T.RELEASE = '" + release + "' ORDER BY T.STEPNUM";
dbDriver.ExecuteQuery(query);
}
}
}
2 changes: 1 addition & 1 deletion docs/api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h1 id="placeholder">PLACEHOLDER</h1>
<div class="contribution">
<ul class="nav">
<li>
<a href="https://github.com/zzzrst/DatabaseConnector/blob/master/DatabaseConnector/api/index.md/#L1" class="contribution-link">Improve this Doc</a>
<a href="https://github.com/zzzrst/DatabaseConnector/blob/NUnitTestBranch/DatabaseConnector/api/index.md/#L1" class="contribution-link">Improve this Doc</a>
</li>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/articles/intro.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ <h1 id="articles">Articles</h1>
<div class="contribution">
<ul class="nav">
<li>
<a href="https://github.com/zzzrst/DatabaseConnector/blob/master/DatabaseConnector/articles/intro.md/#L1" class="contribution-link">Improve this Doc</a>
<a href="https://github.com/zzzrst/DatabaseConnector/blob/NUnitTestBranch/DatabaseConnector/articles/intro.md/#L1" class="contribution-link">Improve this Doc</a>
</li>
</ul>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ <h1 id="database-connector">Database Connector</h1>
<div class="contribution">
<ul class="nav">
<li>
<a href="https://github.com/zzzrst/DatabaseConnector/blob/master/DatabaseConnector/index.md/#L1" class="contribution-link">Improve this Doc</a>
<a href="https://github.com/zzzrst/DatabaseConnector/blob/NUnitTestBranch/DatabaseConnector/index.md/#L1" class="contribution-link">Improve this Doc</a>
</li>
</ul>
</div>
Expand Down
8 changes: 4 additions & 4 deletions docs/manifest.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"homepages": [],
"source_base_path": "C:/GitHub/DatabaseConnector/DatabaseConnector",
"source_base_path": "C:/Users/DuongCh/Projects/DatabaseConnector/DatabaseConnector",
"xrefmap": "xrefmap.yml",
"files": [
{
Expand All @@ -9,7 +9,7 @@
"output": {
".html": {
"relative_path": "api/index.html",
"hash": "NonL3w8pGFX0vEad7qVgfQ=="
"hash": "+SnEMu8FfsQa78QAZupNBw=="
}
},
"is_incremental": false,
Expand All @@ -21,7 +21,7 @@
"output": {
".html": {
"relative_path": "articles/intro.html",
"hash": "9hwYqCrrp2pJCL0QIlmwyg=="
"hash": "6s1HofEhwS3rVajeeKD7xg=="
}
},
"is_incremental": false,
Expand All @@ -45,7 +45,7 @@
"output": {
".html": {
"relative_path": "index.html",
"hash": "apZ/f6mtq9zVdzICVfVBkg=="
"hash": "f3pG/7NdUYUi6RCodHDf/A=="
}
},
"is_incremental": false,
Expand Down