java类org.testng.annotations.BeforeSuite的实例源码

TestConfig.java 文件源码 项目:keti 阅读 30 收藏 0 点赞 0 评论 0
@BeforeSuite
public static synchronized void setupForEclipse() {
    String runInEclipse = System.getenv("RUN_IN_ECLIPSE");
    if (StringUtils.isEmpty(runInEclipse) || !runInEclipse.equalsIgnoreCase("true")) {
        return;
    }
    if (!acsStarted) {
        System.out.println("*** Setting up test for Eclipse ***");
        String springProfilesActive = System.getenv("SPRING_PROFILES_ACTIVE");
        if (StringUtils.isEmpty(springProfilesActive)) {
            springProfilesActive = "h2,public,simple-cache";
        }
        System.setProperty("spring.profiles.active", springProfilesActive);
        AccessControlService.main(new String[] {});
        acsStarted = true;
    }
}
BaseClass.java 文件源码 项目:POM_HYBRID_FRAMEOWRK 阅读 30 收藏 0 点赞 0 评论 0
@Parameters({"baseURL"})
@BeforeSuite
public void beforeSuite(String baseURL) {
    try {

        rpr = ReadPropertyFile.getInstance("./TestResources/TestConfig/test.properties");

        reportFile = rpr.getKey("reportFile");
        emailConfigFile = rpr.getKey("emailConfigFile");
        sendEmail = rpr.getKey("sendEmail");

        // If the we are testing single Web Application. Mention the same in 
        //test.properties file and uncomment below line.

        //baseURL = rpr.getKey("baseURL");

        // Commnet this line if previous line is uncommented
        BaseClass.baseURL = baseURL;
        browserName = rpr.getKey("browserName");
        reporter = ReportManager.getReporter(reportFile, true);

    } catch (Exception e) {
        e.printStackTrace();
        System.out.println("Error occured in @BeforeSuite");
    }
}
WebserviceExtensionPointTest.java 文件源码 项目:communote-server 阅读 70 收藏 0 点赞 0 评论 0
@BeforeSuite
public void setup() {
    communoteWebServiceController = new CommunoteWebServiceController();
    communoteWebServiceController.setServletContext(new MockServletContext());

    communoteWebServiceDefinition = new CommunoteWebServiceDefinition();

    communoteWebServiceDefinition.setEndpointName("HelloWorldImpl");
    communoteWebServiceDefinition.setLocalPartName("HelloWorldImpl");
    communoteWebServiceDefinition.setNameSpaceUri("http://www.examples.com/wsdl/HelloService");
    communoteWebServiceDefinition.setPluginName(PLUGIN_NAME);
    communoteWebServiceDefinition.setRelativeUrlPattern(REL_URL_PATTERN);
    communoteWebServiceDefinition.setServiceClass(HelloWorldImpl.class);

    communoteWebServiceController.registerService(communoteWebServiceDefinition);
}
MRJarWarning.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 30 收藏 0 点赞 0 评论 0
@BeforeSuite
public void setup() throws IOException {
    defaultAttributes = new Attributes();
    defaultAttributes.putValue("Manifest-Version", "1.0");
    defaultAttributes.putValue("Created-By", "1.8.0-internal");

    mrjar1   = Paths.get("mrjar1.jar");
    mrjar2   = Paths.get("mrjar2.jar");
    nonMRjar = Paths.get("nonMRjar.jar");
    mrjarAllCaps = Paths.get("mrjarAllCaps.jar");

    Attributes mrJarAttrs = new Attributes(defaultAttributes);
    mrJarAttrs.putValue(MRJAR_ATTR, "true");

    build(mrjar1, mrJarAttrs);
    build(mrjar2, mrJarAttrs);
    build(nonMRjar, defaultAttributes);

    // JEP 238 - "Multi-Release JAR Files" states that the attribute name
    // and value are case insensitive.  Try with all caps to ensure that
    // jdeps still recognizes a multi-release jar.
    Attributes allCapsAttrs = new Attributes(defaultAttributes);
    allCapsAttrs.putValue(MRJAR_ATTR.toUpperCase(), "TRUE");
    build(mrjarAllCaps, allCapsAttrs);
}
InstallerTest.java 文件源码 项目:communote-server 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Installation test that creates the DB schema.
 *
 * @throws Exception
 *             in case the test fails
 */
