You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2020/12/08 03:13:37 UTC

[GitHub] [incubator-dolphinscheduler] bingexxx opened a new issue #4175: 跑单元测试的时候报错

bingexxx opened a new issue #4175:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4175


   运行 SqlExecutorTest 测试类的时候报错,应该是没有拉起spring 服务,请问是缺少了什么注解吗?
   ![WechatIMG1260](https://user-images.githubusercontent.com/22575306/101434901-60d50800-3946-11eb-9e1e-14a25e1ba5d8.png)
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler] whitelowrie commented on issue #4175: [Improve][ut]Refactor SqlExecutorTest

Posted by GitBox <gi...@apache.org>.
whitelowrie commented on issue #4175:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4175#issuecomment-740355862


   @CalvinKirs 
   Sure,I can do this.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler] CalvinKirs commented on issue #4175: 跑单元测试的时候报错

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on issue #4175:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4175#issuecomment-740351475


   > Please use english!!!
   > and you can write the test like this before you configured correctly
   > 
   > ```java
   > @RunWith(SpringJUnit4ClassRunner.class)
   > @ContextConfiguration(classes={DependencyConfig.class, SpringApplicationContext.class, SpringZKServer.class,
   >         NettyExecutorManager.class, ExecutorDispatcher.class, ZookeeperRegistryCenter.class, TaskPriorityQueueConsumer.class,
   >         ZookeeperNodeManager.class, ZookeeperCachedOperator.class, ZookeeperConfig.class, MasterConfig.class})
   > public class MyTest {
   > 
   >     @Autowired
   >     private ProcessService processService = null;
   > 
   >     @Test
   >     public void test01(){
   >         System.out.println(processService);
   >     }
   > }
   > ```
   
   We hope to adopt the mock form, because ut should remain relatively independent. Are you interested in refactoring this UT?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler] whitelowrie edited a comment on issue #4175: [Improve][ut]Refactor SqlExecutorTest

Posted by GitBox <gi...@apache.org>.
whitelowrie edited a comment on issue #4175:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4175#issuecomment-740350496


   Please use english!!!
   and you can write the test like this before you configured correctly
   
   ```java
   @RunWith(SpringJUnit4ClassRunner.class)
   @ContextConfiguration(classes={DependencyConfig.class, SpringApplicationContext.class, SpringZKServer.class,
           NettyExecutorManager.class, ExecutorDispatcher.class, ZookeeperRegistryCenter.class, TaskPriorityQueueConsumer.class,
           ZookeeperNodeManager.class, ZookeeperCachedOperator.class, ZookeeperConfig.class, MasterConfig.class})
   public class MyTest {
   
       @Autowired
       private ProcessService processService = null;
   
       @Test
       public void test01(){
           System.out.println(processService);
       }
   }
   ```
   
   if you use the recommended mock test, you can write the test like this
   ```java
   @RunWith(MockitoJUnitRunner.Silent.class)
   public class MyTestMock {
       @Autowired
       private ProcessService processService = null;
       @Before
       public void init(){
           processService = mock(ProcessService.class);
       }
       @Test
       public void test01(){
           System.out.println(">>>>>>>>>>>>>" + processService.getUserById(1));
       }
   }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler] whitelowrie edited a comment on issue #4175: [Improve][ut]Refactor SqlExecutorTest

Posted by GitBox <gi...@apache.org>.
whitelowrie edited a comment on issue #4175:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4175#issuecomment-740350496


   Please use english!!!
   and you can write the test like this before you configured correctly
   
   ```java
   @RunWith(SpringJUnit4ClassRunner.class)
   @ContextConfiguration(classes={DependencyConfig.class, SpringApplicationContext.class, SpringZKServer.class,
           NettyExecutorManager.class, ExecutorDispatcher.class, ZookeeperRegistryCenter.class, TaskPriorityQueueConsumer.class,
           ZookeeperNodeManager.class, ZookeeperCachedOperator.class, ZookeeperConfig.class, MasterConfig.class})
   public class MyTest {
   
       @Autowired
       private ProcessService processService = null;
   
       @Test
       public void test01(){
           System.out.println(processService);
       }
   }
   ```
   
   recommended the mock , you can write the test like this
   ```java
   @RunWith(MockitoJUnitRunner.Silent.class)
   public class MyTestMock {
       @Autowired
       private ProcessService processService = null;
       @Before
       public void init(){
           processService = mock(ProcessService.class);
       }
       @Test
       public void test01(){
           System.out.println(">>>>>>>>>>>>>" + processService.getUserById(1));
       }
   }
   ```


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler] whitelowrie commented on issue #4175: 跑单元测试的时候报错

Posted by GitBox <gi...@apache.org>.
whitelowrie commented on issue #4175:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4175#issuecomment-740350496


   Please use english!!!
   and you can write the test like this before you configured correctly
   
   `@RunWith(SpringJUnit4ClassRunner.class)
   @ContextConfiguration(classes={DependencyConfig.class, SpringApplicationContext.class, SpringZKServer.class,
           NettyExecutorManager.class, ExecutorDispatcher.class, ZookeeperRegistryCenter.class, TaskPriorityQueueConsumer.class,
           ZookeeperNodeManager.class, ZookeeperCachedOperator.class, ZookeeperConfig.class, MasterConfig.class})
   public class MyTest {
   
       @Autowired
       private ProcessService processService = null;
   
       @Test
       public void test01(){
           System.out.println(processService);
       }
   }`
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler] whitelowrie edited a comment on issue #4175: 跑单元测试的时候报错

Posted by GitBox <gi...@apache.org>.
whitelowrie edited a comment on issue #4175:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4175#issuecomment-740350496


   Please use english!!!
   and you can write the test like this before you configured correctly
   
   ```java
   @RunWith(SpringJUnit4ClassRunner.class)
   @ContextConfiguration(classes={DependencyConfig.class, SpringApplicationContext.class, SpringZKServer.class,
           NettyExecutorManager.class, ExecutorDispatcher.class, ZookeeperRegistryCenter.class, TaskPriorityQueueConsumer.class,
           ZookeeperNodeManager.class, ZookeeperCachedOperator.class, ZookeeperConfig.class, MasterConfig.class})
   public class MyTest {
   
       @Autowired
       private ProcessService processService = null;
   
       @Test
       public void test01(){
           System.out.println(processService);
       }
   }
   ```
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler] bingexxx commented on issue #4175: 跑单元测试的时候报错

Posted by GitBox <gi...@apache.org>.
bingexxx commented on issue #4175:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4175#issuecomment-740351625


   OK, thanks


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-dolphinscheduler] CalvinKirs commented on issue #4175: 跑单元测试的时候报错

Posted by GitBox <gi...@apache.org>.
CalvinKirs commented on issue #4175:
URL: https://github.com/apache/incubator-dolphinscheduler/issues/4175#issuecomment-740348368


   This UT is marked with @Ignore. If you are interested, you can refactor it. It is recommended to use the mock form and only test the SqlExecutor method.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org