wushifeng

Results 5 comments of wushifeng

是这个场景 **业务类有两个方法,**如:MockDemo callCommonFunc commonFunc public String callCommonFunc() { return commonFunc(); } public String commonFunc(){ return MockDemo.class.getSimpleName(); } **现在想mock上面两个方法:** 类似如下的配置 @MockInvoke(targetClass = MockDemo.class, targetMethod = "commonFunc") @MockInvoke(targetClass = MockDemo.class) public String...

**刚才贴的少了2行,看初始内容,是mock了两个方法,写的方式如下** @MockInvoke public String commonFunc(MockDemo self) { System.out.println(self); return "mock"; } @MockInvoke public String commonFunc(MockDemo self) { System.out.println(self); return "mock"; } **然后测试时,commonFunc不生效** public void mock(){ MockDemo u = new MockDemo();...

理解了系统的设计方式,https://alibaba.github.io/testable-mock/#/zh-cn/doc/design-and-mechanism 划重点:Mock的目标是**被测类中的方法调用**。测试用例里的代码不会被Mock,方法的定义本身没有变化,只是发起调用的代码被替换了 这种场景如何来做: ```JAVA class Demo{ public String test(){ ... this.innerFunc(); ... return ....; } } ``` 假设我想mock: new Demo().test() 这个方法,那需要对代码逻辑进行修改才能mock,不然只是方法内的调用可以被mock,那就只能mock这个函数innerFunc 这种情况对一些已有的系统的测试就有些麻烦,不知有没有方式来支持这个场景 没深入testable-mock的代码,如果这种场景不支持,具体是什么原因

maybe: 1 download data home-depot-product-search-relevance.zip from [https://www.kaggle.com/competitions/home-depot-product-search-relevance/data](https://www.kaggle.com/competitions/home-depot-product-search-relevance/data) 2 extract train.csv.zip and product_descriptions.csv.zip to Dir Data 3 use code below to generate home-depot-sentence-similarity.csv ``` using Microsoft.ML; using Microsoft.ML.Data; using Microsoft.ML.Transforms; namespace...

Here is the processed data file. [home-depot-sentence-similarity.zip](https://github.com/dotnet/machinelearning-samples/files/13704289/home-depot-sentence-similarity.zip)