question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support the TestVisible Annotation

See original GitHub issue

Summary

The TestVisible annotation doesn’t seem to be supported by the extension pack. Methods marked with the TestVisible annotation are not visible in tests.

Steps To Reproduce:

  1. Create a private method
  2. Mark the method with the @TestVisible annotation
  3. Create a test class
  4. Write a test that attempts to use the method provided

Expected result

The method should be visible and not show up in the “Problems” console.

Actual result

The method is not visible and shows up in the “Problems” console.

Additional information

Here is an example

Screen Shot 2019-12-09 at 9 27 45 PM Screen Shot 2019-12-09 at 9 10 52 PM

I’ve included a small repository that should reproduce the issue. https://github.com/dv297/testvisible-reproduction

I’m still fairly new to Apex, so pardon me if I’m misunderstanding any of this. I believe the language server is compiled in apex-jorje-lsp.jar, so perhaps whatever repository holds the original source code to that jar would be the more appropriate place to log that, but I haven’t really seen that code around.

VS Code Version: 1.40.2

SFDX CLI Version: 7.36.0-b1c4e9c7c8

OS and version: MacOS 10.14.6

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
sc5148commented, Dec 10, 2019

I don’t understand why stuffs such basic and fundamental as these are not yet implemented.

0reactions
randi274commented, Sep 8, 2022

Hey all! I’m now seeing that both issues have been fixed in the latest version of the extensions.

  1. TestVisible methods called from test classes are not reporting incorrect errors
  2. TestVisible inner classes called from test classes are not reporting incorrect errors

Screen Shot 2022-09-08 at 3 03 39 PM

I’ll go ahead and close this one for now. Let me know if anyone is seeing any residual issues here, and we can either reopen this issue, or create a new one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

what is useful of @istest,@testVisible, @testSetUp as well.
Use the TestVisible annotation to allow test methods to access private or protected members of another class outside the test class.
Read more >
apex - When is it appropriate to use the @TestVisible Annotation
Adding the @TestVisible annotation allows me to use this property in my test classes to assert the appropriate messages are displayed while ...
Read more >
What is @testVisible used for while testing an Apex class in ...
TestVisible annotation allows test methods to access private or protected members of another class outside the test class. These members include methods, ...
Read more >
@TestVisible Annotation in Salesforce - SalesforceScool
For Example: This example shows how to access private class member variable and private method with help of @TestVisible annotation. public ...
Read more >
TestVisible annotation in Salesforce – Biswajeet Samal's Blog
TestVisible annotation allow test methods to access private or protected members of another class outside the test class.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found