You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: samples/containers/unit-testing/tsqlt-docker/README.md
+22-6Lines changed: 22 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,15 +55,24 @@ The trigger we have wrote is to prevent the insertion of new products with value
55
55
56
56
<!-- Step by step instructions -->
57
57
58
-
The implementation of the trigger and related unit tests has been done.
58
+
1. If you don't already have one, [sign up for a new GitHub account](https://docs.github.com/get-started/signing-up-for-github/signing-up-for-a-new-github-account)
59
+
2. Create your sample repository on GitHub, if you've never done it, you can find the guide [here](https://docs.github.com/get-started/quickstart/create-a-repo)
60
+
3. Create a `.github/workflows` directory in your GitHub repository if this directory does not already exist
61
+
4. Copy the `automated-tests.yml` inside the directory `.github/workflows` you created in the previous step. The `automated-tests.yml` describes the process that will execute one or more jobs
62
+
5. Create the `source` and `unit-test` directories in the root of your sample repository
63
+
6. Copy all the files located in the source and unit-test directories to their respective directories in your repository
64
+
7. View and run the workflow as described [here](https://docs.github.com/actions/quickstart)
65
+
8. Have fun with the solution details outlined below
66
+
67
+
**The challenge**
68
+
69
+
The implementation of the trigger and related unit tests has been done, all files are ready in your repository!
59
70
60
71
The challenge is to automate the execution of the tests at each commit on the main branch of the repository. GitHub Actions is our CI/CD platform, it supports the use of Docker containers and it is intimately integrated into GitHub, the source control that manages our source code.
61
72
62
73
**Create your first workflow**
63
74
64
-
Let's go ahead with the creation of a workflow: an automated and configurable process that will execute one or more jobs.
65
-
66
-
Workflows are defined with a YAML file stored in the same repository which holds the source code. The workflows will be triggered when an event occurs in the repository. Anyway, a workflow can also be activated manually or according to a defined schedule. Follow [these instructions](https://docs.github.com/en/actions/quickstart) to create your first workflow.
75
+
Workflows are defined with a YAML file stored in the same repository which holds the source code. The workflows will be triggered when an event occurs in the repository. Anyway, a workflow can also be activated manually or according to a defined schedule.
67
76
68
77
A sample YAML file that implements the test automation workflow is available here, the fundamental steps are:
69
78
@@ -208,16 +217,23 @@ The YAML script for our workflow is complete, you can find it here.
208
217
209
218
## Sample details
210
219
211
-
Describe sample details
220
+
Unit tests developed for a SQL Server solution are not just meant to verify that requirements have been met once, prior to release; the real game changer is represented by the possibility of repeating the checks during the development of new code and during the bug fixing process.
221
+
222
+
The repeatability of the tests provides the ability to automate them, an essential condition for integrating automatic tests within a Continuous Integration platform. In this article we described how to automate the testing of SQL Server objects using tSQLt, Docker and GitHub Actions!
212
223
213
224
<aname=disclaimers></a>
214
225
215
226
## Disclaimers
216
-
The code included in this sample is not intended to be ...
227
+
228
+
The code included in this sample is not intended to be a set of best practices on how to build scalable enterprise grade unit testing or CI/CD system. This is beyond the scope of this quick start sample.
217
229
218
230
<aname=related-links></a>
219
231
220
232
## Related Links
221
233
<!-- Links to more articles. Remember to delete "en-us" from the link path. -->
222
234
223
235
For more information, see these articles:
236
+
237
+
-[Unit testing: What it is and why it is important for T-SQL code!](https://medium.com/@segovoni/unit-testing-what-it-is-and-why-it-is-important-for-t-sql-code-7e9df7ca8bfe)
238
+
-[Unit testing: The tSQLt framework and the execution of a test!](https://segovoni.medium.com/unit-testing-the-tsqlt-framework-and-the-execution-of-a-test-e4d135c3e343)
239
+
-[Unit testing: How to write your first unit test for T-SQL code](https://segovoni.medium.com/unit-testing-how-to-write-your-first-unit-test-for-t-sql-code-3bc1533acbbc)
0 commit comments