Gemeinsam zu mehr Effizienz in der Anwendungserstellung
K |
K |
||
Zeile 13: | Zeile 13: | ||
<source> | <source> | ||
Public Sub Test1() | Public Sub Test1() | ||
- | Dim | + | Dim testResult As Double |
- | + | testResult = VBA.Math.Sqr(4) | |
- | Assert.AreEqual | + | Assert.AreEqual 2, testResult |
End Sub | End Sub | ||
</source> | </source> | ||
<source> | <source> | ||
Public Sub Test2() | Public Sub Test2() | ||
- | Dim | + | Dim testResult As Double |
- | + | testResult = VBA.Math.Sqr(4) | |
- | Assert.That | + | Assert.That testResult, Iz.EqualTo(2) |
End Sub | End Sub | ||
</source> | </source> | ||
<source> | <source> | ||
Public Sub Test3() | Public Sub Test3() | ||
- | Dim | + | Dim testResult As Long '=> Test schlägt fehlt, weil als Ergebnis 2 kommt (Long statt Double) |
- | + | testResult = VBA.Math.Sqr(4.5) | |
- | Assert.That | + | Assert.That testResult, Iz.Not.EqualTo(2) |
End Sub | End Sub | ||
</source> | </source> |
SimplyVBUnit ist ein Test-Framework für VB6 und VBA, das sich an NUnit orientiert.
Projektseite: http://sourceforge.net/projects/simplyvbunit/
Public Sub Test1() Dim testResult As Double testResult = VBA.Math.Sqr(4) Assert.AreEqual 2, testResult End Sub
Public Sub Test2() Dim testResult As Double testResult = VBA.Math.Sqr(4) Assert.That testResult, Iz.EqualTo(2) End Sub
Public Sub Test3() Dim testResult As Long '=> Test schlägt fehlt, weil als Ergebnis 2 kommt (Long statt Double) testResult = VBA.Math.Sqr(4.5) Assert.That testResult, Iz.Not.EqualTo(2) End Sub