vba-toolbox / excelvbaunit Goto Github PK
View Code? Open in Web Editor NEWAutomatically exported from code.google.com/p/excelvbaunit
Automatically exported from code.google.com/p/excelvbaunit
What steps will reproduce the problem?
1. create MyXls.xls with VBA test code
2. do not change project from default VBAProject name
3. xrun "MyXls" fails with no indication of what error is
What version of the product are you using? On what operating system?
- Vista Business SP2 32 bit, Excel 2002 with VBA MSVB6.3
Please provide any additional information below.
rewrite GetTestFixtures as follows:
---------------------
Public Function GetTestFixtures(projectName As String) As TestFixture()
Dim project As VBProject
On Error GoTo e_GTF: ' << extra line
Set project = Application.VBE.VBProjects(projectName)
' Project not found?
' Get list of modules containing test cases
Dim components() As VBComponent
components = GetTestingComponents(project)
' Each module corresponds to a fixture
Dim fixtures() As TestFixture
Dim count As Integer
count = Main.SafeUbound(components)
If count >= 0 Then
ReDim fixtures(0 To count) As TestFixture
Dim i As Integer
For i = 0 To count
Set fixtures(i) = New TestFixture
fixtures(i).ExtractTestCases project, components(i)
Next
End If
GetTestFixtures = fixtures
Exit Function' << extra line
e_GTF:' << extra line
For Each project In Application.VBE.VBProjects' << extra line
Debug.Print project.name' << extra line
Next' << extra line
MsgBox (projectName + " not found in Application.VBE.VBProjects")' <<
extra line
Stop' << extra line
End Function
Original issue reported on code.google.com by [email protected]
on 28 May 2009 at 2:49
What steps will reproduce the problem?
1. Create Test.xls and insert some VBA testing code
2. Do not name any of the modules with the prefix "Test" or the
suffix "Tester"
3. Leave the project name as the default (VBAProject)
4. Type xRun "VBAProject" into the Immediate window and press Enter
5. Causes "Run-time error '9': Subscript is out of range" on the line "For
i = 0 To UBound(fixtures)" in the SetUpResultsManager subroutine of the
TestRunner class.
What is the expected output? What do you see instead?
Expected output of "Total: 0 passes, 0 failures" in the Immediate window.
What version of the product are you using? On what operating system?
- excelvbaunit Revision 13
- Excel 2003
- Windows XP Pro SP3, 32 bit
- "VbaUnit" and "Microsoft Visual Basic for Applications Extensibility
5.3" enabled through Visual Basic Editor => Tools => References
- "Trust access to Visual Basic Project" checked under Excel => Tools =>
Security => Trusted Publishers
Please provide any additional information below.
If there are no valid test modules then UBound(fixtures) causes a
subscript out of range error.
This works for me:
Swap "For i = 0 To UBound(fixtures)"
With "For i = 0 To Main.SafeUbound(fixtures)"
Where "Main.SafeUBound" is a function used in other classes (e.g.,
TestManager) in this project.
As an alternative, this also works for me:
If IsArray(fixtures) Then '<< extra line
For i = 0 To UBound(fixtures)
If (ShouldRunFixture(fixtures(i), fixtureNameToBeRun)) Then
testCaseCount = testCaseCount + UBound(fixtures
(i).TestProcedures) + 1
End If
Next i
End If '<< extra line
Original issue reported on code.google.com by [email protected]
on 21 Nov 2009 at 10:10
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.