Re: [DISCUSS] Stop using reflection to access private fields in tests

2025-08-25 Thread xiangying meng
+1 BR, Xiangying On Tue, Aug 26, 2025 at 10:13 AM Ruimin MA wrote: > > thanks for sharing this. It's really helpful and good to know that! > > > Yunze Xu 于2025年8月25日 周一21:39写道: > > > Hi all, > > > > I'd like to bring the open discussion for the coding style about > > whether to use reflection in

Re: [DISCUSS] Stop using reflection to access private fields in tests

2025-08-25 Thread Ruimin MA
thanks for sharing this. It's really helpful and good to know that! Yunze Xu 于2025年8月25日 周一21:39写道: > Hi all, > > I'd like to bring the open discussion for the coding style about > whether to use reflection in tests. Today when I reviewed a PR, I left > a comment here [1] because I noticed refle

Re: [DISCUSS] Stop using reflection to access private fields in tests

2025-08-25 Thread Jie crossover
+1 Great suggestion. -- Best Regards! crossoverJie Zhangjian He 于2025年8月26日周二 07:33写道: > +1 > > On Mon, Aug 25, 2025 at 11:38 PM Lari Hotari wrote: > > > +1, Thanks for starting this discussion, Yunze. > > > > One good principle is to only test externally observable behaviors > > ("test beha

Re: [DISCUSS] Stop using reflection to access private fields in tests

2025-08-25 Thread Zhangjian He
+1 On Mon, Aug 25, 2025 at 11:38 PM Lari Hotari wrote: > +1, Thanks for starting this discussion, Yunze. > > One good principle is to only test externally observable behaviors > ("test behavior, not implementation"). > Having the need to inspect internal state is a sign of bad design. It > could

Re: [DISCUSS] Stop using reflection to access private fields in tests

2025-08-25 Thread Lari Hotari
+1, Thanks for starting this discussion, Yunze. One good principle is to only test externally observable behaviors ("test behavior, not implementation"). Having the need to inspect internal state is a sign of bad design. It could also be a sign of bad test design where the test is checking that th

[DISCUSS] Stop using reflection to access private fields in tests

2025-08-25 Thread Yunze Xu
Hi all, I'd like to bring the open discussion for the coding style about whether to use reflection in tests. Today when I reviewed a PR, I left a comment here [1] because I noticed reflection was used again in tests. Reflection makes refactoring really painful and could kill the enthusiasm to ref