本文整理汇总了Java中org.testng.SkipException类的典型用法代码示例。如果您正苦于以下问题:Java SkipException类的具体用法?Java SkipException怎么用?Java SkipException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SkipException类属于org.testng包,在下文中一共展示了SkipException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: whetherMenusAreAccessible
import org.testng.SkipException; //导入依赖的package包/类
@Override public void whetherMenusAreAccessible() throws Throwable {
Toolkit.getDefaultToolkit().addAWTEventListener(new AWTEventListener() {
@Override public void eventDispatched(AWTEvent event) {
System.err.println(event);
}
}, AWTEvent.KEY_EVENT_MASK);
if (Platform.getCurrent() == Platform.MAC && System.getProperty("java.version", "").matches("1.[78].*")) {
throw new SkipException("Menu mneomonics are not handled on Mac under Java 1.7+");
}
exitItemCalled = false;
driver.sendKeys(textField, JavaAgentKeys.chord(JavaAgentKeys.ALT, "f"));
new WaitWithoutException("Waiting for exit item to be shown") {
@Override public boolean until() {
return exitItem.isShowing();
}
};
driver.click(exitItem, Buttons.LEFT, 1, 0, 0);
new WaitWithoutException("Waiting for exit item to be called") {
@Override public boolean until() {
return exitItemCalled;
}
};
AssertJUnit.assertEquals(true, exitItemCalled);
}
示例2: whetherMenusAreAccessible
import org.testng.SkipException; //导入依赖的package包/类
@Override public void whetherMenusAreAccessible() throws Throwable {
if (Platform.getCurrent() == Platform.MAC && System.getProperty("java.version", "").matches("1.[78].*")) {
throw new SkipException("Menu mneomonics are not handled on Mac under Java 1.7+");
}
exitItemCalled = false;
driver.sendKeys(textField, JavaAgentKeys.chord(JavaAgentKeys.ALT, "f"));
new WaitWithoutException("Waiting for exit item to be called") {
@Override public boolean until() {
return menu.isPopupMenuVisible();
}
};
driver.sendKeys(exitItem, JavaAgentKeys.ENTER);
new WaitWithoutException("Waiting for exit item to be called") {
@Override public boolean until() {
return exitItemCalled;
}
};
AssertJUnit.assertEquals(true, exitItemCalled);
}
示例3: contextclickOnTextfield
import org.testng.SkipException; //导入依赖的package包/类
public void contextclickOnTextfield() throws Throwable {
if (Platform.getCurrent().is(Platform.MAC)) {
throw new SkipException("Context clicking a textfield on mac and java 1.7+ doesn't work and don't know why!!!");
}
try {
Thread.sleep(10000);
textFieldClicked = false;
driver.click(textField, Buttons.RIGHT, 1, 1, 1);
new DeviceTest.WaitWithoutException("Waiting for the text field to be clicked") {
@Override public boolean until() {
return textFieldClicked;
}
};
AssertJUnit.assertTrue(textFieldClicked);
} finally {
Logger.getLogger(DeviceMouseTest.class.getName()).info(tfMouseText.toString());
}
}
示例4: sendKeysKeyboardMap
import org.testng.SkipException; //导入依赖的package包/类
public void sendKeysKeyboardMap() throws Throwable {
if (System.getProperty("java.version", "").matches("1.7.*") && isRobot()) {
throw new SkipException("Fails on Java 1.7, looks like some problem with Robot in 1.7");
}
kss.clear();
driver.sendKeys(textField, "A");
new WaitWithoutException("Waiting for the keypress") {
@Override public boolean until() {
try {
return kss.toString().contains(KeyStroke.getKeyStroke("released SHIFT").toString());
} catch (Throwable t) {
return false;
}
}
};
List<KeyStroke> expected = Arrays.asList(KeyStroke.getKeyStroke("shift pressed SHIFT"),
KeyStroke.getKeyStroke("shift pressed A"), KeyStroke.getKeyStroke("shift typed A"),
KeyStroke.getKeyStroke("shift released A"), KeyStroke.getKeyStroke("released SHIFT"));
AssertJUnit.assertEquals(expected.toString(), kss.toString());
}
示例5: sendKeysSelectAll
import org.testng.SkipException; //导入依赖的package包/类
public void sendKeysSelectAll() throws Throwable {
if (System.getProperty("java.version", "").matches("1.7.*") && isRobot()) {
throw new SkipException("Fails on Java 1.7, looks like some problem with Robot in 1.7");
}
driver.sendKeys(textField, "Hello World");
driver.sendKeys(textField, getOSKey(), "a");
driver.sendKeys(textField, JavaAgentKeys.NULL);
new WaitWithoutException("Waiting for the select event") {
@Override public boolean until() {
try {
Object text = EventQueueWait.call(textField, "getSelectedText");
return text != null && text.equals("Hello World");
} catch (NoSuchMethodException e) {
e.printStackTrace();
return false;
}
}
};
String expected = "Hello World";
AssertJUnit.assertEquals(expected, EventQueueWait.<String> call(textField, "getSelectedText"));
}
示例6: whetherMenusAreAccessible
import org.testng.SkipException; //导入依赖的package包/类
public void whetherMenusAreAccessible() throws Throwable {
if (Platform.getCurrent() == Platform.MAC && System.getProperty("java.version", "").matches("1.[78].*")) {
throw new SkipException("Menu mneomonics are not handled on Mac under Java 1.7+");
}
exitItemCalled = false;
driver.sendKeys(textField, JavaAgentKeys.chord(JavaAgentKeys.ALT, "f"));
new WaitWithoutException("Waiting for exit item to be called") {
@Override public boolean until() {
return menu.isPopupMenuVisible();
}
};
driver.sendKeys(exitItem, JavaAgentKeys.ENTER);
new WaitWithoutException("Waiting for exit item to be called") {
@Override public boolean until() {
return exitItemCalled;
}
};
AssertJUnit.assertEquals(true, exitItemCalled);
}
示例7: executeWSCommand
import org.testng.SkipException; //导入依赖的package包/类
public void executeWSCommand() throws Throwable {
if (OS.isFamilyWindows()) {
throw new SkipException("Test not valid for Windows");
}
JavaProfile profile = new JavaProfile(LaunchMode.JAVA_WEBSTART).addWSArgument("-verbose").addVMArgument("-Dx.y.z=hello");
final CommandLine commandLine = profile.getCommandLine();
AssertJUnit.assertNotNull(commandLine);
AssertJUnit.assertTrue(commandLine.toString().contains("-javaagent:"));
AssertJUnit.assertTrue(commandLine.toString().contains("-verbose"));
AssertJUnit.assertTrue(commandLine.toString().contains("-Dx.y.z=hello"));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
commandLine.copyOutputTo(baos);
commandLine.executeAsync();
new Wait("Waiting till the command is complete") {
@Override public boolean until() {
return !commandLine.isRunning();
}
};
BufferedReader reader = new BufferedReader(new StringReader(new String(baos.toByteArray())));
String line = reader.readLine();
while (line != null && !line.contains("Web Start")) {
line = reader.readLine();
}
AssertJUnit.assertTrue(line.contains("Web Start"));
}
示例8: shouldThrowHiddenMalformedURLException
import org.testng.SkipException; //导入依赖的package包/类
@Test
public void shouldThrowHiddenMalformedURLException() {
XmlConfig config = new XmlConfig(new HashMap<String, String>() {
{
put(BROWSER_NAME, "firefox");
put(PLATFORM_NAME, "ANY");
}
});
Browser browser = spy(firefox);
doReturn("localhost").when(browser).url();
assertThat(catchThrowable(() -> defaultFactory.createDriver(browser, config)))
.isInstanceOf(SkipException.class)
.hasStackTraceContaining("java.net.MalformedURLException");
}
示例9: testIndexedCorola
import org.testng.SkipException; //导入依赖的package包/类
@Test
public void testIndexedCorola() throws IOException, SAXException, ParserConfigurationException, GGSException {
IndexedLuceneCorpus t;
try {
t = new IndexedLuceneCorpus(new File("TestData/inputCorpora/corola.index"));
} catch (IOException e) {
throw new SkipException("indexed corola not present");
}
Grammar g = new Grammar();
//g.load(new FileInputStream("TestData/inputGrammars/roNPchunker_grammar.ggf"));
//g.load(new FileInputStream("TestData/inputGrammars/npexample.ggf"));
g.load(new FileInputStream("TestData/inputGrammars/verysimplegrammar.ggf"));
SparseBitSet.compressionPolicy = SparseBitSet.SparseBitSetCompressionPolicy.none;
CompiledGrammar compiledGrammar = new CompiledGrammar(g);
List<Match> matches = compiledGrammar.GetMatches(t, true);
assert (matches.size() == matches.size());
}
示例10: testOnPingIncorrect
import org.testng.SkipException; //导入依赖的package包/类
public void testOnPingIncorrect(boolean fin, boolean rsv1, boolean rsv2,
boolean rsv3, ByteBuffer data) {
if (fin && !rsv1 && !rsv2 && !rsv3 && data.remaining() <= 125) {
throw new SkipException("Correct frame");
}
CompletableFuture<WebSocket> webSocket = new CompletableFuture<>();
MockChannel channel = new MockChannel.Builder()
.provideFrame(fin, rsv1, rsv2, rsv3, Opcode.PING, data)
.expectClose((code, reason) ->
Integer.valueOf(1002).equals(code) && "".equals(reason))
.build();
MockListener listener = new MockListener.Builder()
.expectOnOpen((ws) -> true)
.expectOnError((ws, error) -> error instanceof ProtocolException)
.build();
webSocket.complete(newWebSocket(channel, listener));
checkExpectations(500, TimeUnit.MILLISECONDS, channel, listener);
}
示例11: setup
import org.testng.SkipException; //导入依赖的package包/类
@BeforeClass
public void setup() throws DrmaaException, IOException {
if (System.getProperty("org.ggf.drmaa.SessionFactory") == null) {
throw new SkipException(
"Could not find system property org.ggf.drmaa.SessionFactory."
);
}
executorService = Executors.newScheduledThreadPool(4);
drmaaSession = SessionFactory.getFactory().getSession();
drmaaSession.init("");
tempDir = Files.createTempDirectory(getClass().getSimpleName());
drmaaExecutor = new DrmaaSimpleModuleExecutor.Builder(drmaaSession, tempDir, DummyCommandProvider.INSTANCE,
executorService, executorService)
.build();
}
示例12: canFilterImages
import org.testng.SkipException; //导入依赖的package包/类
@Test(dependsOnMethods = "canListImages")
public void canFilterImages() throws IOException {
try (CloudApiConnectionContext context = cloudApi.createConnectionContext()) {
final String expectedOs = "linux";
ImageFilter pf = new ImageFilter()
.setOs(expectedOs);
final Collection<Image> images = imagesApi.list(context, pf);
if (images.isEmpty()) {
String msg = "Verify that there is at least a single image";
throw new SkipException(msg);
}
for (Image pkg : images) {
logger.debug("Found image: {}", pkg.getName());
assertEquals(pkg.getOs(), expectedOs,
"OS didn't match filter. Images:\n" + images);
}
}
}
示例13: setUp
import org.testng.SkipException; //导入依赖的package包/类
/**
* Setup TestNG method to create Rapture login object and objects.
*
* @param RaptureURL
* Passed in from <env>_testng.xml suite file
* @param RaptureUser
* Passed in from <env>_testng.xml suite file
* @param RapturePassword
* Passed in from <env>_testng.xml suite file
* @return none
*/
@BeforeClass(groups = { "structured", "postgres","nightly" })
@Parameters({ "RaptureURL", "RaptureUser", "RapturePassword" })
public void setUp(@Optional("http://localhost:8665/rapture") String url, @Optional("rapture") String username, @Optional("rapture") String password) {
// If running from eclipse set env var -Penv=docker or use the following
// url variable settings:
// url = "http://192.168.99.100:8665/rapture"; // docker
// url="http://localhost:8665/rapture";
try {
helper = new IntegrationTestHelper(url, username, password);
} catch (Exception e) {
throw new SkipException("Cannot connect to IntegrationTestHelper " + e.getMessage());
}
structApi = helper.getStructApi();
admin = helper.getAdminApi();
pluginApi = helper.getPluginApi();
if (!admin.doesUserExist(user)) {
admin.addUser(user, "Another User", MD5Utils.hash16(user), "[email protected]");
}
repoUri = helper.getRandomAuthority(Scheme.DOCUMENT);
helper.configureTestRepo(repoUri, "MONGODB"); // TODO Make this configurable
}
示例14: testVisit_reference
import org.testng.SkipException; //导入依赖的package包/类
@Test
public void testVisit_reference() throws Exception {
String testInput =
"Here's a [link] [1] with an ampersand in the URL.\n\n" +
"Here's a link with an amersand in the link text: [AT&T] [2].\n\n" +
"Here's an inline [link](</script?foo=1&bar=2>).\n\n\n" +
"[1]: http://example.com/?foo=1&bar=2\n" +
"[2]: http://att.com/ \"AT&T\"\n";
List<String> expected = new ArrayList<>();
expected.add("Here's a [link] [1] with an ampersand in the URL.");
expected.add("Here's a link with an amersand in the link text: [AT&T] [2].");
expected.add("Here's an inline [link](</script?foo=1&bar=2>).");
expected.add("[1]: http://example.com/?foo=1&bar=2");
expected.add("[2]: http://att.com/ \"AT&T\"");
MockFilter filter = new MockFilter();
filter.process(testInput);
throw new SkipException("Skip acceptance test.(known bug)");
// FIXME:
// Entry[2] becomes "Here's an inline [link](/script?foo=1&bar=2)."
//
//assertEquals(filter.getEntries(), expected);
//assertEquals(filter.getOutbuf(), testInput);
}
示例15: nativeMatcherExactTest
import org.testng.SkipException; //导入依赖的package包/类
@Test(dataProvider = "pathMatcherData")
public static void nativeMatcherExactTest(@NotNull String pattern, @NotNull String path, @Nullable Boolean ignored, @Nullable Boolean expectedMatch) throws InvalidPatternException, IOException, InterruptedException {
Path temp = Files.createTempDirectory("git-matcher");
try {
if (new ProcessBuilder()
.directory(temp.toFile())
.command("git", "init", ".")
.start()
.waitFor() != 0) {
throw new SkipException("Can't find git");
}
Files.write(temp.resolve(".gitattributes"), (pattern + " test\n").getBytes(StandardCharsets.UTF_8));
byte[] output = ByteStreams.toByteArray(
new ProcessBuilder()
.directory(temp.toFile())
.command("git", "check-attr", "-a", "--", path)
.start()
.getInputStream()
);
Assert.assertEquals(output.length > 0, expectedMatch == Boolean.TRUE);
} finally {
Files.walkFileTree(temp, new DeleteTreeVisitor());
}
}