Skip to content

Commit f144497

Browse files
alaahongharsha509
andauthored
Add Chinese translation of "domain_specific_language" (#348) [deploy site]
- guidelines_and_recommendations/domain_specific_language.zh-cn.md Co-authored-by: Sri Harsha <Harsha509@users.noreply.github.com>
1 parent 946d0c0 commit f144497

File tree

1 file changed

+34
-45
lines changed

1 file changed

+34
-45
lines changed
Lines changed: 34 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,39 @@
11
---
2-
title: "Domain specific language"
2+
title: "领域特定语言"
33
weight: 2
44
---
55

6-
{{% notice info %}}
7-
<i class="fas fa-language"></i> 页面需要从英语翻译为简体中文。
8-
您熟悉英语与简体中文吗?帮助我们翻译它,通过 pull requests 给我们!
9-
{{% /notice %}}
106

11-
A domain specific language (DSL) is a system which provides the user with
12-
an expressive means of solving a problem. It allows a user to
13-
interact with the system on their terms – not just programmer-speak.
7+
领域特定语言 (DSL) 是一种为用户提供解决问题的表达方式的系统.
8+
它使用户可以按照自己的术语与系统进行交互, 而不仅仅是通过程序员的语言.
149

15-
Your users, in general, do not care how your site looks. They do not
16-
care about the decoration, animations, or graphics. They
17-
want to use your system to push their new employees through the
18-
process with minimal difficulty; they want to book travel to Alaska;
19-
they want to configure and buy unicorns at a discount. Your job as
20-
tester is to come as close as you can to “capturing” this mind-set.
21-
With that in mind, we set about “modeling” the application you are
22-
working on, such that the test scripts (the user's only pre-release
23-
proxy) “speak” for, and represent the user.
10+
您的用户通常并不关心您网站的外观.
11+
他们不在乎装饰, 动画或图形.
12+
他们希望借助于您的系统, 以最小的难度使新员工融入整个流程;
13+
他们想预订去阿拉斯加的旅行;
14+
他们想以折扣价配置和购买独角兽.
15+
您作为测试人员的工作应尽可能接近"捕捉”这种思维定势.
16+
考虑到这一点, 我们开始着手"建模”您正在工作的应用程序,
17+
以使测试脚本 (发布前用户仅有的代理) "说话”并代表用户.
2418

25-
With Selenium, DSL is usually represented by methods, written to make
26-
the API simple and readable – they enable a report between the
27-
developers and the stakeholders (users, product owners, business
28-
intelligence specialists, etc.).
2919

30-
## Benefits
20+
在Selenium中, DSL通常由方法表示,
21+
其编写方式使API简单易读-它们使开发人员和干系人
22+
(用户, 产品负责人, 商业智能专家等) 之间能够产生汇报.
23+
24+
25+
## 好处
3126

32-
* **Readable:** Business stakeholders can understand it.
33-
* **Writable:** Easy to write, avoids unnecessary duplication.
34-
* **Extensible:** Functionality can (reasonably) be added
35-
without breaking contracts and existing functionality.
36-
* **Maintainable:** By leaving the implementation details out of test
37-
cases, you are well-insulated against changes to the AUT*.
27+
* **可读:** 业务关系人可以理解.
28+
* **可写:** 易于编写, 避免不必要的重复.
29+
* **可扩展:** 可以 (合理地) 添加功能而无需打破约定以及现有功能.
30+
* **可维护:** 通过将实现细节排除在测试用例之外, 您可以很好地隔离 AUT* 的修改.
3831

3932

4033
## Java
4134

42-
Here is an example of a reasonable DSL method in Java.
43-
For brevity's sake, it assumes the `driver` object is pre-defined
44-
and available to the method.
35+
以下是Java中合理的DSL方法的示例.
36+
为简便起见, 假定 `driver` 对象是预定义的并且可用于该方法.
4537

4638
```java
4739
/**
@@ -68,11 +60,10 @@ public AccountPage loginAsUser(String username, String password) {
6860
}
6961
```
7062

71-
This method completely abstracts the concepts of input fields,
72-
buttons, clicking, and even pages from your test code. Using this
73-
approach, all a tester has to do is call this method. This gives
74-
you a maintenance advantage: if the login fields ever changed, you
75-
would only ever have to change this method - not your tests.
63+
此方法完全从测试代码中抽象出输入字段, 按钮, 单击甚至页面的概念.
64+
使用这种方法, 测试人员要做的就是调用此方法.
65+
这给您带来了维护方面的优势: 如果登录字段曾经更改过,
66+
则只需更改此方法-而非您的测试.
7667

7768
```java
7869
public void loginTest() {
@@ -89,14 +80,12 @@ public void loginTest() {
8980
}
9081
```
9182

92-
It bears repeating: one of your primary goals should be writing an
93-
API that allows your tests to address **the problem at hand, and NOT
94-
the problem of the UI**. The UI is a secondary concern for your
95-
users – they do not care about the UI, they just want to get their job
96-
done. Your test scripts should read like a laundry list of things
97-
the user wants to DO, and the things they want to KNOW. The tests
98-
should not concern themselves with HOW the UI requires you to go
99-
about it.
10083

101-
***AUT**: Application under test
84+
郑重强调: 您的主要目标之一应该是编写一个API,
85+
该API允许您的测试解决 **当前的问题, 而不是UI的问题**.
86+
用户界面是用户的次要问题–用户并不关心用户界面, 他们只是想完成工作.
87+
您的测试脚本应该像用户希望做的事情以及他们想知道的事情的完整清单那样易于阅读.
88+
测试不应该考虑UI如何要求您去做.
89+
90+
***AUT**: 待测系统
10291

0 commit comments

Comments
 (0)