@BeforeSuite(dependsOnMethods = "prepareDatabase")
public void installationStep1InitializeDatabase() throws Exception {
    CommunoteInstaller installer = CommunoteRuntime.getInstance().getInstaller();

    Map<CoreConfigurationPropertyConstant, String> settings = new HashMap<CoreConfigurationPropertyConstant, String>();

    settings.put(CorePropertyDatabase.DATABASE_HOST, databaseHost);
    settings.put(CorePropertyDatabase.DATABASE_PORT, databasePort);
    settings.put(CorePropertyDatabase.DATABASE_NAME, databaseName);
    settings.put(CorePropertyDatabase.DATABASE_USER_NAME, databaseUsername);
    settings.put(CorePropertyDatabase.DATABASE_USER_PASSWORD, databasePassword);

    StartupProperties newSettings = installer.updateDatabaseSettings(this.databaseType,
            settings);
    String url = newSettings.getDatabaseUrl();
    Assert.assertNotNull(url);
    LOGGER.info("Database Url: {}", url);
    boolean success = installer.initializeDatabase(new LogDatabaseInstallationCallback());
    Assert.assertTrue(success, "DB-setup failed");
}
DocumentQueryTest.java 文件源码 项目:azure-documentdb-rxjava 阅读 30 收藏 0 点赞 0 评论 0
@BeforeSuite(groups = { "simple" }, timeOut = SETUP_TIMEOUT)
public static void beforeSuite() throws Exception {
    houseKeepingClient = createRxWrapperDocumentClient().build();
    Database d = new Database();
    d.setId(DATABASE_ID);
    createdDatabase = safeCreateDatabase(houseKeepingClient, d);
    createdCollection = safeCreateCollection(houseKeepingClient, createdDatabase.getSelfLink(), getCollectionDefinition());
    for(int i = 0; i < 5; i++) {
        createDocument(houseKeepingClient, i);
    }
}
DocumentCrudTest.java 文件源码 项目:azure-documentdb-rxjava 阅读 34 收藏 0 点赞 0 评论 0
@BeforeSuite(groups = { "simple" }, timeOut = SETUP_TIMEOUT)
public static void beforeSuite() {
    houseKeepingClient = createGatewayRxDocumentClient().build();
    Database d = new Database();
    d.setId(DATABASE_ID);
    createdDatabase = safeCreateDatabase(houseKeepingClient, d);
    createdCollection = safeCreateCollection(houseKeepingClient, createdDatabase.getSelfLink(), getCollectionDefinition());
}
StoredProcedureCrudTest.java 文件源码 项目:azure-documentdb-rxjava 阅读 30 收藏 0 点赞 0 评论 0
@BeforeSuite(groups = { "simple" }, timeOut = SETUP_TIMEOUT)
public static void beforeSuite() {
    houseKeepingClient = createGatewayRxDocumentClient().build();
    Database d = new Database();
    d.setId(DATABASE_ID);
    createdDatabase = safeCreateDatabase(houseKeepingClient, d);
    createdCollection = safeCreateCollection(houseKeepingClient, createdDatabase.getSelfLink(), getCollectionDefinition());
}
HtmlEngineBaseTest.java 文件源码 项目:ats-framework 阅读 27 收藏 0 点赞 0 评论 0
@BeforeSuite
public void beforeSuiteHtmlEngineBaseTest() throws Exception {

    UiEngineConfigurator configurator = UiEngineConfigurator.getInstance();

    // set the base folder with the map files
    // configurator.setMapFilesBaseDir( "resources/com/axway/ats/uiengine/maps" );

    // overwrite some configuration properties for faster test execution
    configurator.setCommandDelay(-1);
    configurator.setElementStateChangeDelay(2000);
    configurator.setHighlightElements(false);
}
AbstractRestAssuredTest.java 文件源码 项目:Equella 阅读 26 收藏 0 点赞 0 评论 0
@BeforeSuite
public void setupProxy(ITestContext testContext)
{
    testContext.getSuite().setAttribute("cleanups", Lists.newArrayList());
    String proxyHost = testConfig.getProperty("proxy.host");
    String proxyPortString = testConfig.getProperty("proxy.port");
    if( proxyPortString != null )
    {
        System.setProperty("http.proxyHost", proxyHost);
        System.setProperty("http.proxyPort", proxyPortString);
    }
}
DefaultTest.java 文件源码 项目:coteafs-appium 阅读 31 收藏 0 点赞 0 评论 0
/**
 * @author wasiq.bhamla
 * @since 13-Apr-2017 10:10:45 PM
 */
