New Year's resolution: git (see what I did there?) started on source control.
As a Test Automator
I want to have a Git server running on my own AWS hosted Linux server
So that I'll always have complete and up-to-date access to all my source code
woensdag 30 december 2015
C# > Code Smells
From Adaptive Code via C# by Gary McLean Hall
- Static methods
- Static classes (including singletons = classes which can only be instantiated by one object)
- Object construction that uses new
- Extension methods
Code perfumes:
- Interfaces
- Dependency injections
- Inversion of control
- Factories
C# > Setting up NUnit in a solution
How to get NUnit working in a Visual Studio 2015 solution:
- Create a new solution
- Create under that solution two projects: YourApplication and YourApplicationTest
- In this setup we'll write our unit tests in a separate project (YourApplicationTest). Whether the unit tests are written in the same project (pro: code can test itself, con: double the namespace filled up) is a matter of personal preference.
- In YourApplicationTest do the following:
- RightClick the project in the solution explorer and choose 'Manage NuGet Packages'
- Using the NuGet Package Manager:
- Install NUnit version 2.6.4(!!)
- Install NUnitTestAdapter 2.0.0
- If all went well then it's now possible to write unit tests in the YourApplicationTest project. The problem remaining is that we want to write the unit tests for YourApplication in YourApplicationTest and encapsulation will prevent that out of hand. Therefore
- In YourApplication do the following:
- In assemblyinfo.cs add:
- [assembly:InternalsVisibleTo("YourApplicationTest")]
- In classes which contain unit tests in YourApplicationTest add:
- using YourApplication
Done :-)
First steps in C# (from a Java perspective)
- const keyword (as opposed to 'final'?)
- C# is 'pass by value' unless otherwise specified:
- use the ref keyword with parameters AND arguments to 'pass by reference'
- use the out keyword with parameters AND arguments to 'pass by reference' without being able to access the old pre-method value
- Overloading the constructor:
- public Constructor (params) : this (params) {}
- Pay extra note: the constructor calls are BEFORE the block
- Implementing an interface:
- public class MyClass : IMyInterface {}
- pay note to the 'I' in front of MyInterface. Good convention.
- Inheriting a class:
- public class MyChildClass : MyParentclass {}
- the fact that there is no difference in syntax between inheriting a class and implementing an interface is an EXTRA (good) reason to obey the 'I in front' naming convention for interfaces.
- Overriding a Parentclass method:
- Parentclass method must have the keyword 'virtual'
- Childclass overriding method must have the keyword 'override'
- This make the default 'behavior' of ParentClasses that they CAN'T be overridden. Probably more secure :)
- Again: the keyword 'virtual' and 'override' form a pair which is needed to override methods.
- Calling the Parentclass method from within the Childclass:
- base.parentMethod(args)
woensdag 2 december 2015
Tosca tips and tricks: printing reports via TCShell
Tosca has built-in reporting functionality. To be able to generate these report via TCShell one can use the syntax:
task "Print Report ... ExecutionEntries with ActualLog" "Report.pdf"
But this won't work until you add the following to your TCShell.exe.config:<Tricentis.TCAddIns.Reporting.Properties.Settings>
<setting name="DefaultPrintOutputFormat" serializeAs="String">
<value>ASKUSER</value>
</setting>
</Tricentis.TCAddIns.Reporting.Properties.Settings>
And - which I found out today to my own detriment - after you install a new Tosca upgrade or release this file will be overwritten by the default and consequently break your TCShell reporting functionality. Something to be aware of.
This is all perfectly described in the following Tricentis documentation:
https://support.tricentis.com/community/manuals_detail.do?sysparm_document_key=u_webhelp,25d579ec37e78640a30fa16043990e3c
https://documentation.tricentis.com/en/900/content/tchb/commander_config.htm#DefaultPrintOutputFormat
https://documentation.tricentis.com/en/900/content/tchb/configuration_files.htm#Structure_config
Note to self: add 'Output (print) reports' to the list of useful Tosca search terms.
Abonneren op:
Reacties (Atom)