Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rubberduck>Unit Test>Test Method #2854

Closed
IvenBach opened this issue Mar 13, 2017 · 6 comments
Closed

Rubberduck>Unit Test>Test Method #2854

IvenBach opened this issue Mar 13, 2017 · 6 comments
Labels
bug Identifies work items for known bugs duplicate Thanks for the feedback! We're already tracking this report/request at the linked issue. feature-unit-testing

Comments

@IvenBach
Copy link
Member

Doesn't look like adding a method is working as intended. Below is what I've experienced.

Before

Option Explicit

Option Private Module

'@TestModule
'@Folder("Tests")
Private someTable  As ListObject

Private Assert As Object

'@ModuleInitialize
Public Sub ModuleInitialize()
    'this method runs once per module.
    Set Assert = CreateObject("Rubberduck.AssertClass")
End Sub

'@TestInitialize
Public Sub TestInitialize()
    'this method runs before every test in the module.
End Sub

'<--- Cursor is here

'@TestCleanup
Public Sub TestCleanup()
    'this method runs after every test in the module.
End Sub

'@ModuleCleanup
Public Sub ModuleCleanup()
    'this method runs once per module.
End Sub

After

Option Explicit

Option Private Module

'@TestModule
'@Folder("Tests")
Private someTable  As ListObject

Private Assert As Object

'@ModuleInitialize
Public Sub ModuleInitialize()
    'this method runs once per module.
    Set Assert = CreateObject("Rubberduck.AssertClass")
End Sub

'@TestInitialize
Public Sub TestInitialize()
    'this method runs before every test in the module.
End Sub

'<--- Cursor is here

'@TestCleanup
Public Sub TestCleanup()
    'this method runs after every test in the module.
End Sub

'@ModuleCleanup
Public Sub ModuleCleanup()
    'this method runs once per module.
'@TestMethod
Public Sub TestMethod1() 'TODO Rename test
    On Error GoTo TestFail
    
    'Arrange:

    'Act:

    'Assert:
    Assert.Inconclusive

TestExit:
    Exit Sub
TestFail:
    Assert.Fail "Test raised an error: #" & Err.Number & " - " & Err.Description
End Sub

End Sub
@retailcoder
Copy link
Member

Can't repro. How does that even happen? The current selection has (supposedly) no bearing whatsoever on the actual insertion point, which is module.CountOfLines.

@IvenBach
Copy link
Member Author

Just tested it at home and results are identical. I can reproduce it every time.

@retailcoder
Copy link
Member

Is there another project in the VBE with a test module named the same as the one you're in?

@IvenBach
Copy link
Member Author

No. I tested it on a new workbook with only TestModule1 and the code from my original post. I get the same results.

@Vogel612 Vogel612 added bug Identifies work items for known bugs refactoring-extract-method status-norepro The issue could not be reproduced. If there is a stable repro, please add that as a new comment. feature-unit-testing and removed refactoring-extract-method labels Mar 24, 2017
@IvenBach
Copy link
Member Author

I'm guessing if nobody else can reproduce this it may be an isolated issue for my machine. Home computer can reproduce it.

@Vogel612 Vogel612 added duplicate Thanks for the feedback! We're already tracking this report/request at the linked issue. and removed status-norepro The issue could not be reproduced. If there is a stable repro, please add that as a new comment. labels Jul 23, 2018
@Vogel612
Copy link
Member

Marking as duplicate of the newer #4169

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identifies work items for known bugs duplicate Thanks for the feedback! We're already tracking this report/request at the linked issue. feature-unit-testing
Projects
None yet
Development

No branches or pull requests

3 participants