@BeforeSuite (alwaysRun = true)
public void setupTestSuite () {
    this.androidServer = new AppiumServer ("android");
    this.androidServer.start ();

    this.androidDevice = new AndroidDevice (this.androidServer, "test");
    this.androidDevice.start ();
}
BaseCase.java 文件源码 项目:Log4Reports 阅读 25 收藏 0 点赞 0 评论 0
@BeforeSuite
public void beforeSuite(){
    System.out.println("BaseCase: beforeSuite");
    initConfig();
    TestReport.startTime = DateUtil.getNow("yyyy-MM-dd HH:mm:ss");
    TestReport.startMsTime = DateUtil.getNow("yyyy-MM-dd HH:mm:ss.SSS");
}
TestBaseRunner.java 文件源码 项目:heat 阅读 41 收藏 0 点赞 0 评论 0
/**
 * Method that takes test suites parameters and sets some environment properties.
 * @param propFilePath path of the property file data
 * @param inputWebappName name of the service to test (optional parameter)
 * @param context testNG context
 */
@BeforeSuite
@Override
@Parameters(value = {ENV_PROP_FILE_PATH, WEBAPP_NAME})
public void beforeTestSuite(String propFilePath,
                            @Optional(NO_INPUT_WEBAPP_NAME) String inputWebappName,
                            ITestContext context) {
    TestSuiteHandler testSuiteHandler = TestSuiteHandler.getInstance();
    testSuiteHandler.setPropertyFilePath(propFilePath);
    testSuiteHandler.populateEnvironmentHandler();
    testSuiteHandler.populateTestCaseUtils();

}
SingleMode.java 文件源码 项目:heat 阅读 29 收藏 0 点赞 0 评论 0
/**
 * Method that takes test suites parameters and sets some environment properties.
 * @param propFilePath path of the property file data
 * @param inputWebappName name of the service to test (optional parameter)
 * @param context testNG context
 */
