1

Web GUI アプリケーションのさまざまな機能の UI レイテンシを測定する必要があります。

たとえば、ログイン操作のレイテンシを測定するには

1) ユーザー名、パスワードを入力します。

2) ログインボタンをクリック

3) ログインボタンをクリックしてからログイン操作が完了するまでの時間を測定します。

私が考えたより良い計測器は、Selenium Grid2、Webdriver、TestNG です。以下は、ログイン テストのサンプル コードです。

    @Test
    public void testLogin() throws InterruptedException {
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("username"))).sendKeys("admin");
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("password"))).sendKeys("admin");
    }

    @Test
    public void testLoginPerf() throws InterruptedException {
        webDriver.findElement(By.className("login-button")).click();
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.className("logout-button")));
    }

テストは正常に実行され、レポートには実行時間が表示されます。

テスト testLoginPerf() の実行時間は、UI レイテンシの正確な値を教えてくれますか? これを測定するより良い方法はありますか?

4

2 に答える 2

2

dynatrace をチェックしてください。ただし、探しているもの以上のものかどうかはわかりません

https://apmcommunity.compuware.com/community/display/PUB/How+to+include+dynaTrace+in+your+Selenium+Tests

于 2013-07-01T20:18:45.843 に答える
1

クリック後にUIがログアウトボタンを表示するのに必要な時間を測定する場合は、次のことを行います。

@Test
    public void testLoginPerf() throws InterruptedException {
        webDriver.findElement(By.className("login-button")).click();
        long start = System.currentTimeMilis();
        wait.until(ExpectedConditions.visibilityOfElementLocated(By.className("logout-button")));
        long end = System.currentTimeMilis();
        System.out.println("Time: " + (end - start) + " ms);
    }

また、待機オブジェクトの sleepInMillis を十分に小さく設定して、測定を正確にすることを忘れないでください。

于 2013-07-01T18:48:16.730 に答える