操作のキャプチャと自動再生

動作

操作をキャプチャ(記録)し、記録した操作を自動的に再生できます。また、Curl言語として操作内容が保存され、カスタマイズすることも可能です。これはテストや自動デモなどで利用することができます。

<記録>

<再生> 

 

バージョン

Curl Advanced UI 0.5

利用方法

現時点では、COM.CURLAP.ADVANCED-UI.TOOLSパッケージをインポートすることで利用できます。また、各コントロールやフレームにはtest-nameというプロパティを持っていますので、一意の名前をセットしてください。(将来的には利用方法が変更となる可能性があります。)

{curl 6.0 applet}
{curl-file-attributes character-encoding = “shift-jis”}
{applet manifest = “manifest.mcurl”}

{import * from COM.CURLAP.ADVANCED-UI.TOOLS}
{import * from COM.CURL.GUI.STYLED-CONTROLS}
{install-style-sheet {manifest-url “file”, “DEFAULT-STYLE-SHEET”}}

{value

    let base-frame:Frame = {Frame test-name = “/base-frame”}

    let frame2:Frame =
        {Frame
            test-name = “/frame2”,
            {spaced-vbox
                test-name = “/frame2/vbox1”,
                width = 5cm,
                {TextField test-name = “/frame2/tf1”},
                {TextField test-name = “/frame2/tf2”},
                {TextField test-name = “/frame2/tf3”}
            }
        }

    let frame1:Frame =
        {Frame
            test-name = “/frame1”,
            {spaced-vbox
                test-name = “/frame1/vbox1”,
                width = 5cm,
                {TextField
                    test-name = “/frame1/vbox1/tf1”
                },

                {TextField
                    test-name = “/frame1/vbox1/tf2”
                },

                {CheckButton
                    test-name = “/frame1/vbox1/cbtn1”
                },

                {ComboBox
                    test-name = “/frame1/vbox1/cb1”,
                    “1234”, “5678”, “aaaaa”
                },

                {spaced-hbox
                    {CommandButton
                        label = “move”,
                        test-name = “/frame1/vbox1/btn1”,
                        {on Action do
                            {base-frame.add frame2, replace? = true}
                        }
                    },

                    {CommandButton
                        label = “popup”,
                        test-name = “/frame1/vbox1/btn2”,
                        {on Action do
                            {popup-message
                                “Succeeded to cancel…”,
                                test-name = “/pop1”,
                                || HACK! test codes.
                                {on e:DialogShow at v:Dialog do
                                    {{UIContext.get-instance}.register v}
                                }
                            }
                        }
                    },

                    {CommandButton
                        label = “view”,
                        test-name = “/frame1/vbox1/btn3”,
                        {on Action do
                            def view =
                                {View
                                    test-name = “/view1”,
                                    width = 2cm, height = 2cm,
                                    {spaced-vbox
                                        {TextField test-name = “/view1/tf1”},
                                        {CommandButton
                                            label = “close”,
                                            test-name = “/view1/btn1”,
                                            {on Action do
                                                {view.close}
                                            }
                                        }
                                    },
                                    || HACK! test codes.
                                    {on e:ViewVisibilityEvent at v:View do
                                        {{UIContext.get-instance}.register v}
                                    }
                                }
                           
                            {view.show}
                        }
                    },

                    {CommandButton
                        label = “dialog”,
                        test-name = “/frame1/vbox1/btn4”,
                        {on Action do
                            def dia  =
                                {Dialog
                                    test-name = “/dia1”,
                                    width = 2cm, height = 2cm,
                                    {spaced-vbox
                                        {TextField test-name = “/dia1/tf1”},
                                        {CommandButton
                                            label = “close”,
                                            test-name = “/dia1/btn1”,
                                            {on Action do
                                                {dia.close “Dialog”}
                                            }
                                        }
                                    },
                                    || HACK! test codes.
                                    {on e:DialogShow at v:Dialog do
                                        {{UIContext.get-instance}.register v}
                                    }
                                }
                            || HACK! if modal? is true, it doesn’t work.
                            {dia.show modal? = false}
                        }
                    }
                }
            }
        }
    {base-frame.add frame1}

    base-frame
}

 

import文に COM.CURLAP.ADVANCED-UI.TOOLSを記述することで、自動的に記録・再生のビューが起動します。このCaptureタブのstartボタンを押下することで記録が開始されます。記録が開始されている時点でメイン画面の操作を行います。操作の記録を終了したい場合は、stopボタンを押下し、記録内容をファイルとして保存します。

ui-motion1.jpg

 

 

 

 

 

 

 

 

 

再度画面を読み込み、testタブのplayボタンを押下し、先ほど保存したファイルを選択いたしますと、先ほどの操作が自動的に実行されます。

ui-motion2.jpg

 

 

 

 

 

 

 

 

注意)
  Curlの仕様により、現バージョンでは、View、Dialog、dcurlに対する記録及び再生を行うことはできません。

当画面を変更したい場合は、直接オープンソースを変更し、改変することができます。(以下がキャプチャされたソースコードです。)

 

||| This following is generated code.
{do
    def handler = {UIMotionHandler.get-instance}

    {handler.sleep 5.788s}
    {handler.handle-event “/frame1/vbox1/tf1”, {FocusIn}}
    {handler.set-value “/frame1/vbox1/tf1”, “12345”}
    {handler.handle-event “/frame1/vbox1/tf1”, {FocusOut}}
    {handler.sleep 4.693s}
    {handler.handle-event “/frame1/vbox1/tf2”, {FocusIn}}
    {handler.set-value “/frame1/vbox1/tf2”, “abcde”}
    {handler.handle-event “/frame1/vbox1/tf2”, {FocusOut}}
    {handler.sleep 1.649s}
    {handler.handle-event “/frame1/vbox1/cbtn1”, {FocusIn}}
    {handler.set-value “/frame1/vbox1/cbtn1”, true}
    {handler.handle-event “/frame1/vbox1/cbtn1”, {FocusOut}}
    {handler.sleep 4.463s}
    {handler.handle-event “/frame1/vbox1/cb1”, {FocusIn}}
    {handler.set-value “/frame1/vbox1/cb1”, “5678”}
    {handler.handle-event “/frame1/vbox1/cb1”, {FocusOut}}
    {handler.sleep 0.897s}
    {handler.handle-event “/frame1/vbox1/btn1”, {Action}}
    {handler.sleep 0s}
    {handler.refresh-context}
    {handler.sleep 7.863s}
    {handler.handle-event “/frame2/tf1”, {FocusIn}}
    {handler.set-value “/frame2/tf1”, “ooooo”}
    {handler.handle-event “/frame2/tf1”, {FocusOut}}
    {handler.sleep 6.049s}
    {handler.handle-event “/frame2/tf2”, {FocusIn}}
    {handler.set-value “/frame2/tf2”, “12341234”}
    {handler.handle-event “/frame2/tf2”, {FocusOut}}
    {handler.sleep 4.447s}
    {handler.handle-event “/frame2/tf3”, {FocusIn}}
    {handler.set-value “/frame2/tf3”, “hohoho”}
    {handler.handle-event “/frame2/tf3”, {FocusOut}}
}

 

サンプル

自動キャプチャ 

関連Curl標準API

TextField
TextArea
DateField