testdev/ite/test/com.nokia.testfw.core.test/src/com/nokia/testfw/core/utils/STFScriptUtilsTest.java
changeset 1 96906a986c3b
equal deleted inserted replaced
0:f1112f777ce9 1:96906a986c3b
       
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 package com.nokia.testfw.core.utils;
       
    18 
       
    19 import java.io.File;
       
    20 import java.io.InputStream;
       
    21 import java.util.ArrayList;
       
    22 
       
    23 import junit.framework.TestCase;
       
    24 
       
    25 /**
       
    26  * @author xiaoma
       
    27  *
       
    28  */
       
    29 public class STFScriptUtilsTest extends TestCase {
       
    30 	static final String TEST_SCRIPT_FILE = "stfscript.cfg";
       
    31 	public void testLoadTestCase() {
       
    32 		ArrayList<String> testCases;
       
    33 		try {
       
    34 			if (new File(TEST_SCRIPT_FILE).exists()) {
       
    35 				testCases = STFScriptUtils.getTestCasesFromScript(TEST_SCRIPT_FILE);
       
    36 			} else {
       
    37 				InputStream fileStream = this.getClass().getClassLoader().getResourceAsStream(TEST_SCRIPT_FILE);
       
    38                 testCases = STFScriptUtils.getTestCasesFromScript(fileStream);
       
    39 			}
       
    40 			assertNotNull(testCases);
       
    41 			assertEquals(testCases.size(), 12);
       
    42 			assertEquals(testCases.get(0), "timeout (abort case)");
       
    43 			
       
    44 
       
    45 		} catch (Exception e) {
       
    46 			e.printStackTrace();
       
    47 		}
       
    48 
       
    49 	}
       
    50 }