Skip to content

Commit 3d25f09

Browse files
authored
Bug fix, when Variable and Script parameters were not assigned correctly
* Bug fix, when Variable and Script parameters were not assigned correctly to the DatabaseTestResults, Renaming of the DatabaseScript to DatabaseTest * tests updates with ci pipeline fix
1 parent 54eab50 commit 3d25f09

17 files changed

+209
-113
lines changed

.github/workflows/dotnet-core.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
os: [ ubuntu-latest, windows-latest, macos-latest ]
15+
os: [ ubuntu-latest, windows-latest ]
1616

1717
steps:
1818
- uses: actions/checkout@v2

Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<Project>
22
<PropertyGroup>
3-
<Version>0.2.5</Version>
3+
<Version>0.2.6</Version>
44
</PropertyGroup>
55
</Project>

README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ var generator = new SqlServerTestGenerator(options =>
4343
});
4444
});
4545

46-
List<DatabaseScript> scripts = await generator.Generate();
46+
List<DatabaseTest> scripts = await generator.Generate();
4747
```
48-
The code above will generate a SQLServer `DatabaseScript` list, which will be used by runner to run the tests against database.
48+
The code above will generate a SQLServer `DatabaseTest` list, which will be used by runner to run the tests against database.
4949

5050
Above example adds all three test types to the generator:
5151
- `AddDatabaseObjectExitsRule`: will check if a table `mytable` exists in the database.
@@ -62,7 +62,7 @@ var runner = new SqlServerTestRunner(scripts, options =>
6262
options.AddSQLServerConnection("server=localhost;user=user;password=mypassword;Initial Catalog=myDatabase");
6363
});
6464

65-
List<DatabaseScriptResult> results = await runner.Run();
65+
List<DatabaseTestResult> results = await runner.Run();
6666
```
6767