@BeforeSuite
@Override
@Parameters(value = {ENV_PROP_FILE_PATH, WEBAPP_NAME})
public void beforeTestSuite(String propFilePath,
                            @Optional(NO_INPUT_WEBAPP_NAME) String inputWebappName,
                            ITestContext context) {
    super.beforeTestSuite(propFilePath, inputWebappName, context);
    TestSuiteHandler.getInstance().setWebappName(inputWebappName);
}
TestConfig.java 文件源码 项目:keti 阅读 41 收藏 0 点赞 0 评论 0
@BeforeSuite
public static synchronized void setup() {
    if (!acsStarted) {
        AccessControlService.main(new String[] {});
        acsStarted = true;
    }
}
RegistryFilterTest.java 文件源码 项目:jdk8u-jdk 阅读 35 收藏 0 点赞 0 评论 0
@BeforeSuite
static void setupRegistry() {
    try {
        impl = TestLibrary.createRegistryOnEphemeralPort();
        port = TestLibrary.getRegistryPort(impl);
        registry = LocateRegistry.getRegistry("localhost", port);
    } catch (RemoteException ex) {
        Assert.fail("initialization of registry", ex);
    }

    System.out.printf("RMI Registry filter: %s%n", registryFilter);
}
FDTest.java 文件源码 项目:jdk8u-jdk 阅读 29 收藏 0 点赞 0 评论 0
@BeforeSuite
static void init() {
    // create default shared JavaCompiler - reused across multiple
    // compilations

    comp = ToolProvider.getSystemJavaCompiler();
    fm = comp.getStandardFileManager(null, null, null);
}
FDTest.java 文件源码 项目:openjdk-jdk10 阅读 27 收藏 0 点赞 0 评论 0
@BeforeSuite
static void init() {
    // create default shared JavaCompiler - reused across multiple
    // compilations

    comp = ToolProvider.getSystemJavaCompiler();
    fm = comp.getStandardFileManager(null, null, null);
}
RegistryFilterTest.java 文件源码 项目:openjdk-jdk10 阅读 33 收藏 0 点赞 0 评论 0
@BeforeSuite
static void setupRegistry() {
    try {
        impl = TestLibrary.createRegistryOnEphemeralPort();
        port = TestLibrary.getRegistryPort(impl);
        registry = LocateRegistry.getRegistry("localhost", port);
    } catch (RemoteException ex) {
        Assert.fail("initialization of registry", ex);
    }

    System.out.printf("RMI Registry filter: %s%n", registryFilter);
}
ParallelPrefix.java 文件源码 项目:openjdk-jdk10 阅读 32 收藏 0 点赞 0 评论 0
@BeforeSuite
public static void setup() {
    java.lang.management.OperatingSystemMXBean bean =
            ManagementFactory.getOperatingSystemMXBean();
    if (bean instanceof OperatingSystemMXBean) {
        OperatingSystemMXBean os = (OperatingSystemMXBean)bean;
        long physicalMemorySize = os.getTotalPhysicalMemorySize() / (1024 * 1024);
        System.out.println("System memory size: " + physicalMemorySize + "M");
        // when we can get system memory size, and it's larger than 2G,
        // then we enable large array size test below,
        // else disable large array size test below.
        if (physicalMemorySize > (2 * 1024)) {
            arraySizeCollection  = new int[]{
                    SMALL_ARRAY_SIZE,
                    THRESHOLD_ARRAY_SIZE,
                    MEDIUM_ARRAY_SIZE,
                    LARGE_ARRAY_SIZE
                };
            System.out.println("System memory is large enough, add large array size test");
            return;
        }
    }
    arraySizeCollection  = new int[]{
            SMALL_ARRAY_SIZE,
            THRESHOLD_ARRAY_SIZE,
            MEDIUM_ARRAY_SIZE
        };
    System.out.println("System memory is not large enough, remove large array size test");
}
TestBase.java 文件源码 项目:AutomationFrameworkTPG 阅读 26 收藏 0 点赞 0 评论 0
@BeforeSuite(alwaysRun = true)
protected void suiteInit() throws Exception {
    File defaultLog = new File(DEFAULT_SUITE_LOG);
    if (defaultLog.exists() && !defaultLog.delete()){
        logger.warn("Unable to delete default log file [{}].", defaultLog.getAbsolutePath());
    }
    logger.info("Preparing spring context...");
    super.springTestContextPrepareTestInstance();
}
HybridTest.java 文件源码 项目:revature-automation-framework-remastered 阅读 28 收藏 0 点赞 0 评论 0
/**
 * @throws IOException If the data provided is not found.
 */
