Skip to content

Commit a4885b1

Browse files
committed
add testing documentation
1 parent c3d3714 commit a4885b1

File tree

10 files changed

+162
-0
lines changed

10 files changed

+162
-0
lines changed

docs/testing/automated/concepts.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
Concepts
6+
=============
7+
8+
For Joomla! we are using different strategies to test the application.
9+
10+
# System Testing versus Unit Testing
11+
12+
System Testing and Unit Testing are complementary test strategies. In Joomla!, Unit Testing is mainly used to test the framework classes (for example, the classes in libraries/joomla). Unit tests test that an individual method (also known as function) in a class does what it is supposed to do. For example, a unit test is used to test that the methods in the JString class work as expected. Unit testing provides confidence that the framework classes work as expected and allows you to refactor these classes (improve the code without changing the functionality) and still have confidence that they still work correctly.
13+
14+
System tests test that the application works correctly from the user point of view. For example, a system test can test something simple, for example, that you can create a new menu item for a single article and show the menu item on the site. Or a system test can test something more detailed, for example that the parameters for a module all work as expected.
15+
16+
Designing and creating system tests requires that you know how to use the application. It does not require that you understand how the program is written. Application knowledge is more important than programming knowledge, so system tests can be designed and written by people with less technical knowledge of PHP or the Joomla! framework.

docs/testing/automated/index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
Automated Testing
6+
=============
7+
8+
Here you will find information about our automated testing, how to write tests and how to set it up.
192 KB
Loading
470 KB
Loading
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
5+
6+
System Testing
7+
===============
8+
9+
We are using [Cypress](https://docs.cypress.io/guides/overview/why-cypress) for our system (end2end testing).
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
6+
Setup your testing environment
7+
===============
8+
9+
## Prepare your Workstation
10+
11+
You need a set of tools to have a good testing setup. Tools you should have:
12+
13+
* git
14+
* node (16.16.0 is the current LTS)
15+
* database (mysql 5.6+, mariaDB 10.1+, postgres 11.0+)
16+
* PHP (good to have different versions and the ability to switch)
17+
* Composer, [Installation instructions here](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-macos)
18+
* Webserver (apache 2.4+, nginx 1.18+)
19+
* Editor (PhpStorm, Visual Studio Code)
20+
21+
22+
## MAC OS
23+
24+
As always there are different ways of installing the listed software. One way is the use of [Valet](https://laravel.com/docs/9.x/valet) in combination with [Homebrew](https://brew.sh/)
25+
26+
Now as you have all tools installed you can clone the [joomla-cms repository](https://github.com/joomla/joomla-cms).
27+
28+
1. Open a terminal
29+
2. Go into a directory on you workstation.
30+
3. clone the joomla-cms repository: ```git clone https://github.com/joomla/joomla-cms.git``` another option here is to fork the joomla-cms repo and then clone your fork. We recommend the 2nd way because then you can make changes and Pull Request directly.
31+
4. Go into the joomla-cms directory
32+
5. If you have installed valet, run ```valet link```
33+
5. Run ```composer install```
34+
6. Run ```npm ci```
35+
7. Create a ```cypress.env.json``` file. This file allows to overwrite config setting from ```cypress.config.js```
36+
37+
Here is a example ```cypress.env.json```
38+
39+
```json
40+
{
41+
"sitename": "Joomla CMS Test Local",
42+
"name": "jane doe",
43+
"email": "[email protected]",
44+
"username": "local-admin",
45+
"password": "joomla-17082005",
46+
"db_type": "MySQLi",
47+
"db_host": "localhost",
48+
"db_name": "test_joomla",
49+
"db_user": "root",
50+
"db_password": "password",
51+
"db_prefix": "jos_"
52+
}
53+
```
54+
You don't need all settings, just look what you have to change for your local environment compared to ```cypress.config.js```
55+
56+
8. Run ```cypress open --e2e --browser=chrome --config baseUrl=http://joomla-cms.test```
57+
58+
This will open two windows, one you can ignore and one to run the tests
59+
60+
61+
![Cypress Window 1](./assets/cypress-window1.jpg)
62+
63+
In the following window you can select test and let them run. You need to install first.
64+
65+
![Cypress Window 2](./assets/cypress-window2.jpg)
66+
67+
68+
## Windows
69+
70+
71+
72+
73+
:::caution TODO
74+
75+
This page is unfinished, please use the **Edit this Page** link at the bottom of this page to help make it more useful.
76+
77+
:::
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
5+
6+
Writing Tests
7+
===============
8+
9+
10+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
sidebar_position: 3
3+
---
4+
5+
6+
Unit Testing
7+
===============
8+
9+
:::caution TODO
10+
11+
This page is unfinished, please use the **Edit this Page** link at the bottom of this page to help make it more useful.
12+
13+
:::

docs/testing/index.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
sidebar_position: 10
3+
---
4+
5+
Testing
6+
=============
7+
8+
# Overview
9+
10+
Testing Software is an important part of software development. For Joomla! we have different levels of testing:
11+
12+
## Automated Testing
13+
14+
For the automated testing we are using a continus integration (CI) server drone. Any change that is made runs a series of tests on the CI system. We test if the code style for PHP, CSS and javascript is correct, run unit test for the supported PHP versions and run end to end tests. All this not only runs on different PHP version we are also testing different database version. At the end of the test we create an installable package with the changes included to support our manually testing. If something fails we save information about the reason.
15+
16+
## Manually Testing
17+
While automated testing is more focused on making sure that a change doesn't break existing functionality, is manually testing focused on the change itself. Always tow people have to confirm that a change does for what is made. This can be a bugfix or new functionality.

docs/testing/manually/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
sidebar_position: 2
3+
---
4+
5+
Manually Testing
6+
=============
7+
8+
:::caution TODO
9+
10+
This page is unfinished, please use the **Edit this Page** link at the bottom of this page to help make it more useful.
11+
12+
:::

0 commit comments

Comments
 (0)