本文整理汇总了Java中org.testng.annotations.BeforeGroups类的典型用法代码示例。如果您正苦于以下问题:Java BeforeGroups类的具体用法?Java BeforeGroups怎么用?Java BeforeGroups使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BeforeGroups类属于org.testng.annotations包,在下文中一共展示了BeforeGroups类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp1AndroidDriver
import org.testng.annotations.BeforeGroups; //导入依赖的package包/类
@BeforeGroups(groups="1driver_android")
public void setUp1AndroidDriver() throws Exception{
//Start appium server 1 if necessary.
startAppiumServer1();
//Create android driver 1 if necessary
//if(appiumFactory.getAndroidDriver1()==null || appiumFactory.getAndroidDriver1()!=null && appiumFactory.getAndroidDriver1().getSessionId()==null){
if(appiumFactory.getAndroidDriver1()==null || appiumFactory.getAndroidDriver1().getSessionId()==null){
Map<String, String> androidDevice1=ReadConfigFile.getInstance().getDevicesMap().get("androiddevice1");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.UDID,androidDevice1.get(MobileCapabilityType.UDID));
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,androidDevice1.get(MobileCapabilityType.DEVICE_NAME));
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,androidDevice1.get(MobileCapabilityType.PLATFORM_NAME));
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, androidDevice1.get(MobileCapabilityType.PLATFORM_VERSION));
capabilities.setCapability("appPackage", Constant.PACKAGE_APP_NAME);
capabilities.setCapability("appActivity", Constant.APPLICATION_LOGIN_ACTIVITY);
capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 1200);
capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
//Set android driver 1
appiumFactory.setAndroidDriver1(new URL(Constant.getServer1HttpAddress()), capabilities);
System.out.println("Application "+Constant.PACKAGE_APP_NAME+" started on device "+capabilities.getCapability(MobileCapabilityType.DEVICE_NAME) +" with AppiumDriver 1.");
}
}
示例2: beforeHgroup
import org.testng.annotations.BeforeGroups; //导入依赖的package包/类
/**
* Prepares the hierarchical group tests.
*
* @throws Exception
* if the setup fails
*/
@BeforeGroups(groups = { "hierarchical-groups" })
public void beforeHgroup() throws Exception {
UserGroupManagement gm = getGroupManagement();
int[] usersToAdd = { 3, 3, 2, 2 };
for (int i = 1; i <= 4; i++) {
String alias = getHierarchicalGroupAlias(i);
GroupVO vo = new GroupVO(getHierarchicalGroupName(i), alias, null);
gm.createGroup(vo);
Group group = UserAndGroupTestUtils.findGroup(alias);
Assert.assertNotNull(group);
String userAliasPattern = getHierarchicalGroupUserAliasPattern(i);
UserAndGroupTestUtils.createDummyUsers(userAliasPattern,
getHierarchicalGroupUserEmailPattern(i), 3);
UserAndGroupTestUtils.addUsersToGroup(group, userAliasPattern, usersToAdd[i - 1], null);
}
}
示例3: beforeModGroupBlogMemberTestsGroup
import org.testng.annotations.BeforeGroups; //导入依赖的package包/类
/**
* Prepare before running tests of modGroupBlogMemberTestsGroup.
*
* @throws Exception
* if setup fails
*/
@BeforeGroups(groups = { "modGroupBlogMemberTestsGroup" })
public void beforeModGroupBlogMemberTestsGroup() throws Exception {
AuthenticationTestUtils.setSecurityContext(UserAndGroupTestUtils.findNthUser(
BLOG_MANAGER_ALIAS_PATTERN_PREFIX, 2));
Long blogId = getBlogManagement().findBlogByIdentifier(BLOG_2_ALIAS).getId();
Long groupId1 = UserAndGroupTestUtils.findGroup(GROUP_1_ALIAS).getId();
getBlogRightsManagement().addEntity(blogId, groupId1, BlogRole.VIEWER);
Long groupId2 = UserAndGroupTestUtils.findGroup(GROUP_2_ALIAS).getId();
getBlogRightsManagement().addEntity(blogId, groupId2, BlogRole.MEMBER);
Long userId = UserAndGroupTestUtils.findNthUser(USER_NO_GROUP_ALIAS_PATTERN_PREFIX, 1)
.getId();
getBlogRightsManagement().addEntity(blogId, userId, BlogRole.MANAGER);
AuthenticationHelper.removeAuthentication();
// put a manager in security context
AuthenticationTestUtils.setSecurityContext(UserAndGroupTestUtils.findNthUser(
InstallerTest.TEST_MANAGER_USER_ALIAS, -1));
}
示例4: initTestConfigManager
import org.testng.annotations.BeforeGroups; //导入依赖的package包/类
@BeforeGroups (groups = TEST_CONFIG_MANAGER_REQUIRED, inheritGroups = true)
public void initTestConfigManager() throws JAXBException, IOException, SAXException {
LOGGER.info("About to initialize test config manager");
final String CONFIG_LOCATION = "src/test/resources/config/mock/config-for-ConfigurationManagerTest.xml";
final String DATA_LOCATION = "src/test/resources/data/response";
this.configurationManager = new ConfigurationManager(CONFIG_LOCATION, DATA_LOCATION);
Assert.assertNotNull(this.configurationManager);
}
示例5: initTestQueryGroupConfigManager
import org.testng.annotations.BeforeGroups; //导入依赖的package包/类
@BeforeGroups (groups = TEST_QUERY_GROUP_CONFIG_MANAGER_REQUIRED, inheritGroups = true)
public void initTestQueryGroupConfigManager() throws JAXBException, IOException, SAXException {
LOGGER.info("About to initialize test queryGroup config manager");
final String CONFIG_LOCATION = "src/test/resources/config/mock/test-configuration-with-queryParams.xml";
final String DATA_LOCATION = "src/test/resources/data/response";
this.configurationManager = new ConfigurationManager(CONFIG_LOCATION, DATA_LOCATION);
Assert.assertNotNull(this.configurationManager);
}
示例6: setup
import org.testng.annotations.BeforeGroups; //导入依赖的package包/类
@BeforeGroups(alwaysRun = true)
@BeforeClass(alwaysRun = true)
final public void setup(ITestContext context) {
ConfigurationManager.getBundle().addProperty(ApplicationProperties.CURRENT_TEST_CONTEXT.key, context);
this.context = context;
}
示例7: setUp1IosDriver
import org.testng.annotations.BeforeGroups; //导入依赖的package包/类
@BeforeGroups(groups="1driver_ios")
public void setUp1IosDriver() throws Exception{
//Start appium server 1 if necessary.
startAppiumServer1();
//Create ios driver 1 if necessary
if(appiumFactory.getiOsDriver1()==null || appiumFactory.getiOsDriver1().getSessionId()==null){
Map<String, String> iosDevice1=ReadConfigFile.getInstance().getDevicesMap().get("iosdevice1");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.UDID, iosDevice1.get(MobileCapabilityType.UDID));
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,iosDevice1.get(MobileCapabilityType.DEVICE_NAME));
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,iosDevice1.get(MobileCapabilityType.PLATFORM_NAME));
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, iosDevice1.get(MobileCapabilityType.PLATFORM_VERSION));
capabilities.setCapability(IOSMobileCapabilityType.BUNDLE_ID, "im.vector.app");
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME,iosDevice1.get(MobileCapabilityType.AUTOMATION_NAME));
capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
capabilities.setCapability("xcodeOrgId", ReadConfigFile.getInstance().getConfMap().get("development_team"));
capabilities.setCapability("xcodeSigningId", ReadConfigFile.getInstance().getConfMap().get("code_sign_identity"));
//capabilities.setCapability("xcodeConfigFile", "/usr/local/lib/node_modules/appium/node_modules/appium-xcuitest-driver/WebDriverAgent/Configurations/ProjectSettings.xcconfig");
//capabilities.setCapability("keychainPath","/Users/matrix/Library/Keychains/appiumKeychain.keychain");
//capabilities.setCapability("keychainPassword","appium6754");
capabilities.setCapability("autoDismissAlerts", false);
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 1200);
appiumFactory.setiOSDriver1(new URL(Constant.getServer1HttpAddress()), capabilities);
System.out.println("Application "+Constant.APPLICATION_NAME+" started on IOS device "+capabilities.getCapability(MobileCapabilityType.DEVICE_NAME) +" with DRIVER 1.");
}
}
示例8: setUp1IosDriverForInstallation
import org.testng.annotations.BeforeGroups; //导入依赖的package包/类
@BeforeGroups(groups="1driver_ios_install")
public void setUp1IosDriverForInstallation() throws Exception{
//Start appium server 1 if necessary.
startAppiumServer1();
Map<String, String> iosDevice1=ReadConfigFile.getInstance().getDevicesMap().get("iosdevice1");
DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability(MobileCapabilityType.UDID, iosDevice1.get(MobileCapabilityType.UDID));
capabilities.setCapability(MobileCapabilityType.DEVICE_NAME,iosDevice1.get(MobileCapabilityType.DEVICE_NAME));
capabilities.setCapability(MobileCapabilityType.PLATFORM_NAME,iosDevice1.get(MobileCapabilityType.PLATFORM_NAME));
capabilities.setCapability(MobileCapabilityType.PLATFORM_VERSION, iosDevice1.get(MobileCapabilityType.PLATFORM_VERSION));
capabilities.setCapability(MobileCapabilityType.APP, System.getProperty("user.dir")+Constant.PATH_TO_IOS_IPA);
//capabilities.setCapability("bundleId", "im.vector.app");
//XCUITest is used because Appium Ios driver doesn't support xcode version 8.0
capabilities.setCapability(MobileCapabilityType.AUTOMATION_NAME,iosDevice1.get(MobileCapabilityType.AUTOMATION_NAME));
capabilities.setCapability(MobileCapabilityType.NO_RESET, true);
capabilities.setCapability(MobileCapabilityType.FULL_RESET, false);
capabilities.setCapability("xcodeOrgId", ReadConfigFile.getInstance().getConfMap().get("development_team"));
capabilities.setCapability("xcodeSigningId", ReadConfigFile.getInstance().getConfMap().get("code_sign_identity"));
capabilities.setCapability(IOSMobileCapabilityType.AUTO_DISMISS_ALERTS, false);
capabilities.setCapability(MobileCapabilityType.NEW_COMMAND_TIMEOUT, 1200);
// capabilities.setCapability("autoWebview", true);
AppiumFactory appiumFactory=AppiumFactory.getInstance();
appiumFactory.setiOSDriver1(new URL(Constant.getServer1HttpAddress()), capabilities);
System.out.println("Application "+Constant.APPLICATION_NAME+" started on IOS device "+capabilities.getCapability(MobileCapabilityType.DEVICE_NAME) +" with DRIVER 1.");
}
示例9: logOutIfNecessary
import org.testng.annotations.BeforeGroups; //导入依赖的package包/类
/**
* Log-out the user if it can't see the login page.
* @throws InterruptedException
*/
@BeforeGroups(groups="loginpage")
private void logOutIfNecessary() throws InterruptedException{
if(false==waitUntilDisplayed(appiumFactory.getiOsDriver1(),"AuthenticationVCView", true, 5)){
System.out.println("Can't access to the login page, a user must be logged. Forcing the log-out.");
RiotHomePageTabObjects homePage = new RiotHomePageTabObjects(appiumFactory.getiOsDriver1());
homePage.logOutFromTabs();
}
}
示例10: checkContactPermissionChecked
import org.testng.annotations.BeforeGroups; //导入依赖的package包/类
/**
* Open settings from recents list and check if contacts permission are checked on both devices.
* @throws InterruptedException
*/
@BeforeGroups("check_contacts_permission")
private void checkContactPermissionChecked() throws InterruptedException{
System.out.println("Check if contact permission is checked on device1.");
RiotHomePageTabObjects homePage1=new RiotHomePageTabObjects(appiumFactory.getAndroidDriver1());
RiotSettingsPageObjects settingsView1= homePage1.openRiotSettingsFromLateralMenu();
settingsView1.checkContactsPermissionIfNecessary(true);
settingsView1.actionBarBackButton.click();
System.out.println("Check if contact permission is checked on device2.");
RiotHomePageTabObjects homePage2=new RiotHomePageTabObjects(appiumFactory.getAndroidDriver1());
RiotSettingsPageObjects settingsView2= homePage2.openRiotSettingsFromLateralMenu();
settingsView2.checkContactsPermissionIfNecessary(true);
settingsView2.actionBarBackButton.click();
}
示例11: setWifiOffForNoConnectionTests
import org.testng.annotations.BeforeGroups; //导入依赖的package包/类
@BeforeGroups(groups="nointernet")
private void setWifiOffForNoConnectionTests(){
if(!appiumFactory.getAndroidDriver1().getConnection().equals(Connection.NONE)){
System.out.println("Setting up the connection to NONE for the tests without internet connection.");
appiumFactory.getAndroidDriver1().setConnection(Connection.NONE);
}
}
示例12: initialize
import org.testng.annotations.BeforeGroups; //导入依赖的package包/类
/**
* Initialize the test by deploying required artifacts.
* @throws Exception
*/
@BeforeGroups(groups = { "wso2.bps.task.people.assignment" })
protected void initialize() throws Exception {
log.info("Initializing HumanTask task creation Test...");
userManagementClient = new UserManagementClient(backEndUrl, sessionCookie);
addRoles();
humanTaskPackageManagementClient = new HumanTaskPackageManagementClient(backEndUrl, sessionCookie);
log.info("Add users success !");
humanTaskPackageManagementClient
.unDeployHumanTask(HumanTaskTestConstants.CLAIMS_APPROVAL_PACKAGE_ORG_ENTITY_NAME, "ApproveClaim");
deployArtifact();
requestSender.waitForProcessDeployment(backEndUrl + "ClaimService");
}
示例13: initialize
import org.testng.annotations.BeforeGroups; //导入依赖的package包/类
@BeforeGroups(groups = {"wso2.bps.task.people.assignment"})
protected void initialize() throws Exception {
log.info("Initializing HumanTask task creation Test...");
userManagementClient = new UserManagementClient(backEndUrl, sessionCookie);
addRoles();
humanTaskPackageManagementClient = new HumanTaskPackageManagementClient(backEndUrl, sessionCookie);
log.info("Add users success !");
deployArtifact();
requestSender.waitForProcessDeployment(backEndUrl + HumanTaskTestConstants.CLAIM_SERVICE);
}
示例14: clearDownloads
import org.testng.annotations.BeforeGroups; //导入依赖的package包/类
@BeforeGroups(groups = {"downloadLight", "downloadFull"})
public static void clearDownloads() {
File downloadDir = new File(EzHttp.getDownloadLocation());
String[]entries = downloadDir.list();
System.out.println("blah");
for(String s: entries != null ? entries : new String[0]){ //ternary operator lol
File currentFile = new File(downloadDir.getPath(),s);
currentFile.delete();
}
}
示例15: setupAllowAnonymous
import org.testng.annotations.BeforeGroups; //导入依赖的package包/类
/**
* Setups "allow anonymous access".
*/
@BeforeGroups(groups = { "allowAnonymous" })
public void setupAllowAnonymous() {
CommunoteRuntime
.getInstance()
.getConfigurationManager()
.updateClientConfigurationProperty(ClientProperty.CLIENT_BLOG_ALLOW_PUBLIC_ACCESS,
Boolean.toString(true));
AnonymousAuthenticationToken authToken = new AnonymousAuthenticationToken("login",
"anonymous", Arrays.asList(new GrantedAuthority[] { new SimpleGrantedAuthority(
AuthenticationHelper.ROLE_ANONYMOUS) }));
SecurityContextHolder.getContext().setAuthentication(authToken);
}