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: docs/userguide/best-practices.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,4 @@
1
-
#Best Practices
1
+
#Best Practices
2
2
3
3
The following are best practices we as utPLSQL have learned about PL/SQL and Unit Testing.
4
4
@@ -22,4 +22,3 @@ The following are best practices we as utPLSQL have learned about PL/SQL and Uni
22
22
23
23
Use a version control system for your code. Don't just trust the database for code storage. This includes both the code you have under test, and the unit tests you develop as well.
Copy file name to clipboardExpand all lines: docs/userguide/coverage.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ Following code coverage reporters are supplied with utPLSQL:
16
16
*`ut_coveralls_reporter` - generates a JSON coverage report providing detailed information on code coverage with line numbers. This coverage report is designed to be consumed by cloud services like [coveralls](https://coveralls.io)
17
17
*`ut_coverage_sonar_reporter` - generates a JSON coverage report providing detailed information on code coverage with line numbers. This coverage report is designed to be consumed by local services like [sonarqube](https://about.sonarqube.com/)
18
18
19
-
##Security model
19
+
##Security model
20
20
Code coverage is using DBMS_PROFILER to gather information about execution of code under test and therefore follows the [DBMS_PROFILER's Security Model](https://docs.oracle.com/database/121/ARPLS/d_profil.htm#ARPLS67465)
21
21
In order to be able to gather coverage information, user executing unit tests needs to be either:
22
22
* Owner of the code that is tested
@@ -28,7 +28,7 @@ If you have `execute` privilege on the code that are tested, but do not have `cr
28
28
If you have `execute` privilege only on the unit tests, but do not have `execute` privilege on the code that is tested, the code will not be reported by coverage - as if it did not exist in the database.
29
29
If the code that is testes is complied as NATIVE, the code coverage will not be reported as well.
30
30
31
-
##Running unite tests with coverage
31
+
##Running unite tests with coverage
32
32
Using code coverage functionality is as easy as using any other [reporter](reporters.md) for utPLSQL project. All you need to do is run your tests from your preferred SQL tool and save the outcomes of reporter to a file.
33
33
All you need to do, is pass the constructor of the reporter to your `ut.run`
34
34
@@ -51,13 +51,13 @@ The report allow to navigate to every source and inspect line by line coverage.
By default the database schema/schemes containing the tests that were executed during the run, are fully reported by coverage reporter.
56
56
All valid unit tests are excluded from the report regardless if they were invoked or not. This way the coverage report is not affected by presence of tests and contains only the tested code.
57
57
58
58
The default behavior of coverage reporters can be altered, depending on your needs.
59
59
60
-
###Including/excluding objects in coverage reports
60
+
###Including/excluding objects in coverage reports
61
61
The most basic options are the include/exclude objects lists.
62
62
You may specify both include and exclude objects lists to specify which objects are to be included in the report and which are to be excluded.
63
63
Both of those options are meant to be used to narrow down the scope of unit test runs, that is broad by default.
@@ -76,7 +76,7 @@ Executes test `test_award_bonus` and gather on all objects in schema `ut3_user`
76
76
77
77
You can also combine the parameters and both will be applied.
78
78
79
-
###Defining different schema name(s)
79
+
###Defining different schema names
80
80
In some architectures, you might end up in a situation, where your unit tests exist in a different schema than the tested code.
81
81
This is not the default or recommended approach but is supporter by utPLSQL.
82
82
In such scenarios, you would probably have a separate database schema to hold unit tests and a separate schema/schemes to hold the tested code.
@@ -108,7 +108,7 @@ end;
108
108
```
109
109
Executes test `test_award_bonus` in schema `ut3_user` and gather coverage for that execution on `award_bonus` object from schema `usr`. The exclude list is of no relevance as it is not overlapping with include list.
110
110
111
-
###Working with projects and project files
111
+
###Working with projects and project files
112
112
Both `sonar` and `coveralls` are utilities that are more project-oriented than database-centric. They report statistics and coverage for project files in version control system.
113
113
Nowadays, most of database projects are moving away from database-centric approach towards project/product-centric approach.
114
114
Coverage reporting of utPLSQL allows you to perform code coverage analysis for your project files.
Copy file name to clipboardExpand all lines: docs/userguide/reporters.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
utPLSQL provides the following reporting formats.
2
2
3
-
#Documentation reporter
3
+
#Documentation reporter
4
4
5
5
The `ut_documentation_reporter` is the default reporting format used by the framework.
6
6
It provides a human readable test results.
@@ -34,7 +34,7 @@ The documentation report provides the following information.
34
34
- Summary with total number of tests, number of tests with status and timing for the execution
35
35
36
36
37
-
##Color output from documentation reporter
37
+
##Color output from documentation reporter
38
38
39
39
When invoking tests with documentation reporter and your command line supports ANSICONSOLE (default on Unix), you can obtain the coloured outputs from the documentation reporter.
40
40
@@ -49,7 +49,7 @@ Example outputs from documentation reporter.
Most of continuous integration servers (like Jenkins) are capable of consuming unit test execution results in [XUnit/JUnit](https://en.wikipedia.org/wiki/XUnit) format.
55
55
The `ut_xunit_reporter` is producing outcomes as XUnit-compatible XML unit test report, that can be used by CI servers to display their custom reports and provide metrics (like tests execution trends).
@@ -69,7 +69,7 @@ Example of failure report details
[Teamcity](https://www.jetbrains.com/teamcity/) is a CI server by Jetbrains. It supports XUnit reporting and additionally has it's own format of reporting that allows tracking of progress of a CI step/task as it executes.
75
75
The TeamCity format developed by Jetbrains is supported by utPLSQL with `ut_teamcity_reporter`.
For detailed instructions on other install options see the [Install Guide](docs/userguide/install.md)
121
121
122
-
# Example test package
122
+
# Example unit test packages
123
123
124
-
The below test package is a fully-functional Unit Test package for testing a function `betwnstr`.
125
-
Package specification is annotated with special comments ([annotations](docs/userguide/annotations.md)).
124
+
The below test package is a fully-functional Unit Test package for testing a [`betwnstr` function](examples/between_string/betwnstr.sql).
125
+
Package specification is [annotated](docs/userguide/annotations.md) with special comments.
126
126
Annotations define that a package is a unit test suite, they also allow defining a description for the suite as well as the test itself.
127
127
Package body consists of procedures containing unit test code. To validate [an expectation](docs/userguide/expectations.md) in test, use `ut.expect( actual_data ).to_( ... )` syntax.
128
128
129
-
130
129
```sql
131
130
create or replace package test_between_string as
132
131
@@ -150,7 +149,7 @@ create or replace package body test_between_string as
0 commit comments