As mentioned in The Ins and Outs of Test Automation - Part I, Flame is an AI-augmented test automation platform, with the capacity to test web, mobile and API applications. Flame enables testers to automate their workflows and run them repeatedly, saving time and money.
For training and beta testing purposes, once you are subscribed to our software, you will be able to access our test instance along with your own login credentials. Flame is an enterprise-grade self-service based platform which means that you will be able to set up new projects, add new testers, as well as schedule and conduct automated testing. You can also set up Slack or Teams notifications from Flame Settings itself.
In this article, we are looking at how to run a simple automated web test using Flame.
Here is how you can automate simple test cases which will carry out a google search!
1. Create a YAML file.
First, we construct a YAML file that contains the instructions that you want to pass to Flame, in order to conduct the testing. Note that the title of this YAML file is the title of the test as shown on Flame. The YAML script given in Script 1 allows you to google "Hello world"
description: Googling
actors:
- actor: ACTOR
segments:
- segment: 1
actions:
- description: Navigate to google,com
action: org.flame.selenium.NavigateTo
args:
url: https://www.google.com/
- description: Type in the search bar.
action: org.flame.selenium.SendKeys
args:
locator : {name : q }
text : Hello World
sendEnter: true
Script 1: Test script for googling 'Hello World' using Flame.
If you compare script 1 to script 2, which conducts the same testing through Java, you can see that script 1 is much simpler and easier to comprehend. Script 1 also does not involve any code.
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.WebDriverWait;
public static void main(String[] args) {
WebDriver driver = new FirefoxDriver();
driver.get("http://www.google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("Hello World\n");
element.submit();
WebElement myDynamicElement = (new WebDriverWait(driver, 10)) .until(ExpectedConditions.presenceOfElementLocated(By.id("resultStats")));}
Script 2: Test script for googling 'Hello World' using Java.
2. Upload the YAML file to the server.
Here we upload our YAML file to the Flame server. This process would be described in detail in The Ins and Outs of Test Automation - Part III. Once this is done, our test script would be available to your project within your test instance.
3. Integrate Flame with Slack or Teams (Optional)
From the notification tab in Flame, we can set up a webhook to our Slack or Teams workspace. This allows us to receive Slack/Teams notifications that contain the details of the tests being conducted on Flame. The notifications interface is shown in Figure 1.
Figure 1: The notifications section of Flame, used to setup webhooks to generate Slack and/or Teams notifications.
3. Run the test.
Now we go to the executions tab on Flame. This tab is shown in Figure 2. Then we select the create option to generate a new test suite that contains our google search test script.
Figure 2: The executions section of Flame, used to create new test suits and analyse the results of completed tests.
Clicking the create button opens up the content box shown in Figure 3. Here we can give a label to our test instance, set the number of iterations and set the environment for our test. Then we select our test script from the list given and press the start button to begin running the test.
Figure 3: The creation of a new test suite in Flame.
4. Wait for the test to run.
Figure 4: Pending screen and Completed screen on Flame.
While we wait for our test to complete Flame will show our test as pending. When it is completed, we will see the rest result change from pending to passed/failed. If there were multiple tests in our test suit, they all will appear under the Test column. At any point during the testing, we are allowed to cancel the testing using the cancel button.
Video 1: Running the automated test
.
5. Analyse the results.
Once the test has finished, we can analyse the results obtained. Flame gives us the test outcomes, a log of activities, as well as test statistics. We are also given an error analysis which tells us the root cause of any error present, along with a failure summary. If we have a slack webhook set up, notifications similar to the ones shown in Figure 6 would also be given during the test run.
Figure 5: Test outcome
Figure 6: The slack notifications given while running our test suite.
This concludes our web testing! As you can see, it required no code, and was really very simple to understand. That is the advantage of using Flame for test automation. It does not require you to understand Java or any other languages. Neither do you have to interact directly with Selenium!
I hope you've enjoyed reading this article! In The Ins and Outs of Test Automation - Part II|, I will describe the process of adding your YAML test scripts to the Flame server. Later on, we will see how to conduct Mobile and API testing on Flame.
Comments