Automating Environment Testing with GitHub, Selenium, and ProcessMaker
Blog: ProcessMaker Blog
An often neglected component of the entire software development cycle is how application test environments are managed. Prior to the release of any new versions, several test cases must be executed as standing operating procedure.
Yet, many teams still spend hours – even days – manually building and breaking down their test environments. Invariably, a crucial aspect of making sure your customers are happy is ensuring the software works within their associated environment. The time taken to test environments manually adds up to an exorbitant waste of time.
So then, what’s the solution? An automated testing environment allows teams to test their applications within a matter of a few clicks. You can reduce the overall test time and the required number of human workers. Further, you can quickly modify preconditions and input to re-run the tests with multiple data sets. As a result, QA teams can truly avoid configuring, maintaining, and tearing down environments manually.
While manual testing isn’t necessarily dead, and will be needed for unique types of testing, it can also significantly slow down the delivery process. In a continuous environment, manual testing is painful. With this sluggish process, it then takes much longer for software releases.
On the other hand, automation helps to accelerate the cycle by running tests continuously and offering adjustment feedback within a matter of minutes. This is why the testing process should be automated as much as possible. If you don’t test your code regularly, it becomes even more difficult to fix bugs. Waiting days between builds can quickly stall projects even before they get to testing.
Enter Operation Trogdor
Trogdor is the internal codename of a project to automate testing through the use of GitHub, Selenium, and ProcessMaker 4. It was designed to run a series of automated Selenium tests which are stored as Python files in GitHub and then executed through a workflow designed in ProcessMaker 4.
When we talk about automating testing, Selenium is what we have chosen because it is one of the best open-source tools out there – beloved by developers throughout the world. With Selenium, you can automate every task in your browser. In addition, it supports Chrome, Firefox, Safari, IE, and Mozilla. With Trogdor, you can easily automate tests within your ProcessMaker 4 environment.
Support is extended through many of the most popular operating systems such as Windows, Linux, UNIX, Mac OS, and more. Trogdor offers a user-friendly interface which facilitates the ability to test and monitor tests effectively. You can also review detailed reports with the intention of deploying follow-up tasks.
Unquestionably, flexibility is key to test management. Trogdor makes it easy to regroup and refactor test cases so that you can improve maintainability while decreasing complexity and duplication. With Trogdor’s easy-to-use tools, you can reduce testing execution time and even run several tests in parallel.
Using Trogdor, Selenium tests are pulled from the code repository and executed through a script task in ProcessMaker 4 which funnels the test through a Selenium Docker image and then stores the results of the test in the Request.
To illustrate, Trogdor can be configured to execute follow-up actions based on the test results. If tests succeed, then a new tenant (workspace) environment is created. Although, rollback actions can be taken if there is a failure with a tenant upgrade. On the other hand, if there aren’t any further automated tasks, the Email Summary Screen serves as the last line of defense for manual inspection.
In fact, you can test not only ProcessMaker 4 environments, but also any custom application deliverable for consumers. You get flexibility in complex workflows and the ability to scale and fire off tests on demand. Now that you have so much time saved, you can focus on developing new applications.
There is an opportunity to utilize ProcessMaker 4 for the execution of a test suite because of its flexibility in complex workflows and the ability to scale and fire off tests on demand.
Process execution via API
Because Process execution can occur through API calls, the usage of ProcessMaker 4 can sit alongside CI/CD pipelines. If an environment is deployed or upgraded, the CI/CD pipeline can execute a REST API call against the ProcessMaker 4 system to begin executing a test suite based on the API call request payload.
Using a CI/CD process you get faster issue closures because you have faster bug identification and fixes. Also, test planning and execution is maintained consistently. Technical skills are not required. Deployment is easier and faster with almost no downtime. Higher quality applications can be created because you have more time to focus on usability, security, exploratory, and performance testing. Continuous feedback improves overall quality, as well.
Sub process execution
A simple process can be designed to execute one single selenium test and return the result. A test suite can be a parent process which loops through execution of a defined test suite and performs more complex workflow decisions based on the results.
At its core, the Trogdor workflow engine is highly customizable. You can track testing with complete transparency. Some of the benefits include the following:
- Better test efficiency
- Decreased maintenance costs
- Optimized test coverage
- Little manual intervention needed
- Code reusability
- Test automation expertise is not necessary
Containerized selenium based testing with script tasks
Script Tasks run in Docker containers for the lifecycle of that script. We can leverage Selenium’s docker image in order to execute a test with sandboxed isolation. We can also customize the docker image to inherit from the selenium base image and then provide scaffolding to load the test and execute it which returns the results in a proper JSON format that ProcessMaker expects.
Why does Trogdor like JSON? Well, for starters, JSON is more readable and compact than XML, making it easier to work with complex systems. Since JSON uses less data than XML, software parsing is much faster. JSON also makes it easier to time map to domain objects. JSON’s map-data structure is also easy to understand. Additionally, JSON ensures the matching of objects and codes.
Execution of test suites are done on-demand and can be configured as a single environment deployment or large scale (multiple environment upgrades). You can easily scale out test suite execution by utilizing ProcessMaker 4’s autoscaling infrastructure.
Storing test suites as code
The intent is to store the definition of a test suite as a JSON file in a GitHub code repository. The JSON file will define the tests to execute with each test being stored in the code repository as well. This utilization of git code repositories to store test suites allows us to leverage branching and other git characteristics to control and manage test suites. This also allows the use of executing said tests, without the use of ProcessMaker 4, locally for development and debugging purposes.
So why do we use GitHub? Honestly, because GitHub’s wiki and issue tracker gives us the feedback and in-depth documentation we require. Further, you can track revisions across multiple versions. Moreover, in terms of version control, we love Git’s branching capabilities. Through the branching features, you can work in an isolated environment for every change you need to make to your codebase. Since GitHub uses a distributed version control system, every person working on the same project can have their entire history saved in their own localized repository. Further, if two contributors make changes to the same file, GitHub will intelligently combine the modifications. It’s also quite easy to revert back to a specific version. Overall, it enables a faster release cycle and GitHub works seamlessly with CI/CD environments.
When selecting an automated testing tool, you should look for one that is agile and offers support for a large range of languages and applications. This will enable your team to contribute to your testing cycles without the need for technical skill sets.
The post Automating Environment Testing with GitHub, Selenium, and ProcessMaker appeared first on ProcessMaker.