Recipe call arguments that name a data-driven column are not expanded, and the result depends on map order

Đang mở
#886 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
58/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
testing-qa

Hướng nghiên cứu

Start in internal/runner/executor.go at runRecipeCall and resolve, then read the Data-driven page mentioned in the issue. Reproduce the issue with an Executor unit test using row values in e.vars and recipe arguments containing <email> and <password>. Done when recipe arguments are either expanded consistently before binding or the lint and documentation rule is made explicit, with behavior independent of map order.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

What happens

A recipe called from a data-driven test cannot reliably receive the row's columns as call arguments.

recipe "sign in as" (email, password)
  type "<email>" into #email
  type "<password>" into #password

test "role-based access"
  sign in as "<email>" with "<password>"

with examples:
  email               password
  "[email protected]"    "admin123"

runRecipeCall binds each argument's text as it is (internal/runner/executor.go, the loop that calls setVar(param, args[i], ...)), so the parameter email is set to the text <email>. That replaces the row's email, and resolve then finds a variable whose value is its own placeholder and makes no progress: the step types <email> literally.

With parameter names that differ from the columns (recipe "sign in as" (address, secret)), the call binds address to the text <email>. resolve makes one pass over the variables in map order, so whether <address> becomes <email> and then the row's value depends on the order the pass visits address and email.

Measured

In a unit test on Executor (newTestExecutor, the row values set in e.vars, runRecipeCall with the arguments "<email>" and "<password>", then e.resolve("type <address> then <secret>")), 300 runs gave four different results:

With the parameters named like the columns, the result is type <email> every time.

Expected

Either the arguments of a recipe call are expanded (against the row and the other variables) before they are bound, or probe lint and the docs say that a column must not be passed as an argument. The Data-driven page now says the latter, and shows a recipe without parameters that reads the columns directly; that form does not depend on the order.

Found while checking the recipe "log in as" example, which also had a keyword problem (fixed separately).

Ngôn ngữ chính
Go
Star
6
Fork
3
Merge trung bình
6 giờ 28 phút
Pull request đã merge (30 ngày)
362

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của AlphaWaveSystems/flutter-probe

Tất cả issue của AlphaWaveSystems/flutter-probe

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.