Creating a new autotest and patterns

Parent Previous Next

Creating a new autotest


To create a new autotest, you need to select the folder in which you want to create the file in the "Project" window (on the "Explorer" tab), then click on the "Files" button to open the menu and select "Create Autotest file"



You will be prompted to enter a name for the new file (you do not need to specify the extension)



Click OK and a new autotest file will be created. It will immediately appear in the Project window (on the Explorer tab).



The file is not empty, it will immediately describe all the necessary structure.


using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Windows.Forms;

using System.Threading;

using System.Threading.Tasks;

using System.IO

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Text.RegularExpressions;

using System.Net;

using System.Net.Http;

using System.Net.Http.Headers;

using System.Reflection;

using Newtonsoft.Json;

using HatFramework;


namespace Hat

{

    public class MyTest

    {

        Tester tester;

        

        public async void Main(Form browserWindow)

        {

            tester = new Tester(browserWindow);

            await setUp();

            await test();

            await tearDown();

        }


        public async Task setUp()

        {

            

        }


        public async Task test()

        {

            

        }


        public async Task tearDown()

        {

            

        }

    }

}




Creating patterns


Special templates are also provided for creating the PageObjects and StepObjects pattern files.





As a result, the following pattern files with a basic description will be created




file: MyPage.cs

file: MySteps.cs

using System;

using HatFramework;


namespace Hat

{

    public static class MyPage

    {

        public static string URL = "https://test.com/";

        public static string ButtonLogin = "buttonLogin";

    }

}

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Windows.Forms;

using System.Threading;

using System.Threading.Tasks;

using System.IO;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Text.RegularExpressions;

using System.Net;

using System.Net.Http;

using System.Net.Http.Headers;

using System.Reflection;

using Newtonsoft.Json;

using HatFramework;


namespace Hat

{

    public class MySteps : Tester

    {

        public MySteps(Form browserWindow): base(browserWindow) {}


        public async Task Test()

        {

            await this.AssertTrueAsync(true);

        }

    }

}


Created with the Personal Edition of HelpNDoc: Easily create Help documents