Skip to content

Bucky Test Code Reference

rueyaa332266 edited this page Oct 14, 2019 · 8 revisions

Reference and guidelines

These topics describe of the Test Code file format.

The test code file is a YAML file defining, description, device, service, priority, test_category, label, cases and procedures. The path for test code file is WORKING_DIRECTORY/services/SERVICE_NAME/DEVICE/scenario/TEST_CATEGORY/

Test Code file structure and examples

Example Test Code file
desc: suite description
device: pc
service: service_name
priority: high
test_category: e2e
labels: test_label_foo
setup_each:
  procs:
    - proc: login
      exec:
        operate: go
        url: https://example.com/login
teardown_each:
  procs:
    - proc: login
      exec:
        operate: go
        url: https://example.com/logout

cases:
  - case_name: test_code_1
    func: inquire button
    desc: case description
    labels:
      - test_label_bar
      - test_label_baz
    procs:
      - proc: open page
        exec:
          operate: go
          url: http://example.com/
      - proc: open page
        exec:
          verfy: assert_title
          expect: The test page title

・desc

Description for this test suite.

Note: In Bucky test code, we crate one file as one test suite.

・device

The device type which this test code depends to.

Supports Value: "pc", "sp", "tablet"

Note: Namespace structure for test code. Also be used as a filter in run command's option.

・service

The service name which this test code depends to.

Note: Namespace structure for test code. Also be used as a filter in run command's option.

・priority

The priority for this test suite. Also be used as a filter in run command's option.

Supports Value: "high", "middle", "low"

・test_category

The test category which this test code is.

Supports Value: "e2e", "linkstatus"

Note: Namespace structure for test code. Also be used as a filter in run command's option.

・labels

The label for all cases in this suite.

Note: Also be used as a filter in run command's option.

Example:

labels: test_label_foo
labels:
  - test_label_foo
  - test_label_bar

cases configuration reference

There can be multiple cases in one suite. Case level is the smallest level that Bucky can execute.

・case_name

The name of this case. It should be FILE_NAME + "_" + numbers

Note: It will be shown in the console message when test executing.

Example:

case_name: name_of_file_1

・func

The function this case will test.

Example:

func: login

・desc

Description for this case.

Example:

desc: This is the example test for login.

・labels

The label this cases.

Note: Also be used as a filter in run command's option.

Example:

labels: test_label_foo
labels:
  - test_label_foo
  - test_label_bar

・procs configuration reference

There can be multiple procedures in one case.

・proc

This procedure's name.

Note: It will be shown in the console message when test executing.

・exec configuration reference

The execution in this procedure.

The following structure will depend on which operate or verify you choose in the code.

Note: You can check operations list and usage on this page.

Pattern_1

Using Bucky's defined operator

operate: go
url: https://github.com/lifull-dev/bucky-core/
operate: click
page: top_page
part: top_button

Pattern_2

Using Bucky's defined verification

verify: assert_display
page: top_page
part: top_button
verify: assert_text
page: top_page
part: top_button
text: 'text of button element'

Pattern_3

Using customization operator or verification define by yourself

operate: input_and_login
page: top_page
name: 'foo'
eamil: 'bar'
verify: assert_very_text
page: top_page
name_value: 'foo'
email_value: 'bar'

setup_each configuration reference

The procedures executed before every cases.

Note: The structure is same as the procs configuration reference

teardown_each configuration reference

The procedures executed after every cases.

Note: The structure is same as the procs configuration reference