I'm writing a small testing script that will test the same thing for different members on their online profile. My question is, is it possible to loop a test case? At the moment, the way I've been doing this is simply copying and pasting the same test case over and over and changing only the member name variable. But there are a couple hundred members that I need to do this for and I am sure there must be a more efficient way to handle this. Below is the code I written so far please let me know if there is anything I should change or try.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Support;
using OpenQA.Selenium.Support.UI;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.Firefox;
using OpenQA.Selenium.IE;
using NUnit.Framework;
using OpenQA.Selenium.Interactions;
namespace InactivationMemberCheck
{
class Program
{
string username = "Username1";
string password = "Password1";
string url = "http://url.com";
static void Main(string[] args)
{
}
[SetUp]
public void Initialize()
{
Properties.driverGC = new ChromeDriver();
Properties.driverIE = new InternetExplorerDriver();
Properties.driverFF = new FirefoxDriver();
UWEAdmin.OIDLogIn(Properties.driverGC, username, password, url);
UWEAdmin.OIDLogIn(Properties.driverIE, username, password, url);
UWEAdmin.OIDLogIn(Properties.driverFF, username, password, url);
}
---------------THIS IS THE TEST CASE I AM WANTING TO LOOP, THE ONLY DIFFERENCE IN THE TEST WOULD BE THE MEMBER NAME.------------------------------------------
[Test]
public void MEMBER1()
{
string member_name = "Member1";
string OU = "American Red Cross of Central";
string status = "Yes";
OperatingUnit.ChangeOU(Properties.driverGC, OU);
MemberSearch.Search(Properties.driverGC, name, status);
Compare.statuses(Properties.driverGC);
}
}
[TearDown]
public void CloseUp()
{
Properties.driverGC.Quit();
}
}
}
Aucun commentaire:
Enregistrer un commentaire