简体   繁体   English

适用于Swing应用程序的Junit测试用例

[英]Junit test cases for Swing application

I,m new to JUnit and Swing its possible to write JUnit test cases for Swing applications especially for ActionListeners which represents like below... 我是JUnit和Swing的新手,可以为Swing应用程序编写JUnit测试用例,特别是ActionListeners,如下所示......

public class sampleFile extends JFrame{
    JTextField userText = new JTextField(15);
    JLabel lable;
        JTextField name;
        JPanel panel;
    JButton submit;
        JFrame frame;
     sampFile(){
        lable.setBounds(60, 200, 200, 30);
        text.setBounds(130, 200, 165, 25);
        panel.add(text);
        panel.add(text);
        frame.add(panel);
        submit.addActionListener(e -> sendActionPerfrm())
     }
     private void sendActionPerfrm(){
      -------------
        All validations for the text from textfield goes here  
      -----------  
    }

Thanks in Advance 提前致谢

Note: I work for Jalian Systems that maintains Marathon 注意:我为维护Marathon的Jalian Systems工作

You can use marathon java driver which provides webdriver bindings for testing Swing and FX applications. 您可以使用marathon java驱动程序 ,它提供用于测试Swing和FX应用程序的webdriver绑定。 This blog article provides step by step instructions. 博客文章提供了分步说明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM