Products

Solutions

Learn More

Partners

Community

Blog

About

The Community Blog is a personal opinion of community members and by no means the official standpoint of DNN Corp or DNN Platform. This is a place to express personal thoughts about DNNPlatform, the community and its ecosystem. Do you have useful information that you would like to share with the DNN Community in a featured article or blog? If so, please contact .

The use of the Community Blog is covered by our Community Blog Guidelines - please read before commenting or posting.


DNN Automation Testing with F# (ATFS) – Part 3

Writing Your Own ATFS Tests

 

Introduction

In the first two articles, I explained the basics of ATFS and how to use it to run all existing or specific UI tests. In this article, I’ll show you how to write your own UI tests.

Prerequisites

You need to have followed the previous two articles to get yourself familiar with the framework and its configuration file. The articles were published here https://www.dnnsoftware.com/community-blog/cid/155462/dnn-automation-ui-testing-with-f-atfs--part-1 and here https://www.dnnsoftware.com/community-blog/cid/155463/dnn-automation-testing-with-f-atfs-part-2.

Before proceeding, you need to revert any changes made to the framework you downloaded from Github or to start with a clean clone of the repository.

Writing Your First UI Test

Now let's get to the real work of writing our own tests. Let's start with a simple test to check whether a specific text is displayed in at the home page or not. We will to add the test under P1 Community area (folder).

Step 1

Open the solution in Visual Studio and browse to the ATFS project. Expand the project
“<project-name>/TestCases/Community” node, right click the mouse over the "Community" folder, select “Add | New Item …” then click. In the dialog that opens select F# files, source file, then enter a descriptive name for your test suite, and click the Add button. In the image below I choose to use TextTest.fs for the file.

 

Step 2

In the new file window that opens type the following code (note that F# relies on indentation for identifying its code blocks; therefore be aware of that when editing the code):

module TextTest

open canopy

open DnnCanopyContext

let positive _ =

   

    context "Testing Text in Pages"

    "Home Page Contains 'Every Journey ...'" @@@ fun _ ->

        goto "/"

        let el = element "#dnn_HeaderPane" |> elementWithin "h2"

        Check.Contains el.Text "Every journey begins with the first step."

let all _ =

    positive()

Your window should look similar to this.

 

What we are trying here is to browse to the home page “/” and locate an element with an ID equals “dnn_HeaderPane” then try to locate a child element with “h2” tag under this (not necessarily a first child; it could be a grandchild deep under the parent). Afterwards, we verify that the found element’s text contains the text “Every journey begins with the first step.” If we use the browser tools to locate this, then it will be something like this:

Now, enter the following line in the “Program.fs” file as shown in the previous practice section (and pay attention to indentation).

        TextTest.all()

 

Now press F5 and watch your test run. You should see a window similar to this.

 

Congratulations, you wrote you first UI test with ATFS framework

Summary

In this article I explained how you can write our automated UI tests and run them. If you followed the previous two blogs and this one you will be able to start on your own and extend the tests to your own written modules. The tests provided with the framework represent a good starting point for you to learn from and see how we at DNN perform out automated UI tests.

When you start writing your tests and face any blocking issue or need further information, don’t hesitate to ask (as a comment to any of the blogs) and I or another person from the automation team at DNN will do our best to reply in a timely manner.

Comments

There are currently no comments, be the first to post one.

Comment Form

Only registered users may post comments.

NewsArchives


Aderson Oliveira (22)
Alec Whittington (11)
Alessandra Davies (3)
Alex Shirley (10)
Andrew Hoefling (3)
Andrew Nurse (30)
Andy Tryba (1)
Anthony Glenwright (5)
Antonio Chagoury (28)
Ash Prasad (37)
Ben Schmidt (1)
Benjamin Hermann (25)
Benoit Sarton (9)
Beth Firebaugh (12)
Bill Walker (36)
Bob Kruger (5)
Bogdan Litescu (1)
Brian Dukes (2)
Brice Snow (1)
Bruce Chapman (20)
Bryan Andrews (1)
cathal connolly (55)
Charles Nurse (163)
Chris Hammond (212)
Chris Paterra (55)
Clint Patterson (100)
Cuong Dang (21)
Daniel Bartholomew (2)
Daniel Mettler (165)
Daniel Valadas (21)
Dave Buckner (2)
David Poindexter (12)
David Rodriguez (3)
Dennis Shiao (1)
Doug Howell (11)
Erik van Ballegoij (30)
Ernst Peter Tamminga (79)
Francisco Perez Andres (12)
Geoff Barlow (12)
George Alatrash (12)
Gifford Watkins (3)
Gilles Le Pigocher (3)
Ian Robinson (7)
Israel Martinez (17)
Jan Blomquist (2)
Jan Jonas (3)
Jaspreet Bhatia (1)
Jenni Merrifield (6)
Joe Brinkman (274)
John Mitchell (1)
Jon Henning (14)
Jonathan Sheely (4)
Jordan Coopersmith (1)
Joseph Craig (2)
Kan Ma (1)
Keivan Beigi (3)
Kelly Ford (3)
Ken Grierson (10)
Kevin Schreiner (6)
Leigh Pointer (31)
Lorraine Young (60)
Malik Khan (1)
Matt Rutledge (1)
Matthias Schlomann (16)
Mauricio Márquez (5)
Michael Doxsey (7)
Michael Tobisch (3)
Michael Washington (202)
Miguel Gatmaytan (3)
Mike Horton (19)
Mitchel Sellers (35)
Nathan Rover (3)
Navin V Nagiah (14)
Néstor Sánchez (31)
Nik Kalyani (14)
Oliver Hine (1)
Peter Donker (54)
Philip Beadle (135)
Philipp Becker (4)
Richard Dumas (22)
Robert J Collins (5)
Roger Selwyn (8)
Ruben Lopez (1)
Ryan Martinez (1)
Sacha Trauwaen (1)
Salar Golestanian (4)
Sanjay Mehrotra (9)
Scott McCulloch (1)
Scott S (11)
Scott Wilkinson (3)
Scott Willhite (97)
Sebastian Leupold (80)
Shaun Walker (237)
Shawn Mehaffie (17)
Stefan Cullmann (12)
Stefan Kamphuis (12)
Steve Fabian (31)
Steven Fisher (1)
Timo Breumelhof (24)
Tony Henrich (3)
Torsten Weggen (3)
Tycho de Waard (3)
Vicenç Masanas (27)
Vincent Nguyen (3)
Vitaly Kozadayev (6)
Will Morgenweck (40)
Will Strohl (172)
William Severance (5)

Content Layout

Subscribe to DNN Digest

Subscribe to DNN Digest

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.  

What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out