@BeforeSuite
public void setUp() throws IOException{

    driver = DriverHolder.getDriver(OSName, driverName, Bit);
    WebOp = new WebOperation(driver);

    objectProperties = ReadObjectFile.getObjectData(PropertiesFilePath);
       // TODO: find way to dynamically change the sheet name
    //Get row counts
}
FDTest.java 文件源码 项目:openjdk9 阅读 34 收藏 0 点赞 0 评论 0
@BeforeSuite
static void init() {
    // create default shared JavaCompiler - reused across multiple
    // compilations

    comp = ToolProvider.getSystemJavaCompiler();
    fm = comp.getStandardFileManager(null, null, null);
}
OSSTest.java 文件源码 项目:aliyun-jclouds 阅读 29 收藏 0 点赞 0 评论 0
@BeforeSuite
public void beforeSuite() {
   BasicConfigurator.configure();
   BlobStoreContext context = ContextBuilder
         .newBuilder(provider)
         .credentials(key, secret)
         .buildView(BlobStoreContext.class);
   blobStore = context.getBlobStore();
}
ECSTest.java 文件源码 项目:aliyun-jclouds 阅读 29 收藏 0 点赞 0 评论 0
@BeforeSuite
public void beforeSuite() {
   BasicConfigurator.configure();
   ComputeServiceContext context = ContextBuilder
         .newBuilder(provider)
         .credentials(key, secret)
         .buildView(ComputeServiceContext.class);
   computeService = context.getComputeService();
}
SLBTest.java 文件源码 项目:aliyun-jclouds 阅读 32 收藏 0 点赞 0 评论 0
@BeforeSuite
public void beforeSuite() {
   BasicConfigurator.configure();
   LoadBalancerServiceContext context = ContextBuilder
         .newBuilder(provider)
         .credentials(key, secret)
         .buildView(LoadBalancerServiceContext.class);
   loadBalancerService = context.getLoadBalancerService();
}
IdentityEventConfigBuilderTest.java 文件源码 项目:carbon-identity-framework 阅读 27 收藏 0 点赞 0 评论 0
@BeforeSuite
public void setup() throws NoSuchFieldException, IllegalAccessException {

    String home = IdentityEventConfigBuilder.class.getResource("/").getFile();
    String config = IdentityEventConfigBuilder.class.getResource("/").getFile();
    System.setProperty("carbon.home", home);
    System.setProperty("carbon.config.dir.path", config);
}
WebHome.java 文件源码 项目:xframium-java 阅读 28 收藏 0 点赞 0 评论 0
/**
 * The setupSuite method allows you to use the xFramium configuration XML or property file.
 */
@BeforeSuite
public void setupSuite( ITestContext tC )
{
    //
    // Register our Test Artifact
    //

    String xFID = UUID.randomUUID().toString();
    Initializable.xFID.set( xFID ); 
    Map<String,String> customConfig = new HashMap<String,String>(5);
    customConfig.put( "xF-ID", Initializable.xFID.get() );

    ArtifactManager.instance( xFID ).registerArtifact( ArtifactTime.AFTER_TEST, "TAB_WEBHOME", WebHomeArtifact.class );

    //
    // Specify your xFramium configuration file here as TXT or XML
    //

    File configurationFile = new File( "resources\\driverConfig.xml" );
    System.out.println( configurationFile.getAbsolutePath() );

    if ( configurationFile.getName().toLowerCase().endsWith( ".xml" ) )
        cR = new XMLConfigurationReader();
    else if ( configurationFile.getName().toLowerCase().endsWith( ".txt" ) )
        cR = new TXTConfigurationReader();
    cR.readConfiguration( configurationFile, false, customConfig );

}
FDTest.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 32 收藏 0 点赞 0 评论 0
@BeforeSuite
static void init() {
    // create default shared JavaCompiler - reused across multiple
    // compilations

    comp = ToolProvider.getSystemJavaCompiler();
    fm = comp.getStandardFileManager(null, null, null);
}
FDTest.java 文件源码 项目:lookaside_java-1.8.0-openjdk 阅读 37 收藏 0 点赞 0 评论 0
@BeforeSuite
static void init() {
    // create default shared JavaCompiler - reused across multiple
    // compilations

    comp = ToolProvider.getSystemJavaCompiler();
    fm = comp.getStandardFileManager(null, null, null);
}


问题


面经


文章

微信
公众号

扫码关注公众号