Goal
Create a test folder that includes a test to validate that an external user can login, start the service Register a Super hero, enter text on a field and validate the service name.
Starting code
Pre-requisite: Basic understanding of BDD. If very new to BDD please read BDD 101
Start tag: lesson/02 (We start from this lesson because we are working for an already develop service) (Configurators can use lesson/01)
Steps
We want to automate a simple form that contains 1 input field, 1 service title.
Starting point (Login)

Entry point (menu item)
Once you login into the super-heroes app. you’ll notice a menu item for ‘Register Super Hero’ (2) under the ‘Do it Online’ menu (1) as shown in Fig 1.1 below.

Fig 1.1 “Register Super Hero” menu item.
Form
Once we open the form we can see a few items.
- Register a Super Hero service title
- Super Hero Name text field

At any point on time you can support your automated tests using the test recorder
Hands on
Let’s open Magellan and once Magellan is open, the first step is to create a new folder for the tests. Right click over heroes and select New > Resource

Select the following options
- Type: Test file
- Path:/tests/hercules/tests/H001
- HappyPath
Press button Create

A new folder will be created with the File HappyPath.feature

First automation
Now that we have the test resource created we want to write the scenario description and automate Login, Start service, Validate the service title, enter text on a field and validate the value of the field. For the scenario, we are going to use 1 Scenario description + 5 steps definitions
If you don’t know what step to use you can always bring the list of steps using CONTROL+SPACE before start writing.
Scenario Name: The scenario name must be short and descriptive of what needs to be achieved.
Scenario: Automate Register a Super Hero and enter text on a field

Set application: This step is always the first step for any scenario as it provides the relevant context to Magellan. It enables Magellan to start the browser on a specific URL when running in UI mode and will setup the app to run on the proper application when running the test in config mode.
Given I set application to heroes

Logon: The list of users to use for superheroes can be found at external_users.csv (Press CONTROL+SHIFT+N in Magellan and search the file). The example below is just a general example.
When I logon as External01@fostermoore.com with password External01

Click menu: To start the service we need to click 2 menus
Then I click menu Online Services
And I click menu Register a Super Hero

Expect service title: We are going to use expect step.
Then I expect service-title Register a Super Hero

All the expects can be targeted using as guidance the UX guide
Enter text and Validate the value : 2 steps required for this
When I enter text Test123Thefield in Super Hero Name
Then I expect Super Hero Name to have value Test123Thefield
Once all the steps are entered will look like

Scenario: Automate Register a Super Hero and enter text on a field
Given I set application to heroes
When I logon as External01@fostermoore.com with password External01
Then I click menu Online Services
And I click menu Register a super hero
Then I expect service-title Register a Super Hero
When I enter text Test123Thefield in Super Hero Name
Then I expect Super Hero Name to have value Test123Thefield
Ride-on!
Now that writing the test is complete we have to execute the test. To execute the test there are 2 options:
- Right click on the file and select one of the run options

- Right click over the test editor and select run by scenario or run the test. The scenario run can execute only the scenario that is highlighted.

Difference between the test modes
Like any automation tool Magellan provides different test modes to run tests. The different test modes are explained at Test Modes. The most important thing to understand about config/UI is that config mode is designed to test the application at a lower level, Tests run in config mode are designed to test the config and do not have the capability to know how the finished UI looks, however they will have the capability to test the data that is saved etc. They also run an order of magnitude quicker than the same tests run in UI mode.
Give a try on config mode vs UI mode.
Recap
While we didn’t go too deep into automation we learned a few things:
- External Users are located under external_users.csv.
- Elements are identified using the label of the element on the screen. No extra element identification is needed using id or xpaths or css selectors as with other tools such as Selenium.
- Expect’s can target the element using the right class.
- Users can run a test using different browsers and as a unit test using the config mode.
- Basic BDD overview – feature, scenario, step definitions

