A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_URI::$config is deprecated

Filename: core/URI.php

Line Number: 101

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Router::$uri is deprecated

Filename: core/Router.php

Line Number: 127

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$benchmark is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$hooks is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$config is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$log is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$utf8 is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$uri is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$exceptions is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$router is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$output is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$security is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$input is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$lang is deprecated

Filename: core/Controller.php

Line Number: 75

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property Pages::$load is deprecated

Filename: core/Controller.php

Line Number: 78

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$benchmark is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 132
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$hooks is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 132
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$config is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 132
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$log is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 132
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$utf8 is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 132
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$uri is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 132
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$exceptions is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 132
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$router is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 132
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$output is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 132
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$security is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 132
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$input is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 132
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$lang is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 132
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

A PHP Error was encountered

Severity: 8192

Message: Creation of dynamic property CI_Loader::$load is deprecated

Filename: core/Loader.php

Line Number: 925

Backtrace:

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 147
Function: view

File: /home/project-web/vbscript-development-kit/htdocs/application/controllers/Pages.php
Line: 132
Function: loadPage

File: /home/project-web/vbscript-development-kit/htdocs/index.php
Line: 315
Function: require_once

VDK - unit test tutorial

Understanding the VDK through unit tests

August 21, 2017Posted by Jason Ely

 

VDK unit tests are a great way to learn how to use the VDK library. To see unit tests, you can visit them here.

The VDK uses the scriptunit program for unit testing. You can even execute the unit tests yourself or even build unit tests for your own VDK code. An example of a unit test for the class vdk.lang.collections.clsVdkMap is below.

                                                            'This file has been auto generated by the VDK unit test framework
                                                            'Stub auto generated from code in file: g:\vdk\vdk\lang\collections\clsVdkMap.vbs

                                                            'For each procedure in the original code file, there will be a unit test stub
                                                            'The unit test stub names are generated according to formula: test_[Class_Name]_[Procedure_Name]

                                                            ExecuteGlobal createobject("wsh.vdk.initialize").initialize
                                                            import "vdk.lang.collections.clsVdkMap"

                                                            public sub test_clsVdkMap_getCount
                                                                    'TODO - write your unit test code below
                                                                    set objMap = new clsVdkMap
                                                                    Assert.isEqual objMap.getCount(), 0
                                                                    objMap.put 1, "Jason"
                                                                    Assert.isEqual objMap.getCount(), 1
                                                            End Sub

                                                            public sub test_clsVdkMap_hasKeys
                                                                    set objMap = new clsVdkMap
                                                                    Assert.isFalse objMap.hasKeys
                                                                    objMap.put 1, "Jason"
                                                                    Assert.isTrue objMap.hasKeys

                                                            End Sub

                                                            public sub test_clsVdkMap_hasKey
                                                                    set objMap = new clsVdkMap

                                                                    objMap.put 1, "Jason"
                                                                    Assert.isTrue objMap.HasKey(1)

                                                            End Sub

                                                            public sub test_clsVdkMap_getKeyIndex
                                                                    set objMap = new clsVdkMap
                                                                    objMap.put 1, "Jason"
                                                                    Assert.isTrue objMap.HasKey(1)
                                                                    Assert.isEqual objMap.getKeyIndex (1), 0
                                                                    objMap.put 2, "Ely"
                                                                    Assert.isEqual objMap.getKeyIndex (2),1
                                                                    Assert.isEqual objMap.getKeyIndex (100),-1	

                                                            End Sub

                                                            public sub test_clsVdkMap_hasValue
                                                                    'TODO - write your unit test code below
                                                                    set objMap = new clsVdkMap
                                                                    objMap.put 1, "Jason"
                                                                    Assert.isTrue objMap.hasValue("Jason")
                                                                    Assert.isFalse objMap.hasValue("Ely")
                                                            End Sub

                                                            public sub test_clsVdkMap_getKeyValue
                                                                    set objMap = new clsVdkMap
                                                                    objMap.put 1, "Jason"
                                                                    Assert.isEqual objMap.getKeyValue(1), "Jason"
                                                                    Assert.isEqual objMap.getKeyValue(2), vbEmpty

                                                            End Sub

                                                            public sub test_clsVdkMap_getKeyTypeOverride
                                                                    set objMap = new clsVdkMap
                                                                    objMap.put 1, "Jason"
                                                                    Assert.isEqual objMap.getKeyTypeOverride, vbEmpty


                                                            End Sub



                                                            public sub test_clsVdkMap_getValueTypeOverride
                                                                    set objMap = new clsVdkMap
                                                                    objMap.put 1, "Jason"
                                                                    Assert.isEqual objMap.getValueTypeOverride, vbEmpty

                                                            End Sub


                                                            public sub test_clsVdkMap_setTypeOverride
                                                                    set objMap = new clsVdkMap
                                                                    objMap.setTypeOverride typename(1), typename("Jason")
                                                                    Assert.isEqual objMap.getKeyTypeOverride,typename(1)
                                                                    Assert.isEqual objMap.getValueTypeOverride, typename("Jason")

                                                            End Sub

                                                            public sub test_clsVdkMap_put
                                                                    set objMap = new clsVdkMap
                                                                    objMap.put 1, "Jason"
                                                                    Assert.isEqual objMap.getCount(), 1
                                                                    objMap.put 1, "Ely"
                                                                    Assert.isEqual objMap.getKeyValue(1), "Ely"

                                                            End Sub

                                                            public sub test_clsVdkMap_remove
                                                                    set objMap = new clsVdkMap
                                                                    objMap.put 1, "Jason"
                                                                    Assert.isEqual objMap.getCount(), 1
                                                                    objMap.remove 2
                                                                    Assert.isEqual objMap.getCount(), 1
                                                                    objMap.remove 1
                                                                    Assert.isEqual objMap.getCount(), 0
                                                            End Sub

                                                            public sub test_clsVdkMap_clear
                                                                    set objMap = new clsVdkMap
                                                                    objMap.put 1, "Jason"
                                                                    objMap.put 2, "Jason"
                                                                    Assert.isEqual objMap.getCount(), 2
                                                                    objMap.clear
                                                                    Assert.isEqual objMap.getCount(), 0

                                                            End Sub

                                                            public sub test_clsVdkMap_getKeySet
                                                                    set objMap = new clsVdkMap
                                                                    objMap.put 1, "Jason"
                                                                    objMap.put 2, "Ely"
                                                                    set objKeySet = objMap.getKeySet
                                                                    Assert.isEqual lcase(typename(objKeySet)), lcase("clsArrayList")
                                                                    Assert.isEqual objKeySet.getCount(), 2
                                                                    Assert.IsEqual objKeySet.getItemAt(0), 1
                                                                    Assert.IsEqual objKeySet.getItemAt(1), 2

                                                            End Sub

                                                            public sub test_clsVdkMap_getValueSet
                                                                    set objMap = new clsVdkMap
                                                                    objMap.put 1, "Jason"
                                                                    objMap.put 2, "Ely"
                                                                    set objValueSet = objMap.getValueSet
                                                                    Assert.isEqual lcase(typename(objValueSet)), lcase("clsArrayList")
                                                                    Assert.isEqual objValueSet.getCount(), 2
                                                                    Assert.IsEqual objValueSet.getItemAt(0), "Jason"
                                                                    Assert.IsEqual objValueSet.getItemAt(1), "Ely"

                                                            End Sub
                                                        

Each VDK class method has a unit test which you can read to understand the method mechanics in detail.