Skip to content

Commit 36438a1

Browse files
author
Amanda Butler
authored
Remove outdated content from README.md
Remove requested outdated content, and update TOC to reflect changes.
1 parent 8b35bbc commit 36438a1

File tree

1 file changed

+15
-110
lines changed

1 file changed

+15
-110
lines changed
Lines changed: 15 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,21 @@
1-
# Table of Contents
1+
# Table of contents
22

33
* [greentea-client](#greentea-client)
4-
* [mbed-drivers dependencies](#mbed-drivers-dependencies)
5-
* [Greentea test tools](#greentea-test-tools)
6-
* [Compatibility](#compatibility)
7-
* [Greentea support](#greentea-support)
8-
* [utest support](#utest-support)
9-
* [greentea-client support in your module](#greentea-client-support-in-your-module)
10-
* [Terms](#terms)
4+
* [Concepts](#concepts)
115
* [Test suite](#test-suite)
126
* [Test case](#test-case)
137
* [key-value protocol](#key-value-protocol)
14-
* [Where can I use it?](#where-can-i-use-it)
15-
* [Test suite model](#test-suite-model)
16-
* [utest support template](#utest-support-template)
17-
* [No utest support template](#no-utest-support-template)
8+
* [Test example](#test-examplel)
189

1910
# greentea-client
2011

21-
**Tip:** If you are unsure about the terms used in this document, please see the [Terms](#Terms) section.
22-
23-
```greentea-client``` is a C++ client library for [the Greentea test tool](https://github.com/ARMmbed/greentea) when used in an [mbed](www.mbed.com) project.
24-
This package implements the slave side of the simple key-value protocol used for communication between the device under test (DUT) and the host. ```Greentea``` on the host side implements the protocol's master behavior.
12+
`greentea-client` is a client library for [the Greentea test tool](https://github.com/ARMmbed/mbed-os-tools/tree/master/packages/mbed-greentea) when used in an [Mbed OS](https://os.mbed.com/) project.
2513

14+
This package implements the client side of the key-value protocol used for communication between the device under test (DUT) and the host. The `Greentea` tool implements the protocol's host behavior. We use [utest](https://github.com/ARMmbed/mbed-os/blob/master/features/frameworks/utest/README.md) as our test harness.
2615

2716
```
28-
DUT <--- serial port connection ---> host
29-
(slave) . (master)
17+
DUT <--- serial port connection ---> host
18+
(client) . (host)
3019
.
3120
[greentea-client] . [conn_process] [htrun]
3221
===== . ================ =========
@@ -47,91 +36,24 @@ This package implements the slave side of the simple key-value protocol used fo
4736
.
4837
```
4938

50-
## mbed-drivers dependencies
51-
52-
This package was introduced as a future replacement for the [mbed-drivers/test_env.h](https://github.com/ARMmbed/mbed-drivers/blob/master/mbed-drivers/test_env.h) test framework. ```mbed-drivers/test_env.h``` is no longer considered the correct way to write tests for mbed modules.
53-
54-
Examples of test cases ported from the old ```mbed-drivers/test_env``` to the ```greentea-client``` model can be found here:
55-
* [core-util](https://github.com/ARMmbed/core-util/pull/95)
56-
* [ualloc](https://github.com/ARMmbed/ualloc/pull/24)
57-
* [minar](https://github.com/ARMmbed/minar/pull/36)
58-
* [mbed-drivers](https://github.com/ARMmbed/mbed-drivers/pull/165)
59-
* [sal](https://github.com/ARMmbed/sal/pull/46)
60-
* [sockets](https://github.com/ARMmbed/sockets/pull/64)
61-
* [utest](https://github.com/ARMmbed/utest/pull/6)
62-
63-
## Greentea test tools
64-
65-
```Greentea``` is a test automation tool written in Python and designed to automate test execution for [mbed](www.mbed.com) projects.
66-
67-
## Compatibility
68-
69-
```greentea-client``` is compatible with:
70-
* [Greentea](https://github.com/ARMmbed/greentea) v0.2.x onwards
71-
* [htrun](https://github.com/ARMmbed/htrun) v0.2.x onwards
72-
* [utest](https://github.com/ARMmbed/utest) v1.10.0 onwards
73-
* [unity](https://github.com/ARMmbed/utest) v2.0.1 onwards
74-
75-
### Greentea support
76-
77-
If you wish to use ```greentea-client``` please make sure you are using latest ```Greentea``` tools from [PyPI](https://pypi.python.org/pypi/mbed-greentea) (you will need Python 2.7):
78-
```
79-
$ pip install mbed-greentea --upgrade
80-
```
81-
82-
*Note*: If you previously used ```mbed-drivers/test_env.h``` features to write your test cases please downgrade ```Greentea``` to a version lower than ```v0.2.0``` to stay compatible:
83-
```
84-
$ pip install "mbed-greentea<0.2.0" --upgrade
85-
```
86-
87-
*Note*: [Greentea v0.1.x](https://github.com/ARMmbed/greentea/tree/master_v0_1_x) is still developed on a ```master_v0_1_x``` branch. We will only apply critical patches to version 0.1.x, no feature development is planned.
88-
89-
### utest support
90-
91-
```utest``` is our preferred test harness which allows you to execute a series of (asynchronous) C++ test cases. You can read more about utest [here](https://github.com/ARMmbed/mbed-os/blob/master/features/frameworks/utest/README.md).
92-
93-
### greentea-client support in your module
94-
95-
Currently ```greentea-client``` is in on version ```1.0.x```. Please use a ```^1.0.0``` dependency version in your ```module.json``` file.
96-
97-
Example of ```module.json``` file with ```greentea-client``` as a test dependency:
98-
```json
99-
{
100-
"testDependencies": {
101-
"greentea-client": "^1.0.0",
102-
"utest" : "^1.10.0",
103-
"unity" : "^2.1.0"
104-
}
105-
}
106-
```
107-
108-
## Terms
39+
## Concepts
10940

11041
### Test suite
111-
A test suite is a binary containing test cases we execute on hardware. The test suite has a beginning and an end (like your ```main()``` function would. The test suite may pass, fail or be in an error state (for example if test suite times out or there was a serial port connection problem).
11242

113-
### Test case
43+
A test suite is a binary containing test cases we execute on hardware. The test suite has a beginning and an end (like the `main()` function would. The test suite may pass, fail or be in an error state (for example, if the test suite times out or there was a serial port connection problem).
11444

115-
Preferably you will use ```utest``` to define test cases . test case has the beginning and the end. During test case execution you will use ``ùnity``` assert macros, schedule MINAR callbacks, check for timeouts in your code. Your test cases may pass, fail or be in an error state which means something went wrong and we were unable to determine exactly what that was (you may have to check the logs).
45+
### Test case
11646

117-
### key-value protocol
47+
A test case is contained within a test suite. You can have multiple test cases within a test suite. `unity` assert macros are used to run the checks during the test case. Your test cases may pass, fail or be in an error state.
11848

119-
The key-value protocol (also called ```KiVi```) is a simple protocol introduced to the ```Greentea``` test tools. It is used to send simple text messages (events) between the DUT and the host. Each message consists of a _key_ and corresponding _value_ pair.
120-
A ```KiVi``` message is defined as a string encapsulated between double curly braces. The key and value are separated by a semicolon (```;```).
121-
For example: the ```{{timeout;120}}}``` string is a simple key-value message where the key "_timeout_" is associated with the value "_120_". Both ```greentea-client``` and ```Greentea``` understand this format and can detect key-value messages in a data stream. Both _key_ and _value_ are ASCII strings.
122-
This protocol is a master-slave protocol. The host has the role of _master_ and the DUT is the _slave_.
49+
### Key-value protocol
12350

124-
```greentea-client``` implements the key-value protocol tokenizer and parser.
51+
The key-value protocol is a protocol specific to the `Greentea` test tool. It is used to send messages (events) between the DUT and the host. Each message consists of a _key_ and _value_ pair. A message is surrounded by double curly braces. The key and value are separated by a semicolon (`;`).
12552

126-
## Where can I use it?
127-
It is possible to write test cases that use ```greentea-client``` and at the same time support ```mbed``` features such as [MINAR scheduler](https://github.com/ARMmbed/minar). It is also possible to mix ```greentea-client``` with other test tools we use at ```mbed``` such as [utest](https://github.com/ARMmbed/utest) and [unity](https://github.com/ARMmbed/unity).
53+
For example, the `{{timeout;120}}}` string is a key-value message where the key `timeout` has the value `120`. Both `greentea-client` and `Greentea` understand this format and can detect key-value messages in a data stream.
12854

129-
You can also find references to ```greentea-client``` in many ```mbed``` packages. For example:
130-
* [mbed-drivers](https://github.com/ARMmbed/mbed-drivers) - check its [module.json](https://github.com/ARMmbed/mbed-drivers/blob/master/module.json)
131-
* [core-util](https://github.com/ARMmbed/core-util) - check its [module.json](https://github.com/ARMmbed/core-util/blob/master/module.json)
55+
## Test example
13256

133-
# Test suite model
134-
## utest support template
13557
```c++
13658
#include "greentea-client/test_env.h"
13759
#include "utest/utest.h"
@@ -165,20 +87,3 @@ void app_start(int, char*[]) {
16587
Harness::run(specification);
16688
}
16789
```
168-
## No utest support template
169-
```c++
170-
#include "greentea-client/test_env.h"
171-
#include "unity/unity.h"
172-
173-
void app_start(int, char*[]) {
174-
bool result = true;
175-
GREENTEA_SETUP(15, "default_auto");
176-
177-
// Test suite body
178-
// Here you can run your test cases and or assertions
179-
TEST_ASSERT_TRUE(true);
180-
TEST_ASSERT_FALSE(false);
181-
182-
GREENTEA_TESTSUITE_RESULT(result);
183-
}
184-
```

0 commit comments

Comments
 (0)