I have to Test methods in my code and I wan to execute AfterMehtod for only one. Anybody have any idea how do this?
Here is My code:
package Demo;
import java.util.concurrent.TimeUnit;
import library.Utility;
import org.openqa.selenium.By;
import org.testng.ITestResult;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import Pages.custom_actions_page;
import com.relevantcodes.extentreports.ExtentReports;
import com.relevantcodes.extentreports.ExtentTest;
import com.relevantcodes.extentreports.LogStatus;
public class Custom_Actions extends start {
ExtentReports report;
ExtentTest logger;
String driverPath = "D:\\geckodriver-v0.16.1-win64\\geckodriver.exe";
#Test()
public void signin() throws Exception {
// To Locate the Username field
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
driver.findElement(By.id("username")).sendKeys("admin");
// To locate the Password field
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
driver.findElement(By.id("password")).sendKeys("admin123");
// Click on Login button
driver.manage().timeouts().implicitlyWait(3, TimeUnit.SECONDS);
driver.findElement(By.id("submit")).click();
}
#Test(dependsOnMethods = { "signin" })
public void create_custom_action() {
report = new ExtentReports("D:/Reports/Report.html");
logger = report.startTest("Create Custom Action");
new custom_actions_page(driver).submit();
new custom_actions_page(driver).admin();
new custom_actions_page(driver).custom_ac();
new custom_actions_page(driver).createnew();
new custom_actions_page(driver).nameAs("fortesting").descriptionAs(
"description");
new custom_actions_page(driver).category();
new custom_actions_page(driver).assetsubtype();
new custom_actions_page(driver).assettype();
new custom_actions_page(driver).flintnameAs("hello:example.rb");
new custom_actions_page(driver).submit_butto();
new custom_actions_page(driver).Save_Button();
logger.log(LogStatus.PASS, "Custom Action Created Successfully");
}
#AfterMethod()
public void tearDown(ITestResult result) {
// Here will compare if test is failing then only it will enter into if
// condition
if (ITestResult.FAILURE == result.getStatus()) {
try {
Utility.captureScreenshot(driver, "CustomActionFail.png");
} catch (Exception e) {
System.out.println("Exception while taking screenshot "
+ e.getMessage());
}
}
report.endTest(logger);
report.flush();
driver.close();
}}
#AfterMethod is designed to make your life easier when you need to execute a the same block of code after each test without having to duplicate it in each test. So if you need it to execute only after one test, just embed it into that #Test method and remove the #AfterMethod annotated method.
There are a couple of ways of doing it using what is called as Native Injection within TestNG. For more details on what is the possible combinations for native injection in TestNG please refer here.
The simplest way would be to inspect the name of the #Test method that is about to be executed, from within your #AfterMethod annotated method, and if it matches the name of the method for which you need special execution, you proceed further, else you skip executing the #AfterMethod.
But this is a primitive approach, because if you refactor your test method's name to something else, your approach gets broken.
The other approach is to basically work with a marker interface and do the same logic as described above
Here's a sample that shows all this in action.
The marker annotation would look like below
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
#Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
#Target(java.lang.annotation.ElementType.METHOD)
public #interface NeedsSpecialSetup {
}
Now your test class would look like below
import org.testng.annotations.AfterMethod;
import org.testng.annotations.Test;
import java.lang.reflect.Method;
public class SampleTestClass {
#NeedsSpecialSetup
#Test
public void testMethod1() {
System.err.println("Executing testMethod1()");
}
#Test
public void testMethod2() {
System.err.println("Executing testMethod2()");
}
#AfterMethod
public void afterMethod(Method method) {
NeedsSpecialSetup needsSpecialSetup = method.getAnnotation(NeedsSpecialSetup.class);
if (needsSpecialSetup == null) {
//Don't execute this setup because the method doesn't have the
//special setup annotation.
return;
}
System.err.println("Running special setup for " + method.getName() + "()");
}
}
Notice how we have added the annotation #NeedsSpecialSetup only for the method testMethod1() to indicate that we need the #AfterMethod to be executed only for testMethod1().
Here's the output
Executing testMethod1()
Running special setup for testMethod1()
Executing testMethod2()
===============================================
Default Suite
Total tests run: 2, Failures: 0, Skips: 0
===============================================
Related
JUnit5 does not support PowerMockRunner hence the following code will not work whenever you migrate from JUnit4 to JUnit5.
Eg.
Code you trying to inject mock
import javax.naming.InvalidNameException;
public class Main {
public static void main(String[] args) {
Main main = new Main();
main.publish();
}
public void publish() {
try {
Sample s = new Sample();
s.invoke("Hello");
} catch (InvalidNameException e) {
throw new ServiceFailureException(e.getMessage());
}
}
}
Here you are trying to test publish method where you mock the Sample instance to respond with different responses.
In JUnit4 you could have use PowerMockito to achieve that.
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import javax.naming.InvalidNameException;
#RunWith(PowerMockRunner.class)
#PrepareForTest({Main.class})
public class MainTest {
#Test
public void testPublishSuccess() {
Main m = new Main();
Assert.assertEquals("Expected result not found", "success", m.publish());
}
#Test
public void testPublishFailure() throws Exception{
Sample sample = new Sample();
PowerMockito.when(sample.invoke(Mockito.anyString())).thenReturn("failure");
PowerMockito.whenNew(Sample.class).withNoArguments().thenReturn(sample);
Main m = new Main();
Assert.assertEquals("Expected result not found", "failure", m.publish());
}
#Test(expected = ServiceFailureException.class)
public void testPublishException() throws Exception{
Sample sample = new Sample();
PowerMockito.when(sample.invoke(Mockito.anyString())).thenThrow(new InvalidNameException("Invalid name provided"));
PowerMockito.whenNew(Sample.class).withNoArguments().thenReturn(sample);
Main m = new Main();
m.publish();
}
}
With the introduction of JUnit5, the test cases are failing at mock creating new instances because PowerMockRunner does not support JUnit5.
What is the alternate for using PowerMockito with JUnit5.
As PowerMockito does not support JUnit5, we can use Mockito inline. Here is the code which replace the PowerMockito.
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.mockito.MockedConstruction;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import javax.naming.InvalidNameException;
public class MainTestJunit5 {
#Test
public void testPublishSuccess() {
Main m = new Main();
Assertions.assertEquals("success", m.publish(), "Expected result not found");
}
#Test
public void testPublishFailure() throws Exception{
try (MockedConstruction<Sample> mockedConstruction = Mockito.mockConstruction(Sample.class, (sampleMock, context) -> {
Mockito.when(sampleMock.invoke(Mockito.anyString())).thenReturn("failure");
})) {
Sample sample = new Sample();
PowerMockito.when(sample.invoke(Mockito.anyString())).thenReturn("failure");
PowerMockito.whenNew(Sample.class).withNoArguments().thenReturn(sample);
Main m = new Main();
Assertions.assertEquals("Expected result not found", "failure", m.publish());
}
}
#Test
public void testPublishException() throws Exception{
try (MockedConstruction<Sample> mockedConstruction = Mockito.mockConstruction(Sample.class, (sampleMock, context) -> {
Mockito.when(sampleMock.invoke(Mockito.anyString())).thenThrow(new InvalidNameException("Invalid name found"));
})){
Main m = new Main();
boolean error = false;
try {
m.publish();
} catch (ServiceFailureException e) {
error = true;
}
Assertions.assertTrue(error, "Exception throwing expected");
}
}
}
Couple of things you need to pay attention
Setting up mockito-inline need additional dependency and an additional configuration.
Extra test runners (PowerMockRunner) and preparation for testing is not needed.
MockedConstruction is scoped, so you have to put all the mocking and processing done within that code block.
JUnit5 messages are the final method argument.
Mockito documentation: https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#49
I am testing out new technologies and generated a HelloWorld template using AWS SAM.
I wrote some simple unit tests for my simple app but I am having trouble using #Before and #BeforeClass. If I move the contents of the initialize method inside each of my tests, then they pass but I get all NullPointerExceptions when I try to do it separately.
Originally I decided to use #Before and my class was like so-
package helloworld;
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.Test;
public class AppTest {
App app;
APIGatewayProxyResponseEvent result;
String content;
#Before
public void initialize(){
App app = new App();
APIGatewayProxyResponseEvent result = app.handleRequest(null, null);
System.out.println(result);
String content = result.getBody();
System.out.println(content);
}
#Test
public void successfulResponseCode(){
System.out.println("1 " + content);
assertEquals(result.getStatusCode().intValue(), 200);
}
#Test
public void successfulResponseString() {
System.out.println("2 " + content);
assertNotNull(content);
assertTrue(content.contains("\"message\""));
assertTrue(content.contains("\"hello world\""));
assertTrue(content.contains("\"location\""));
}
#Test
public void readsDatabase(){
System.out.println("3 " + content);
assertTrue(content.contains("Devon"));
assertTrue(content.contains("Luana"));
}
#Test
public void headersCreated(){
System.out.println("4 " + content);
assertEquals(result.getHeaders().get("Content-Type"), "application/json");
assertTrue(result.getHeaders().get("Access-Control-Allow-Origin").contains("*"));
assertEquals(result.getHeaders().get("Access-Control-Allow-Methods"), "*");
}
}
The system logs within the initialize class were outputting correctly but inside each #Test they were null. For some reason the instantiated variables were not making it within the scope of the test.
I am a bit of novice at tests and I realized I should be using #BeforeClass anyways, since I didn't need to make a new call for each separate test and I hoped that possibly that might fix my problem. It still didn't work so then I changed the variables to static but that also didn't help. I'm sure the error must be simple but I can't figure out what it is.
I see a few other people were having the same problem here- Junit #Before not working properly and I tried changing my variables to private but still no luck.
I also saw this - Java JUnit testing not working with #Before annotation but I am using junit 4.13.1 although like the author, my tests work if I simply initialize outside the #Before annotation like so -
package helloworld;
import com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
public class AppTest {
App app = new App();
APIGatewayProxyResponseEvent result = app.handleRequest(null, null);
String content = result.getBody();
// #BeforeClass
// public static void initialize(){
// App app = new App();
// APIGatewayProxyResponseEvent result = app.handleRequest(null, null);
// System.out.println(result);
// String content = result.getBody();
// System.out.println(content);
// }
#Test
public void successfulResponseCode(){
System.out.println("1 " + content);
assertEquals(result.getStatusCode().intValue(), 200);
}
#Test
public void successfulResponseString() {
System.out.println("2 " + content);
assertNotNull(content);
assertTrue(content.contains("\"message\""));
assertTrue(content.contains("\"hello world\""));
assertTrue(content.contains("\"location\""));
}
#Test
public void readsDatabase(){
System.out.println("3 " + content);
assertTrue(content.contains("Devon"));
assertTrue(content.contains("Luana"));
}
#Test
public void headersCreated(){
assertEquals(result.getHeaders().get("Content-Type"), "application/json");
assertTrue(result.getHeaders().get("Access-Control-Allow-Origin").contains("*"));
assertEquals(result.getHeaders().get("Access-Control-Allow-Methods"), "*");
}
}
Given below is the code that I coded using selenium in eclipse.
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.testng.annotations.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
class GoogleSearchTest {
#Test
public static void main(String[] args) throws InterruptedException {
System.setProperty("webdriver.gecko.driver","C:\\Users\\acer\\Downloads\\selenium\\geckodriver.exe");
WebDriver driver =new FirefoxDriver();
driver.get("https://www.google.com/");
WebElement we1 = driver.findElement(By.name("q"));
we1.sendKeys("GMAIL");
we1.sendKeys(Keys.ENTER);
WebDriverWait wait1 = new WebDriverWait(driver, 5);
wait1.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//h3[text()='E-mail - Sign in - Google Accounts']"))).click();
Thread.sleep(10000);
driver.findElement(By.id("identifierId")).sendKeys("2017cs102#stu.ucsc.cmb.ac.lk");
driver.findElement(By.xpath("//*[#id='identifierNext']/div/span/span")).click();
Thread.sleep(10000);
driver.findElement(By.name("password")).sendKeys("mmalsha425#gmail.com");
driver.findElement(By.xpath("//*[#id='passwordNext']/div/span/span")).click();
}
}
It gives the following error.
[TestNG] No tests found. Nothing was run
Usage: <main class> [options] The XML suite files to run
I have already installed TestNG plugin.What can I do to fix this problem??
Change the main function name. You should not use it while using TestNG
#Test
public void test() throws InterruptedException {
System.setProperty("webdriver.gecko.driver","C:\\Users\\acer\\Downloads\\selenium\\geckodriver.exe");
WebDriver driver =new FirefoxDriver();
You don't need to write main() method, TestNg do that by itself.
class GoogleSearchTest {
#Test
public void test() throws InterruptedException{
//your code here
.....
}
}
If you want to call from main(), simply:
import org.testng.TestNG;
public class Master {
public static void main(String[] args) {
TestNG testng = new TestNG();
testng.setTestClasses(new Class[] { GoogleSearchTest.class });
testng.run();
}
}
But note, in GoogleSearchTest class don't put public static void main for #Test
This error message...
[TestNG] No tests found. Nothing was run
Usage: <main class> [options] The XML suite files to run
...implies that the TestNG found no tests hence nothing was executed.
TestNG
TestNG is an annotation-based test framework which needs a marker annotation type to indicate that a method is a test method, and should be run by the testing tool. Hence, while using testng as you use annotations and you don't have to call the main() method explicitly.
Solution
The simple solution would be to replace the main() method with a test method name e.g. test() and keep the #Test annotation as follows:
// your imports
class GoogleSearchTest {
#Test
public void test() throws InterruptedException {
System.setProperty("webdriver.gecko.driver","C:\\Users\\acer\\Downloads\\selenium\\geckodriver.exe");
// other lines of code
}
}
I am writing automatic tests using Java with Selenium Grid and JUnit framework and I have encountered a problem with user input. So my code looks like this:
package com.example.tests;
import com.thoughtworks.selenium.DefaultSelenium;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import java.util.Scanner;
import static org.junit.Assert.fail;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
public class test {
private DefaultSelenium selenium;
#Before
public void setUp() throws Exception {
selenium = new DefaultSelenium("localhost", 5555, "*googlechrome", "www.google.com");
selenium.start();
}
#Test
public void Test() throws Exception {
// some tests here
}
#After
public void tearDown() throws Exception {
selenium.stop();
}
I would like to add a user input, so when user types for example "Google Chrome", the test will start with Google Chrome, when he types "Firefox", the test will start with Firefox etc. I have tried to put
Scanner in = new Scanner(System.in);
String web_browser = in.next();
somwhere in my code (in setUp method for example), but when the program starts, I can't type anything in the console. Does anyone know the solution for this?
It's tricky dealing with System.in in the test.
I suggest that you rather read your driver preference as a system property?
String driver = System.getProperty("driver");
if (driver != null) {
//use that driver
}
else {
//use default driver
}
You can the launch your test like
mvn test -Ddriver=chrome
or by setting them in your IDE
Basically every time I run my java code from eclipse, webdriver launches a new ie browser and executes my tests successfully for the most part. However, I have a lot of tests to run, and it's a pain that webdriver starts up a new browser session every time. I need a way to re-use a previously opened browser; so webdriver would open ie the first time, then the second time, i run my eclipse program, I want it to simply pick up the previous browser instance and continue to run my tests on that same instance. That way, I am NOT starting up a new browser session every time I run my program.
Say you have 100 tests to run in eclipse, you hit that run button and they all run, then at about the 87th test you get an error. You then go back to eclipse, fix that error, but then you have to re-run all 100 test again from scratch.
It would be nice to fix the error on that 87th test and then resume the execution from that 87th test as opposed to re-executing all tests from scratch, i.e from test 0 all the way to 100.
Hopefully, I am clear enough to get some help from you guys, thanks btw.
Here's my attempt below at trying to maintain and re-use a webdriver internet explorer browser instance:
public class demo extends RemoteWebDriver {
public static WebDriver driver;
public Selenium selenium;
public WebDriverWait wait;
public String propertyFile;
String getSessionId;
public demo() { // constructor
DesiredCapabilities ieCapabilities = DesiredCapabilities
.internetExplorer();
ieCapabilities
.setCapability(
InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS,
true);
driver = new InternetExplorerDriver(ieCapabilities);
this.saveSessionIdToSomeStorage(getSessionId);
this.startSession(ieCapabilities);
driver.manage().window().maximize();
}
#Override
protected void startSession(Capabilities desiredCapabilities) {
String sid = getPreviousSessionIdFromSomeStorage();
if (sid != null) {
setSessionId(sid);
try {
getCurrentUrl();
} catch (WebDriverException e) {
// session is not valid
sid = null;
}
}
if (sid == null) {
super.startSession(desiredCapabilities);
saveSessionIdToSomeStorage(getSessionId().toString());
}
}
private void saveSessionIdToSomeStorage(String session) {
session=((RemoteWebDriver) driver).getSessionId().toString();
}
private String getPreviousSessionIdFromSomeStorage() {
return getSessionId;
}
}
My hope here was that by overriding the startSession() method from remoteWebdriver, it would somehow check that I already had an instance of webdriver browser opened in i.e and it would instead use that instance as opposed to re-creating a new instance everytime I hit that "run" button in eclipse.
I can also see that because I am creating a "new driver instance" from my constructor, since constructor always execute first, it creates that new driver instance automatically, so I might need to alter that somehow, but don't know how.
I am a newbie on both stackoverflow and with selenium webdriver and hope someone here can help.
Thanks!
To answer your question:
No. You can't use a browser that is currently running on your computer. You can use the same browser for the different tests, however, as long as it is on the same execution.
However, it sounds like your real problem is running 100 tests over and over again. I would recommend using a testing framework (like TestNG or JUnit). With these, you can specify which tests you want to run (TestNG will generate an XML file of all of the tests that fail, so when you run it, it will only execute the failed tests).
Actually you can re-use the same session again..
In node client you can use following code to attach to existing selenium session
var browser = wd.remote('http://localhost:4444/wd/hub');
browser.attach('df606fdd-f4b7-4651-aaba-fe37a39c86e3', function(err, capabilities) {
// The 'capabilities' object as returned by sessionCapabilities
if (err) { /* that session doesn't exist */ }
else {
browser.elementByCss("button.groovy-button", function(err, el) {
...
});
}
});
...
browser.detach();
To get selenium session id,
driver.getSessionId();
Note:
This is available in Node Client only..
To do the same thing in JAVA or C#, you have to override execute method of selenium to capture the sessionId and save it in local file and read it again to attach with existing selenium session
I have tried the below steps to use the same browser instance and it worked for me:
If you are having generic or Class 1 in different package the below code snippet will work -
package zgenerics;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
import org.openqa.selenium.WebDriver;
// Class 1 :
public class Generics {
public Generics(){}
protected WebDriver driver;
#BeforeTest
public void maxmen() throws InterruptedException, IOException{
driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
String appURL= "url";
driver.get(appURL);
String expectedTitle = "Title";
String actualTitle= driver.getTitle();
if(actualTitle.equals(expectedTitle)){
System.out.println("Verification passed");
}
else {
System.out.println("Verification failed");
} }
// Class 2 :
package automationScripts;
import org.openqa.selenium.By;
import org.testng.annotations.*;
import zgenerics.Generics;
import org.openqa.selenium.support.ui.WebDriverWait;
import org.openqa.selenium.support.ui.ExpectedConditions;
public class Login extends Generics {
#Test
public void Login() throws InterruptedException, Exception {
WebDriverWait wait = new WebDriverWait(driver,25);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("")));
driver.findElement(By.cssSelector("")).sendKeys("");
wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("")));
driver.findElement(By.xpath("")).sendKeys("");
}
}
If your Generics class is in the same package you just need to make below change in your code:
public class Generics {
public Generics(){}
WebDriver driver; }
Just remove the protected word from Webdriver code line. Rest code of class 1 remain as it is.
Regards,
Mohit Baluja
I have tried it by extension of classes(Java Inheritance) and creating an xml file. I hope below examples will help:
Class 1 :
package zgenerics;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.BeforeTest;
import org.openqa.selenium.WebDriver;
public class SetUp {
public Generics(){}
protected WebDriver driver;
#BeforeTest
public void maxmen() throws InterruptedException, IOException{
driver = new FirefoxDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
String appURL= "URL";
driver.get(appURL);
String expectedTitle = "Title";
String actualTitle= driver.getTitle();
if(actualTitle.equals(expectedTitle)){
System.out.println("Verification passed");
}
else {
System.out.println("Verification failed");
} }
Class 2 :
package automationScripts;
import org.openqa.selenium.By;
import org.testng.annotations.Test;
import zgenerics.SetUp
public class Conditions extends SetUp {
#Test
public void visible() throws InterruptedException{
Thread.sleep(5000);
boolean signINbutton=driver.findElement(By.xpath("xpath")).isEnabled();
System.out.println(signINbutton);
boolean SIGNTEXT=driver.findElement(By.xpath("xpath")).isDisplayed();
System.out.println(SIGNTEXT);
if (signINbutton==true && SIGNTEXT==true){
System.out.println("Text and button is present");
}
else{
System.out.println("Nothing is visible");
}
}
}
Class 3:
package automationScripts;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.testng.annotations.Test;
public class Footer extends Conditions {
#Test
public void footerNew () throws InterruptedException{
WebElement aboutUs = driver.findElement(By.cssSelector("CssSelector"));
aboutUs.click();
WebElement cancel = driver.findElement(By.xpath("xpath"));
cancel.click();
Thread.sleep(1000);
WebElement TermsNCond = driver.findElement(By.xpath("xpath"));
TermsNCond.click();
}
}
Now Create an xml file with below code for example and run the testng.xml as testng suite:
copy and paste below code and edit it accordingly.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
<suite name="TestSuite" parallel="classes" thread-count="3">
<test name="PackTest">
<classes>
<class name="automationScripts.Footer"/>
</classes>
This will run above three classes. That means one browser and different tests.
We can set the execution sequence by setting the class names in alphabetical order as i have done in above classes.