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: CONTRIBUTING.md
+5-6
Original file line number
Diff line number
Diff line change
@@ -10,8 +10,8 @@ We love your input! We want to make contributing to this project as easy and tra
10
10
## We Develop with Github
11
11
We use github to host code, to track issues and feature requests, as well as accept pull requests.
12
12
13
-
## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html), So All Code Changes Happen Through Pull Requests
14
-
Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests:
13
+
## We Use [Github Flow](https://docs.github.com/en/get-started/quickstart/github-flow), So All Code Changes Happen Through Pull Requests
14
+
Pull requests are the best way to propose changes to the codebase (we use [Github Flow](https://docs.github.com/en/get-started/quickstart/github-flow)). We actively welcome your pull requests:
15
15
16
16
1. Fork the repo and create your branch from `master`.
17
17
2. If you've added new functionality, it's necessary to add tests. For this there is a separate test project called [TcUnit-Verifier](https://github.com/tcunit/TcUnit/tree/master/TcUnit-Verifier). In that project there are several test suites defined to test the different functionality of TcUnit. Please read the [README.MD](https://github.com/tcunit/TcUnit/blob/master/TcUnit-Verifier/README.md) in that project for further instructions. **No new functionality will be accepted without any proper tests**.
@@ -38,14 +38,13 @@ We use GitHub issues to track public bugs. Report a bug by [opening a new issue]
38
38
- Notes (possibly including why you think this might be happening, or stuff you tried that didn't work)
39
39
40
40
## Use a Consistent Coding Style
41
-
* Make sure to edit the project with the same version of Visual Studio as the master branch. All software (TcUnit and TcUnit-Verifier) has been developed using Visual Studio 2013. Note that VS2013 shell (provided with TwinCAT 3.1.4022.x) can't open the TcUnit-Verifier_DotNet (as it's a .NET/C# project). Instead it's recommended to use [VS2013 community edition](https://visualstudio.microsoft.com/vs/older-downloads/) which can be used both for TwinCAT and .NET/C# projects
42
-
* Make sure to edit the project with the same build of TwinCAT XAE as the master branch. Which build of TwinCAT that is currently used can be deduced from the [TcUnit.tsproj](https://github.com/tcunit/TcUnit/blob/master/TcUnit/TcUnit.tsproj)-file. The "TcVersion"-attribute will give you the version of TwinCAT that was lastly used to edit the project. The build is the third number from the left (for example 4020, 4022 or 4024)
43
-
* Make sure that your TwinCAT development environment uses spaces instead of tabs. The default behaviour of the TwinCAT development environment is to use tabs so it needs to be changed, which can be done according to [this guide](https://alltwincat.com/2017/04/14/replace-tabs-with-whitespaces/)
41
+
* Make sure to edit the project with the same version of Visual Studio as the master branch. All software (TcUnit and TcUnit-Verifier) has been developed using Visual Studio 2019. Note that the TwinCAT XAE Shell (provided with TwinCAT XAE installer) can't open the TcUnit-Verifier_DotNet (as it's a .NET/C# project). Instead it's recommended to use [VS2019 community edition](https://visualstudio.microsoft.com/vs/older-downloads/) which can be used both for TwinCAT and .NET/C# projects
42
+
* Make sure to use TwinCAT XAE version 3.1.4024.44 or later
44
43
* The prefixes of naming of function blocks/variables/etc from the [Beckhoff TwinCAT3 identifier/name conventions](https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_plc_intro/18014401873267083.html&id=) are ignored as a modern integrated development environment (as Visual Studio) gives all the hints/information of data types etc
45
44
* Make sure to set your TwinCAT development environment to use Separate LineIDs. This is available in the TwinCAT XAE under **Tools→Options→TwinCAT→PLC Environment→Write options→Separate LineIDs** (set this to TRUE, more information is available [here](https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_userinterface/18014403202147467.html&id=))
46
45
47
46
## License
48
-
By contributing, you agree that your contributions will be licensed under its MIT License.
47
+
By contributing, you agree that your contributions will be licensed under the MIT License.
49
48
50
49
## References
51
50
This document was adapted from briandk's excellent [contribution guidelines template](https://gist.github.com/briandk/3d2e8b3ec8daf5a27a62).
Welcome to the documentation TcUnit - an xUnit testing framework for [Beckhoff's TwinCAT3](https://www.beckhoff.com/twincat3/).
7
9
8
10
**Main documentation site is available on:**
9
11
**[www.tcunit.org](https://www.tcunit.org)**
@@ -27,6 +29,7 @@ Check out the [TcUnit-Runner project](https://github.com/tcunit/TcUnit-Runner).
27
29
That's fantastic! But please read the [CONTRIBUTING](CONTRIBUTING.md) first.
28
30
29
31
**Have any questions? Found a bug or want to discuss an idea?**
30
-
Check the [F.A.Q](https://tcunit.org/frequently-asked-questions/). Check the [open](https://github.com/tcunit/TcUnit/issues) and [closed](https://github.com/tcunit/TcUnit/issues?q=is%3Aissue+is%3Aclosed) issues.
32
+
Check the [F.A.Q](https://tcunit.org/frequently-asked-questions/).
33
+
Check the [open](https://github.com/tcunit/TcUnit/issues) and [closed](https://github.com/tcunit/TcUnit/issues?q=is%3Aissue+is%3Aclosed) issues.
31
34
If your issue does not already exist, create a [new](https://github.com/tcunit/TcUnit/issues/new).
32
35
For general ideas/discussions, use the [discussions](https://github.com/tcunit/TcUnit/discussions).
TcUnit-Verifier_TwinCAT (TcVT) is as the name implies a TwinCAT project.
15
-
It holds a reference to and instantiates the TcUnit framework. It is defined by
16
-
several test suites (function blocks) that make use of TcUnit and its different
17
-
functionalitites. An example of a test is to verify that TcUnit prints a message
18
-
if an assertion of an INT has failed (expected value not equals to
19
-
asserted value). This means per definition that the verifier will have failed
20
-
tests as results, because that is what we want to test. Everytime a test suite
21
-
is created in TcVT that tests the functionality of TcUnit it is expected
22
-
that either:
23
-
- Some specific output is created by TcUnit (error-log), for example asserting a
24
-
value that differs from the expected value
25
-
- Some specific output is **not** created by TcUnit (error-log), for example
26
-
asserting a value that is equal to the expected value
14
+
It holds a reference to and instantiates the TcUnit framework.
15
+
It is defined by several test suites (function blocks) that make use of TcUnit and its different functionalitites.
16
+
An example of a test is to verify that TcUnit prints a message if an assertion of an INT has failed (expected value not equals to asserted value).
17
+
This means per definition that the verifier will have failed tests as results, because that is what we want to test.
18
+
Everytime a test suite is created in TcVT that tests the functionality of TcUnit it is expected that either:
19
+
- Some specific output is created by TcUnit (error-log), for example asserting a value that differs from the expected value
20
+
- Some specific output is **not** created by TcUnit (error-log), for example asserting a value that is equal to the expected value
27
21
28
-
Creating a test suite for TcUnit thus requires that the developer needs to know
29
-
what TcUnit should print (or not print). This means that running this TwinCAT
30
-
project is not enough to know whether TcUnit behaves as expected, as it would
31
-
require to manually check all the output from TcVT. Because we don't manually
32
-
want to check that the output provided by TcUnit-Verifier_TwinCAT everytime it's
33
-
running, another program is necessary that verifies that the output of the TcVT
34
-
is as expected.
22
+
Creating a test suite for TcUnit thus requires that the developer needs to know what TcUnit should print (or not print).
23
+
This means that running this TwinCAT project is not enough to know whether TcUnit behaves as expected, as it would require to manually check all the output from TcVT.
24
+
Because we don't manually want to check that the output provided by TcUnit-Verifier_TwinCAT everytime it's running, another program is necessary that verifies that the output of the TcVT is as expected.
35
25
36
26
## TcUnit-Verifier_DotNet
37
-
The TcUnit-Verifier_DotNet (TcVD) is a (Visual Studio 2013) C# program that
38
-
opens and runs the TcUnit-Verifier_TwinCAT project by the usage of the TwinCAT
39
-
automation interface. It basically does the following:
27
+
The TcUnit-Verifier_DotNet (TcVD) is a C# program that opens and runs the TcUnit-Verifier_TwinCAT project by the usage of the TwinCAT automation interface.
28
+
It basically does the following:
40
29
- Starts Visual Studio (using the same version that was used developing TcVT)
41
30
- Opens TcVT
42
31
- Does a clean/build of TcVT
@@ -47,16 +36,11 @@ automation interface. It basically does the following:
47
36
- Collects all results from the error list in Visual Studio
48
37
- Checks that the output is as defined/expected
49
38
50
-
The different tests in TcVD follow the same naming-schema as for the TcVT tests
51
-
so for example you can find a structured text (ST) function block (FB)
52
-
`FB_PrimitiveTypes.TcPOU` in TcVT and the accompanying C#-class
53
-
`FB_PrimitiveTypes.cs`. The C# classes verify and test that the output from the
54
-
ST function blocks is correct. Thus a complete test of a specific function in
55
-
TcUnit needs to be developed in pair, both a FB of tests needs to be added to
56
-
TcVT as well a class of tests needs to be added to TcVD.
39
+
The different tests in TcVD follow the same naming-schema as for the TcVT tests, so for example you can find a structured text (ST) function block (FB) `FB_PrimitiveTypes.TcPOU` in TcVT and the accompanying C#-class `FB_PrimitiveTypes.cs`.
40
+
The C# classes verify and test that the output from the ST function blocks is correct.
41
+
Thus a complete test of a specific function in TcUnit needs to be developed in pair, both a FB of tests needs to be added to TcVT as well a class of tests needs to be added to TcVD.
57
42
58
-
All test classes are instantiated in the class `Program.cs` starting from the
59
-
lines:
43
+
All test classes are instantiated in the class `Program.cs` starting from the lines:
60
44
```
61
45
/* Insert the test classes here */
62
46
new FB_PrimitiveTypes(errors);
@@ -67,15 +51,10 @@ new FB_AssertEveryFailedTestTwice(errors);
67
51
...
68
52
```
69
53
70
-
To create a new test class and make sure that it will be running all that is
71
-
necessary is to make sure to instantiate it with the argument `errors`
72
-
(just as above). If you have added a test in TcVT that is supposed to fail, and
73
-
thus adding an additional failed test to the output, you need to increment the
74
-
variable `expectedNumberOfFailedTests` in TcVD by one for every failed test
75
-
that you have added.
54
+
To create a new test class and make sure that it will be running all that is necessary is to make sure to instantiate it with the argument `errors` (just as above).
55
+
If you have added a test in TcVT that is supposed to fail, and thus adding an additional failed test to the output, you need to increment the variable `expectedNumberOfFailedTests` in TcVD by one for every failed test that you have added.
76
56
77
-
For example, if we in the PRG_TEST-program of TcVT have a function block
78
-
instantiated in this way:
57
+
For example, if we in the PRG_TEST-program of TcVT have a function block instantiated in this way:
79
58
```
80
59
PROGRAM PRG_TEST
81
60
VAR
@@ -91,31 +70,23 @@ This is an example of how it can look running the TcUnit-Verifier_DotNet:
In the console enter `Install-Package log4net -Version 2.0.14`.
90
+
If there was an error in the TcUnit framework this would be shown between the lines `Asserting results...` and `Done.`.
91
+
If nothing is shown between these lines (like in the example) it means that TcUnit behaves according to the tests defined in TcUnit-Verifier.
92
+
As TcVD starts the TwinCAT runtime it is required that a (trial) runtime license for TwinCAT is activated on the PC of where TcVD and TcVT will be running.
0 commit comments