Skip to content

Commit

Permalink
Removing Sugar PHPUnit test run
Browse files Browse the repository at this point in the history
Update README to reflect Sugar PHPUnit tests not run as part of build
  • Loading branch information
lschaefer-sugarcrm committed Apr 9, 2018
1 parent 7ae12eb commit 6a0b4b4
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 22 deletions.
48 changes: 33 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ The PackageGenerator is responsible for creating the Professor M Module Loadable
PackageGenerator is functioning as we expect that it would. This stage does NOT test the Module Loadable Package.

The next stage to run is the Run PHPUnit stage. Each job in this stage deploys Sugar, installs the Professor M Module
Loadable Package, runs the PHPUnit tests that Sugar provides, and runs the PHPUnit tests written specifically for our
Professor M Module Loadable Package. Each job in this stage is run against a different combination of Sugar versions
and editions. See
Loadable Package, runs the setup for the PHPUnit tests that Sugar provides, and runs the PHPUnit tests written
specifically for our Professor M Module Loadable Package. Each job in this stage is run against a different combination
of Sugar versions and editions. See
[PHPUnit tests for the Professor M Module Loadable Package](#phpunit-tests-for-the-professor-m-module-loadable-package)
for details.

Expand Down Expand Up @@ -374,10 +374,6 @@ PHPUnit results for PackageGenerator:

![PHPUnit results](images/jenkins-phpunit.png)

PHPUnit results for Sugar:

![PHPUnit results](images/phpunitsugar.png)

PHPUnit results for the Professor M Module Loadable Package:

![PHPUnit results](images/phpunitprofm.png)
Expand Down Expand Up @@ -421,8 +417,8 @@ to run the PHPUnit tests as well as to generate the Professor M module loadable
This script does NOT test the Module Loadable Package.

The next step is to run [SetupEnvAndRunPHPUnitTests.sh](scripts/SetupEnvAndRunPHPUnitTests.sh). This script deploys
Sugar, installs the Professor M Module Loadable Package, runs the PHPUnit tests that Sugar provides, and runs the
PHPUnit tests written specifically for our Professor M Module Loadable Package.
Sugar, installs the Professor M Module Loadable Package, runs the setup for the PHPUnit tests that Sugar provides, and
runs the PHPUnit tests written specifically for our Professor M Module Loadable Package.

Note: if any step in the process fails (for example, a Jasmine test fails), the remaining steps will not be run.

Expand Down Expand Up @@ -630,7 +626,13 @@ The easiest way to run the PHPUnit tests is to run the same scripts that the aut
First, you will need to install [Docker](https://docs.docker.com/install/),
[Docker Compose](https://docs.docker.com/compose/install/#install-compose), and [Perl](https://www.perl.org/get.html).

Then execute [SetupEnvAndRunPHPUnitTests.sh](scripts/SetupEnvAndRunPHPUnitTests.sh).
Then execute [SetupEnvAndRunPHPUnitTests.sh](scripts/SetupEnvAndRunPHPUnitTests.sh). Note that the Sugar provided unit
tests are NOT run as part of [SetupEnvAndRunPHPUnitTests.sh](scripts/SetupEnvAndRunPHPUnitTests.sh). If you want to add
them, add the following line after the call to `SetupSugarPHPUnitTests.sh`:

```
./RunSugarPHPUnitTests.sh $sugarDirectory || exit 1
```

###### Manual execution in an installed version of Sugar

Expand Down Expand Up @@ -677,11 +679,19 @@ $ ../../../../vendor/bin/phpunit
```

##### Automatic execution in Travis CI
The PHPUnit tests are automatically run as part of the Run PHPUnit stage of the Travis CI build.
The PHPUnit tests that test the Professor M Module Loadable Package are automatically run as part of the Run PHPUnit
stage of the Travis CI build.

Each job in this stage is basically the same with the exception of the environment variables. Each job calls
[SetupEnvAndRunPHPUnitTests.sh](scripts/SetupEnvAndRunPHPUnitTests.sh), which executes both the Sugar provided PHPUnit
tests and the Professor M PHPUnit tests.
[SetupEnvAndRunPHPUnitTests.sh](scripts/SetupEnvAndRunPHPUnitTests.sh), which executes the Professor M PHPUnit tests.

Note that the Sugar provided unit tests are NOT run as part of
[SetupEnvAndRunPHPUnitTests.sh](scripts/SetupEnvAndRunPHPUnitTests.sh). If you want to add
them, add the following line after the call to `SetupSugarPHPUnitTests.sh`:

```
./RunSugarPHPUnitTests.sh $sugarDirectory || exit 1
```

#### Interpreting the results
To see the results of the tests that are run as part of the Travis CI build, open the build in Travis CI. If the build
Expand All @@ -707,8 +717,16 @@ If a PHPUnit test fails, you'll see something like the following in the job log.

##### Automatic execution in Jenkins

The PHPUnit tests are automatically run as part of the Jenkins build when
[RunPackUnitTestsAndBuildProfMPackage.sh](scripts/RunPackUnitTestsAndBuildProfMPackage.sh) is executed.
The PHPUnit tests that test the Professor M Module Loadable Package are automatically run as part of the Jenkins build
when [SetupEnvAndRunPHPUnitTests.sh](scripts/SetupEnvAndRunPHPUnitTests.sh) is run.

Note that the Sugar provided unit tests are NOT run as part of
[SetupEnvAndRunPHPUnitTests.sh](scripts/SetupEnvAndRunPHPUnitTests.sh). If you want to add them, add the following line
after the call to `SetupSugarPHPUnitTests.sh`:

```
./RunSugarPHPUnitTests.sh $sugarDirectory || exit 1
```

#### Interpreting the results
To see the results of the tests that are run as part of the Jenkins build, open the build in Jenkins. If the build
Expand Down
Binary file modified images/jenkinsphpunit.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/travisphpunitresults.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 6 additions & 4 deletions scripts/RunPackUnitTestsAndBuildProfMPackage.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
# This script is designed specifically for Jenkins. It runs the Jasmine and PHPUnit tests associated with the Pack
# script. It also builds the Professor M module loadable package.

# If you are running Jenkins in a Docker container and mounting /var/jenkins_home to a directory on your machine's
# local filesystem, you may need to update LOCALWORKSPACEPATH to reflect the path to the Jenkins workspace on your local
# filesystem (for example: "/Users/lschaefer/jenkins/workspace/ProfessorM". The easiest way to update LOCALWORKSPACEPATH
# is to pass in the value as an argument when you call this script.
#If you are running Jenkins in a Docker container and mounting /var/jenkins_home to a directory on your machine's local
# filesystem (for example: /Users/lschaefer/jenkins), you may need to update LOCALWORKSPACEPATH to reflect the path on
# your local filesystem to the Jenkins workspace for your ProfessorM job
# (for example: "/Users/lschaefer/jenkins/workspace/ProfessorM"). The easiest way to update LOCALWORKSPACEPATH is to
# pass in the value as an argument when you call this script.

LOCALWORKSPACEPATH=$1

# Remove any lingering containers from previously failed builds
echo "Removing old containers from previously failed builds. 'No such container' errors can be safely ignored..."
docker rm my-yarn --force || true
docker rm my-composer --force || true

Expand Down
2 changes: 0 additions & 2 deletions scripts/SetupEnvAndRunPHPUnitTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ mkdir workspace

./InstallSugarAndProfM.sh $sugarDirectory || exit 1

./RunSugarPHPUnitTests.sh $sugarDirectory || exit 1

./RunProfMPHPUnitTests.sh $sugarDirectory || exit 1

./StopDockerStack.sh $sugarVersion $sugarDockerDirectory || exit 1
1 change: 0 additions & 1 deletion scripts/SetupSugarPHPUnitTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,4 @@ perl -0777 -i -pe "s#,\n *{\n *\"type\"\: \"composer\",\n *\"url\"\: \"https:\/\
rm $sugarDirectory/composer.lock

# Install the dependencies
#docker exec sugar-web1 composer install
docker exec sugar-web1 bash -c "composer install"

0 comments on commit 6a0b4b4

Please sign in to comment.