6868
Alternatively if you want to use `MySQL` or `PostgreSQL` runners, you can use MySqlTestRunner` or `PostgresqlTestRunner` respectively.
@@ -71,7 +71,6 @@ Please note that **your user must have correct database permissions**. I suggest
7171

7272
## To-Do
7373

74-
- Implement asserters for processing the `DatabaseScriptResult` list.
7574
- Add more test types if necessary.
7675

7776
## License

src/QAToolKit.Engine.Database.Test/MySqlTestGeneratorTests.cs renamed to src/QAToolKit.Engine.Database.Test/Generators/MySqlTestGeneratorTests.cs

+20-20
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Threading.Tasks;
66
using Xunit;
77

8-
namespace QAToolKit.Engine.Database.Test
8+
namespace QAToolKit.Engine.Database.Test.Generators
99
{
1010
public class MySqlTestGeneratorTests
1111
{
@@ -17,9 +17,9 @@ public async Task MySqlTableExistScriptTest_Success()
1717
options.AddDatabaseObjectExitsRule(new string[] { "mytable" }, DatabaseObjectType.Table);
1818
});
1919

20-
var results = new List<DatabaseScript>
20+
var results = new List<DatabaseTest>
2121
{
22-
new DatabaseScript(
22+
new DatabaseTest(
2323
"mytable",
2424
$@"SELECT EXISTS(SELECT * FROM `information_schema`.`tables` WHERE `table_name` = 'mytable');",
2525
DatabaseTestType.ObjectExist,
@@ -38,9 +38,9 @@ public async Task MySqlViewExistScriptTest_Success()
3838
options.AddDatabaseObjectExitsRule(new string[] { "myview" }, DatabaseObjectType.View);
3939
});
4040

41-
var results = new List<DatabaseScript>
41+
var results = new List<DatabaseTest>
4242
{
43-
new DatabaseScript(
43+
new DatabaseTest(
4444
"myview",
4545
$@"SELECT EXISTS(SELECT * FROM `information_schema`.`views` WHERE `table_name` = 'myview');",
4646
DatabaseTestType.ObjectExist,
@@ -59,9 +59,9 @@ public async Task MySqlStoredProcedureExistScriptTest_Success()
5959
options.AddDatabaseObjectExitsRule(new string[] { "mystoredprocedure" }, DatabaseObjectType.StoredProcedure);
6060
});
6161

62-
var results = new List<DatabaseScript>
62+
var results = new List<DatabaseTest>
6363
{
64-
new DatabaseScript(
64+
new DatabaseTest(
6565
"mystoredprocedure",
6666
$@"SELECT EXISTS(SELECT * FROM `information_schema`.`routines` WHERE `routine_name` = 'mystoredprocedure');",
6767
DatabaseTestType.ObjectExist,
@@ -80,14 +80,14 @@ public async Task MySqlMultipleTableExistScriptTest_Success()
8080
options.AddDatabaseObjectExitsRule(new string[] { "table1", "table2" }, DatabaseObjectType.Table);
8181
});
8282

83-
var results = new List<DatabaseScript>
83+
var results = new List<DatabaseTest>
8484
{
85-
new DatabaseScript(
85+
new DatabaseTest(
8686
"table1",
8787
$@"SELECT EXISTS(SELECT * FROM `information_schema`.`tables` WHERE `table_name` = 'table1');",
8888
DatabaseTestType.ObjectExist,
8989
DatabaseKind.MySQL),
90-
new DatabaseScript(
90+
new DatabaseTest(
9191
"table2",
9292
$@"SELECT EXISTS(SELECT * FROM `information_schema`.`tables` WHERE `table_name` = 'table2');",
9393
DatabaseTestType.ObjectExist,
@@ -106,14 +106,14 @@ public async Task MySqlMultipleViewExistScriptTest_Success()
106106
options.AddDatabaseObjectExitsRule(new string[] { "view1", "view2" }, DatabaseObjectType.View);
107107
});
108108

109-
var results = new List<DatabaseScript>
109+
var results = new List<DatabaseTest>
110110
{
111-
new DatabaseScript(
111+
new DatabaseTest(
112112
"view1",
113113
$@"SELECT EXISTS(SELECT * FROM `information_schema`.`views` WHERE `table_name` = 'view1');",
114114
DatabaseTestType.ObjectExist,
115115
DatabaseKind.MySQL),
116-
new DatabaseScript(
116+
new DatabaseTest(
117117
"view2",
118118
$@"SELECT EXISTS(SELECT * FROM `information_schema`.`views` WHERE `table_name` = 'view2');",
119119
DatabaseTestType.ObjectExist,
@@ -132,14 +132,14 @@ public async Task MySqlMultipleStoredProcedureExistScriptTest_Success()
132132
options.AddDatabaseObjectExitsRule(new string[] { "sp1", "sp2" }, DatabaseObjectType.StoredProcedure);
133133
});
134134

135-
var results = new List<DatabaseScript>
135+
var results = new List<DatabaseTest>
136136
{
137-
new DatabaseScript(
137+
new DatabaseTest(
138138
"sp1",
139139
$@"SELECT EXISTS(SELECT * FROM `information_schema`.`routines` WHERE `routine_name` = 'sp1');",
140140
DatabaseTestType.ObjectExist,
141141
DatabaseKind.MySQL),
142-
new DatabaseScript(
142+
new DatabaseTest(
143143
"sp2",
144144
$@"SELECT EXISTS(SELECT * FROM `information_schema`.`routines` WHERE `routine_name` = 'sp2');",
145145
DatabaseTestType.ObjectExist,
@@ -179,9 +179,9 @@ public async Task MySqlRecordExistScriptTest_Success()
179179
});
180180
});
181181

182-
var results = new List<DatabaseScript>
182+
var results = new List<DatabaseTest>
183183
{
184-
new DatabaseScript(
184+
new DatabaseTest(
185185
"mytable",
186186
$@"SELECT EXISTS(SELECT * FROM `mytable` WHERE `name` = 'myname');",
187187
DatabaseTestType.RecordExist,
@@ -209,9 +209,9 @@ public async Task MySqlRecordCountScriptTest_Success()
209209
});
210210
});
211211

212-
var results = new List<DatabaseScript>
212+
var results = new List<DatabaseTest>
213213
{
214-
new DatabaseScript(
214+
new DatabaseTest(
215215
"mytable",
216216
$@"SELECT EXISTS (SELECT * FROM `mytable` WHERE (SELECT COUNT(*) AS `count` FROM `mytable`) = 100);",
217217
DatabaseTestType.RecordCount,

src/QAToolKit.Engine.Database.Test/PostgresqlTestGeneratorTests.cs renamed to src/QAToolKit.Engine.Database.Test/Generators/PostgresqlTestGeneratorTests.cs

+20-20
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using System.Threading.Tasks;
66
using Xunit;
77

8-
namespace QAToolKit.Engine.Database.Test
8+
namespace QAToolKit.Engine.Database.Test.Generators
99
{
1010
public class PostgresqlTestGeneratorTests
1111
{
@@ -17,9 +17,9 @@ public async Task PostgresqlTableExistScriptTest_Success()
1717
options.AddDatabaseObjectExitsRule(new string[] { "mytable" }, DatabaseObjectType.Table);
1818
});
1919

20-
var results = new List<DatabaseScript>
20+
var results = new List<DatabaseTest>
2121
{
22-
new DatabaseScript(
22+
new DatabaseTest(
2323
"mytable",
2424
$@"SELECT EXISTS(SELECT * FROM ""information_schema"".""tables"" WHERE ""table_name"" = 'mytable');",
2525
DatabaseTestType.ObjectExist,
@@ -38,9 +38,9 @@ public async Task PostgresqlViewExistScriptTest_Success()
3838
options.AddDatabaseObjectExitsRule(new string[] { "myview" }, DatabaseObjectType.View);
3939
});
4040

41-
var results = new List<DatabaseScript>
41+
var results = new List<DatabaseTest>
4242
{
43-
new DatabaseScript(
43+
new DatabaseTest(
4444
"myview",
4545
$@"SELECT EXISTS(SELECT * FROM ""information_schema"".""views"" WHERE ""table_name"" = 'myview');",
4646
DatabaseTestType.ObjectExist,
@@ -59,9 +59,9 @@ public async Task PostgresqlStoredProcedureExistScriptTest_Success()
5959
options.AddDatabaseObjectExitsRule(new string[] { "mystoredprocedure" }, DatabaseObjectType.StoredProcedure);
6060
});
6161

62-
var results = new List<DatabaseScript>
62+
var results = new List<DatabaseTest>
6363
{
64-
new DatabaseScript(
64+
new DatabaseTest(
6565
"mystoredprocedure",
6666
$@"SELECT EXISTS(SELECT * FROM ""information_schema"".""routines"" WHERE ""routine_name"" = 'mystoredprocedure');",
6767
DatabaseTestType.ObjectExist,
@@ -80,14 +80,14 @@ public async Task PostgresqlMultipleTableExistScriptTest_Success()
8080
options.AddDatabaseObjectExitsRule(new string[] { "table1", "table2" }, DatabaseObjectType.Table);
8181
});
8282

83-
var results = new List<DatabaseScript>
83+
var results = new List<DatabaseTest>
8484
{
85-
new DatabaseScript(
85+
new DatabaseTest(
8686
"table1",
8787
$@"SELECT EXISTS(SELECT * FROM ""information_schema"".""tables"" WHERE ""table_name"" = 'table1');",
8888
DatabaseTestType.ObjectExist,
8989
DatabaseKind.PostgreSQL),
90-
new DatabaseScript(
90+
new DatabaseTest(
9191
"table2",
9292
$@"SELECT EXISTS(SELECT * FROM ""information_schema"".""tables"" WHERE ""table_name"" = 'table2');",
9393
DatabaseTestType.ObjectExist,
@@ -106,14 +106,14 @@ public async Task PostgresqlMultipleViewExistScriptTest_Success()
106106
options.AddDatabaseObjectExitsRule(new string[] { "view1", "view2" }, DatabaseObjectType.View);
107107
});
108108

109-
var results = new List<DatabaseScript>
109+
var results = new List<DatabaseTest>
110110
{
111-
new DatabaseScript(
111+
new DatabaseTest(
112112
"view1",
113113
$@"SELECT EXISTS(SELECT * FROM ""information_schema"".""views"" WHERE ""table_name"" = 'view1');",
114114
DatabaseTestType.ObjectExist,
115115
DatabaseKind.PostgreSQL),
116-
new DatabaseScript(
116+
new DatabaseTest(
117117
"view2",
118118
$@"SELECT EXISTS(SELECT * FROM ""information_schema"".""views"" WHERE ""table_name"" = 'view2');",
119119
DatabaseTestType.ObjectExist,
@@ -132,14 +132,14 @@ public async Task PostgresqlMultipleStoredProcedureExistScriptTest_Success()
132132
options.AddDatabaseObjectExitsRule(new string[] { "sp1", "sp2" }, DatabaseObjectType.StoredProcedure);
133133
});
134134

135-
var results = new List<DatabaseScript>
135+
var results = new List<DatabaseTest>
136136
{
137-
new DatabaseScript(
137+
new DatabaseTest(
138138
"sp1",
139139
$@"SELECT EXISTS(SELECT * FROM ""information_schema"".""routines"" WHERE ""routine_name"" = 'sp1');",
140140
DatabaseTestType.ObjectExist,
141141
DatabaseKind.PostgreSQL),
142-
new DatabaseScript(
142+
new DatabaseTest(
143143
"sp2",
144144
$@"SELECT EXISTS(SELECT * FROM ""information_schema"".""routines"" WHERE ""routine_name"" = 'sp2');",
145145
DatabaseTestType.ObjectExist,
@@ -179,9 +179,9 @@ public async Task PostgresqlRecordExistScriptTest_Success()
179179
});
180180
});
181181

182-
var results = new List<DatabaseScript>
182+
var results = new List<DatabaseTest>
183183
{
184-
new DatabaseScript(
184+
new DatabaseTest(
185185
"mytable",
186186
$@"SELECT EXISTS(SELECT * FROM ""mytable"" WHERE ""name"" = 'myname');",
187187
DatabaseTestType.RecordExist,
@@ -209,9 +209,9 @@ public async Task PostgresqlRecordCountScriptTest_Success()
209209
});
210210
});
211211

212-
var results = new List<DatabaseScript>
212+
var results = new List<DatabaseTest>
213213
{
214-
new DatabaseScript(
214+
new DatabaseTest(
215215
"mytable",
216216
$@"SELECT EXISTS (SELECT * FROM ""mytable"" WHERE (SELECT COUNT(*) AS ""count"" FROM ""mytable"") = 100);",
217217
DatabaseTestType.RecordCount,

0 commit comments

Comments
 (0)