Support > Wagby Developer Network(R8) > E2E test > What is Wagby Testing Framework

Wagby Testing Framework (WTF) is a framework for creating E2E (End to End) tests with Wagby.

The E2E (End to End) test is to confirm that the entire system operates correctly.Specifically, it means "to confirm that the operation is as expected by the screen operation (Web browser operation) by the user".

The E2E test is carried out in the "comprehensive test" phase.(*1)

On many development sites, E2E tests are conducted manually based on test specifications.Therefore, reducing the number of testing steps has become a big issue.Furthermore, it took time and effort to correct the program (model definition in Wagby) and to update it every time when upgrading the environment.

The Wagby Testing Framework (WTF) provides a framework for developing a "test program" for this E2E test.This can be used as a regression test, which can reduce the maintenance cost.

Wagby does not need "unit test", but "comprehensive test" is necessary to check if it operates as specified.(*2)
This document refers to this as the E2E test.
1. We sometimes call "integration test" or "system test".
2. Unit test of the customization code part is necessary.
  1. Set Wagby to Elipse.Please make it possible to start and stop wagbyapp (Tomcat) from Eclipse.
  2. WTF is for Google Chrome only.Get chromedriver for Google Chrome from https://sites.google.com/a/chromium.org/chromedriver/downloads.(*1)
  3. After downloading chromedriver_win32.zip (for Windows), unzip it and save chromedriver.exe directly under the customize folder in the Wagby installation folder.
    Figure 1 Placement of chromedriver
1. Please make sure that WebDriver matches the version of the browser on which the test is executed.
Also, if your browser version goes up, please update WebDriver as necessary.

When running tests in multiple development environments

WebDriver needs to use something appropriate for the browser burning.

If you run tests in different development environments, it may be preferable to exclude WebDriver from the version control system. In that case, please change the location of the WebDriver file directly under the Wagby installation folder (not in the customize folder) and obtain it individually according to the development environment.

Create CustomerTest class

Here is an example of preparing the CustomerTest class as a test to the "customer" model.

In Eclipse, make the following settings.

  • Open "File> New> Other> Java> Junit> JUnit Test Case".
  • Set the source folder to "Wagby - 7.12.1/customize/test/java".
  • Let's say "jp.jasminesoft.wagby.tests.customer" package.
  • Let the name be "CustomerTest".
  • Check setUpBeforeClass (), tearDownAfterClass ().
Figure 2 Creating the CustomerTest class

An empty CustomerTest class is provided.

Figure 3 Empty CustomerTest class

Let's create the first test code.

package jp.jasminesoft.wagby.test.customer;

import static org.junit.Assert.*;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
import com.codeborne.selenide.Configuration;
import static com.codeborne.selenide.Condition.*;
import static com.codeborne.selenide.Selenide.*;
import static jp.jasminesoft.jfc.test.support.selenide.Operations.*;
import static org.hamcrest.CoreMatchers.*;

public class CustomerTest {
    @BeforeClass
    public static void setUpBeforeClass() throws Exception {
        Configuration.baseUrl = "http://localhost:8921/wagby";
        Configuration.browser = "chrome";// 利用するブラウザ
        // Selenium(WebDriver) 用ドライバファイル
        System.setProperty("webdriver.chrome.driver","customize/chromedriver.exe");
    }

    @AfterClass
    public static void tearDownAfterClass() throws Exception {
    }

    @Test
    public void test() {
        // ログオン
        logon("admin", "admin");
        // メニュー画面が表示されていることを確認
        pageTitle().shouldHave(exactText("メニュー"));

        // ログオフ
        logoff();
        // ログオン画面が表示されていることを確認
        assertThat(title(), is("Wagby アプリケーション ログオン"));
    }
}
Figure 4 First test code
  • We are placing chromedriver.exe in the customize folder.
  • In the setUpBeforeClass () method, implement the settings for the development environment.
  • Write test contents in test () method.

Execution

Introduction Launch the Wagby application from the WagbyDesigner build tab.

Figure 5 Launching the application (Tomcat)

After starting, execute "execute> execute (S)> JUnit test" from the menu.
The browser (Google Chrome) will start up and auto test will be done.

Confirmation of test result

Please check the results in Junit view of Eclipse.

Figure 6 Confirm results