testing


Year-dependent test


What is the best practice for automatically testing the correct behavior of a function that depends on the current year? Specifically, I would like to add a test to the function DateList in Mathics (a Mathematica-like CAS) that ensures that the current year is returned when no year is given as an argument.
Two possible solutions come to my mind:
Hard-code the current year in the test. So this test has to be updated every year with the potential of some failing integration tests after New Year.
Create another function that is supposed to return the current year and ensure they return the same. This reduces the probability of errors but, of course, still both functions could be wrong.
Any other ideas or pointers to existing practice?
I use the time on the server to get the current Date/Year and unit-test my unit that it returns the same year (which I got from the System Time)
You should keep in mind the TimeZone difference when testing the returned value against the current Server DateTime.
This works for my testing, and hope it helps you too.

Related Links

Sending an email about thread groups in JMeter
Phoenix test data is persisting making the tests non-repeatable
Best Subset regression on test sample (after k-fold)
Unit testing a jee filter
Testing a component that appears repeatedly in the code - Test once per component, or per appearance?
XUnit DI through overridden Startup file (.net core)
How can I make Elixir mix test output more verbose?
Meteor test only runs one test suite
Stubbing static methods in MSpec
How i can order nunit TestFixtures
Cannot select a checkbox in codeception
Touch Screen Laptops Emulator for Testing
Gradle: automatically add a test dependency on a project
DbUnit Tests with SilkCentral
Running a test in golang that only works for some versions [duplicate]
How to redefine browser builtin variable to certain value to test a module?

Categories

HOME
ms-access
compiler-construction
twitter
log4j
client
image
pycharm
homebrew
spring-jdbc
yarn
amazon-ecs
microservices
graphql
sharepoint-designer
umd
ezpublish
autotools
cloudkit
here-api
kentor-authservices
spring-xd
php-7.1
serverless-framework
swingx
tibco-mdm
wijmo
buildbot
user-interaction
bootstrap-material-design
windows-server-2000
atl
hexo
nssegmentedcontrol
ssjs
gzipstream
netcdf4
angular2-meteor
skeleton-css-boilerplate
filepicker
pango
aurelia-validation
darcs
nativeapplication
sqlclient
sqldf
quartz-composer
objective-c-swift-bridge
nested-sets
fody
impresspages
firebaseui
prerequisites
thredds
ruby-2.2
atk4
security-testing
drawbitmap
graph-api-explorer
formatjs
fscommand
block-device
gwidgets
cctv
preferences
googlemock
castle
project-planning
heisenbug
sgen
prettify
c18
jmapviewer
chuck
dice
newtonscript
errai
parametric-equations
qt-jambi
hirefire
xmemcached
html-input
digest-authentication
paster
sproutcore-2
jquery-ui-droppable
javap
backcolor
private-members
paul-graham
ntvdm.exe

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App