Creating or customizing a test script

A test script is a Java class that automates a single test scenario, which contains one or more test cases.

The test cases hold the logic to perform storefront actions by combining tasks from the page objects in a specific order.

All of your test scripts are structured similarly. These actions are numbered in the following sample test script and defined below it.
// 1-) Import the task libraries for use in this test script
import com.ibm.commerce.qa.aurora.page.AuroraFrontPage.<nameOfPageObject>;
//Declare a new test scenario called SampleTest which contains one or more test case methods.
//All test scenario classes must extend AbstractAuroraSingleSessionTests.
/*
 * Scenario: SampleTest
 * Details: A sample test script that demonstrates how to use the Storefront Test Automation Engine.
 */
  public class SampleTest extends AbstractAuroraSingleSessionTests {
	 /**
	 * 2-) an annotation is added to setup the data file mechanism, including selecting the 
	 * data file based on the class name, and setting up the datablock.
	 */
		protected final String dataFileName = "data/SampleTest_Data.xml";	
	 /**
	 * Perform setup operations such as initializing the test harness and setting the data file that will be used.
	 * @throws Exception
	 */
	  public void setUp() throws Exception {
		// 2-) Set the data file that will be used.
		setDataFile(dataFileName);
		// 3-) Start the Selenium server.
		test.doSetUp();
	}
	
	 /**
	 * 4-) Description of this test case. There are often multiple test cases in a test script.
	 * @throws Exception
	 */
	  public void testCompleteShopFlow() throws Exception {
		
		//Set the location in the data file for this test case by specifying a test node and one of its data blocks.
		setDataLocation("testCompleteShopFlowNode", "testCompleteShopFlowDataBlock");
		
		//Open the storefront in a browser
		Store.openStore();
		
		//The tasks needed to perform this test case will be called here.
	}
	
	 /**
	 * Perform tear down operations such as stopping the Storefront Test Automation Engine.
	 * @throws Exception
	 */
	  public void tearDown() throws Exception {
		// 5-) Sign out of the store. Note: This is only necessary if the store was signed in to during a test case.
		Header.clickLogoutButton();
		// 6-) Stop the Selenium server.
		test.doTearDown();
	}
}
Every test script is composed of similar actions:
  1. The libraries that are needed to run the test cases are imported.
  2. The data file for the test scenario being automated is defined and set.
  3. The Selenium server is started.
  4. The test cases are run.
  5. If one of the test cases signs in to the storefront, it is signed out of.
  6. The Selenium server is stopped.

Procedure

  1. In the development environment, go to the test bucket directory where you want to add a test script, to or customize an existing test script. This directory is in the src directory of your test bucket project.
  2. Do one of the following steps:
    1. To customize a test script:

      Double-click the test script to open it and type the changes into the appropriate test case.

    2. To create a test script:
      1. Right-click the test bucket directory and select New > File.
      2. Type the name of the test script into the File name field and add the .java file extension.
      3. Click Finish.

What to do next

Review the test scripts in the Aurora-Tests test bucket project and use their contents as a guide to write your new test script. Import the Aurora-Tests into your development environment.