- Reusable VBA code for Microsoft Access Applications
- Import/export/update code with ACLib Import Wizard
Details: https://access-codelib.net/
AccUnit - Test your VBA/Access code
Home Page: https://accunit.access-codelib.net/
License: GNU General Public License v3.0
Details: https://access-codelib.net/
Example test code: (from https://github.com/AccessCodeLib/AccessCodeLib/blob/master/_test/data/dao/DaoHandlerTests.cls)
Public Sub CreateParamDefArray_Use4ParamArrays_CheckArray()
Dim Actual() As Variant
Dim Expected(3, 1) As Variant
Dim i As Long
For i = 0 To 3
Expected(i, 0) = i
Expected(i, 1) = i * 2 + 1
Next
Actual = m_DaoHandler.GetParamDefArray(1, 3, 5, 7)
Assert.AreEqual Expected, Actual
End Sub
Result:
Error: At least one object must implement IComparable.
Issue:
Call Export TestClasses: codemodules marked with AccUnit:TestRelated not exported
Originally posted by FDominicus September 21, 2023
Yes, a gui interface in which one can see the tests and choose from wich to run, would be very appreciated.
IMHO testing should not be pain, it should be easy, fast and accessible. I don't feel the output in the console is that.
e. g. Assert.That Clng(1), Iz.Strict.EqualTo(Cdbl(1)) ...should fail
The test classes should be able to be imported and exported automatically from a specified directory.
If an older version is installed and a new version with new interfaces is installed in tlb, AccUnitLoader.accda cannot be compiled.
to fix: check tlb version and update file
TestClassGenerator generates this code for Public Function Method1(ByVal x As Long) As Long
:
'AccUnit:Row(x, Expected).Name = "Example row - please replace the parameter names with values)"
Public Sub Method1(ByVal x As Long, ByVal Expected As Long)
' Arrange
Err.Raise vbObjectError, "Method1", "Test not implemented"
Const Expected As Variant = "expected value"
Dim Actual As Variant
' Act
Actual = "actual value"
' Assert
Assert.That Actual, Iz.EqualTo(Expected)
End Sub
The line Const Expected As Variant = "expected value"
should not be there. It should only be there for tests without parameters.
missing type info in AccUnit.tlb for VbProject.
possible Interface:
Filter with tags:
TestSuite.AddByClassName("TestClassName").Filter("abc", "xyz", "123").Run
TestSuite.Add(new TestClass).Filter(...).Run
TestSuite.AddFromVBProject.Filter(...).Run
Filter method name:
Extend Add methods
TestSuite.AddByClassName("TestClassName", Array("MethodName1", "MethodName2")).Run
TestSuite.Add(new TestClass, ."*Xyz*").Run
TestSuite.AddFromVBProject ...
... Method filtering is rather unusual here, why would you want to run a particular method in multiple test classes?Log test results to VCS
Insert a template via the add-in or immediate windows like TestSuite.InsertTemplate.TemplateName
For automatic test execution (e.g. when checking in to source code management), save the results in files.
VBA enum values should become possible in the Row Test declaration to increase readability.
Actual:
'AccUnit:Row(1, #1/1/2023#) ' 1 = vbSunday
'AccUnit:Row(2, #1/1/2024#) ' 2 = vbMonday
Public Sub MyFirstTest(ByVal Expected As VbDayOfWeek, ByVal DateToCheck As Date)
Better:
'AccUnit:Row(vbSunday, #1/1/2023#)
'AccUnit:Row(vbMonday, #1/1/2024#)
Public Sub MyFirstTest(ByVal Expected As VbDayOfWeek, ByVal DateToCheck As Date)
example:
Dim Actual() As Variant
Dim Expected() As Variant
Assert.AreEqual Expected, Actual
=> out of memory
vbNullstring (VBA: StrPtr = 0) is null in C#.
Add a Assert methode to compare strings (with string parameters for actual/expected)
Possible variants (interface for VBA):
Assert.AreEqual Expected, Actual, "InfoText", ++ string compare parameter ++
Assert.StringCompare(IgnoreCase:=False, VbNullStringEqualEmptyString:=True).AreEqual Expected, Actual
Assert.StringCompare(Compare:= vbTextCompare).AreEqual Expected, Actual
Assert.StringCompare(....).That Actual, Iz.EqualTo(Expected)
Note: Maybe this is useful for other data types as well.
The installation has worked up to the point in the Video where one type
TestSuite.name in the window
I loaded the database TestRunner.accdb
While trying to tun the test I just get:
Der Typ 'AccessCoddLib.common.VBIDETools.CodeModuleMember in der Assembly "AccessCodLib.VBIDETools,Version=0.9.10.0, Culture=Neutral, PublicKeyToken=null konnte nicht geladen werden
And that's it ...
Load test classes, run tests and cleanup code from outside (VB script, ...)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.