SWTBot is a tool for automating UI tests of Eclipse plug-ins. The document covers setting up SWTBot, challenges of UI testing, exercises in using the SWTBot API to find widgets and perform actions, best practices like using abstractions and page objects, and tips for logging and timeouts. Key points include using matchers to find widgets robustly, ensuring thread safety, and modeling capabilities rather than UI elements.
SWTBot is a open source UI testing tool for SWT and Eclipse based applications. It requires bare minimum learning since it is Java based and integrates well with the JUnit framework.
An ideal unit testing tool for SWT and Eclipse based applications developers.
JavaScript Module Patterns: How to build and use JavaScript modules. We cover the Basic Module Pattern, Revealing Module Pattern, CommonJS, AMD, CommonJS, UMD and ES6 modules.
SWTBot is a open source UI testing tool for SWT and Eclipse based applications. It requires bare minimum learning since it is Java based and integrates well with the JUnit framework.
An ideal unit testing tool for SWT and Eclipse based applications developers.
JavaScript Module Patterns: How to build and use JavaScript modules. We cover the Basic Module Pattern, Revealing Module Pattern, CommonJS, AMD, CommonJS, UMD and ES6 modules.
JavaScript has some stunning features like Closures, Prototype etc. which can help to improve the readability and maintainability of the code. However, it is not easy for inexperienced developer to consume and apply those features in day to day coding. The purpose of the presentation ‘Advanced JavaScript’ is to help a reader easily understand the concept and implementation of some advanced JavaScript features.
Ce guide fournit un exemple de la manière dont Spring Boot vous aide à accélérer le développement d'applications. Au fur et à mesure que vous lirez plus de guides de démarrage de Spring, vous verrez plus de cas d'utilisation de Spring Boot. Ce guide est destiné à vous donner un aperçu rapide de Spring Boot. Si vous souhaitez créer votre propre projet basé sur Spring Boot, visitez Spring Initializr, remplissez les détails de votre projet, choisissez vos options et téléchargez un projet groupé sous forme de fichier zip.
As Atlassian Connect is the way forward for building add-ons on Atlassian Cloud, Spring Boot is the way forward for building Spring web applications. Now you can combine the best of both worlds with the new open source library: Atlassian Connect Starter for Spring Boot. This will get you bootstrapped with an Atlassian Connect add-on in just a few minutes. In this talk you will learn:
What is Spring Boot
What is a Spring Boot Starter and how they benefit you
How to use the Atlassian Connect Starter to easily build Atlassian Connect add-ons
The Atlassian Connect architecture and how it interacts with your add-ons
We will write a simple macro for Confluence and show how much time Spring Boot can save you.
All 3 Clean Code presentations provide great value by themselves, but taken together are designed to offer a holistic approach to successful software creation. This first session creates the foundation for the 2nd and 3rd Clean Code presentation on Dependency Injection, as it explains expected base knowledge. Why writing Clean Code makes us more efficient Over the lifetime of a product, maintaining the product is actually one - if not the most - expensive area(s) of the overall product costs.
We will dive into the basics of Inversion of Control (IOC) and Dependency Injection (DI) to review different ways of achieving decoupling, using and exploring both: Best Practices, Design and Anti Patterns. This presentation requires knowledge and understanding of basics like DRY, SoC, SRP, SOLID etc. which are building the base for decoupled architecture. However, we will start at the basics of DI and will work towards intermediate and advanced scenarios depending on the participating group.
This presentation is based on C# and Visual Studio 2013. However, the demonstrated patterns and practice can be applied to every other programming language too.
Note: Moving forwards this presentation will be updated with the latest version of the slides for the last event I did the presentation instead of creating new separate slide decks here on SlideShare.
Presentation dates and locations:
2015-10-03 Silicon Valley Code Camp, San Jose, CA
2015-06-27 SoCal Code Camp - San Diego, CA
2015-06-25 Bay.NET South Bay, Mountain View, CA
2014-11-14 SoCal Code Camp - Los Angeles, CA
2014-10-11 Silicon Valley Code Camp, Los Altos Hills, CA
JavaScript has some stunning features like Closures, Prototype etc. which can help to improve the readability and maintainability of the code. However, it is not easy for inexperienced developer to consume and apply those features in day to day coding. The purpose of the presentation ‘Advanced JavaScript’ is to help a reader easily understand the concept and implementation of some advanced JavaScript features.
Ce guide fournit un exemple de la manière dont Spring Boot vous aide à accélérer le développement d'applications. Au fur et à mesure que vous lirez plus de guides de démarrage de Spring, vous verrez plus de cas d'utilisation de Spring Boot. Ce guide est destiné à vous donner un aperçu rapide de Spring Boot. Si vous souhaitez créer votre propre projet basé sur Spring Boot, visitez Spring Initializr, remplissez les détails de votre projet, choisissez vos options et téléchargez un projet groupé sous forme de fichier zip.
As Atlassian Connect is the way forward for building add-ons on Atlassian Cloud, Spring Boot is the way forward for building Spring web applications. Now you can combine the best of both worlds with the new open source library: Atlassian Connect Starter for Spring Boot. This will get you bootstrapped with an Atlassian Connect add-on in just a few minutes. In this talk you will learn:
What is Spring Boot
What is a Spring Boot Starter and how they benefit you
How to use the Atlassian Connect Starter to easily build Atlassian Connect add-ons
The Atlassian Connect architecture and how it interacts with your add-ons
We will write a simple macro for Confluence and show how much time Spring Boot can save you.
All 3 Clean Code presentations provide great value by themselves, but taken together are designed to offer a holistic approach to successful software creation. This first session creates the foundation for the 2nd and 3rd Clean Code presentation on Dependency Injection, as it explains expected base knowledge. Why writing Clean Code makes us more efficient Over the lifetime of a product, maintaining the product is actually one - if not the most - expensive area(s) of the overall product costs.
We will dive into the basics of Inversion of Control (IOC) and Dependency Injection (DI) to review different ways of achieving decoupling, using and exploring both: Best Practices, Design and Anti Patterns. This presentation requires knowledge and understanding of basics like DRY, SoC, SRP, SOLID etc. which are building the base for decoupled architecture. However, we will start at the basics of DI and will work towards intermediate and advanced scenarios depending on the participating group.
This presentation is based on C# and Visual Studio 2013. However, the demonstrated patterns and practice can be applied to every other programming language too.
Note: Moving forwards this presentation will be updated with the latest version of the slides for the last event I did the presentation instead of creating new separate slide decks here on SlideShare.
Presentation dates and locations:
2015-10-03 Silicon Valley Code Camp, San Jose, CA
2015-06-27 SoCal Code Camp - San Diego, CA
2015-06-25 Bay.NET South Bay, Mountain View, CA
2014-11-14 SoCal Code Camp - Los Angeles, CA
2014-10-11 Silicon Valley Code Camp, Los Altos Hills, CA
The Open Container Initiative (OCI) at 12 monthsChris Aniszczyk
An Open Container Initiative (OCI) talk given at DockerCon 2016 discussing the status of the initiative, along with progress on the runtime-spec and image-spec
[EclipseCon NA 2014] Integration tests for RCP made easy with SWTBot and TychoMickael Istria
https://www.eclipsecon.org/na2014/session/integration-tests-rcp-made-easy-swtbot-and-tycho
Although we live in a modular world, it will always make sense to write and run integration-tests that allow the testing of the whole application, and not just a module. These integration-tests are often the only way to test real usage scenarios that rely on multiple modules and that can be affected by other modules and by the packaging of your application.
Some recent improvements have happened in the Eclipse world to make it easier to produce and run integration tests for RCP applications, reducing significantly their cost while keeping their coverage high, and conformance to real use-cases and ability to spot bugs. This presentation will show how SWTBot Test Recorder can be used to speed up the creation of valid integration-tests against your RCP product, and how Tycho can be used to run it easily on any existing and packaged RCP application, the same as the one your users will get.
Alexey Buzdin "Maslow's Pyramid of Android Testing"IT Event
You all know what tests are. You all know you need to write them. But also you know it’s hard to start writing tests for mobile app thus you usually neglect it. Let’s look into Android automation testing, what technologies and approaches we can use to have a complete Maslow's Pyramid for testing. Unit Testing, Integration Testing, UI Automation, Mocking etc.
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton ClassesOXUS 20
A Virtual Keyboard is considered to be a component to use on computers without a real keyboard e.g. Touch Screen Computers and Smart Phones; where a mouse can utilize the keyboard functionalities and features.
In addition, Virtual Keyboard used for the following subjects: Foreign Character Sets, Touchscreen, Bypass Key Loggers, etc.
JavaFX 8 est disponible depuis mars 2014 et apporte son lot de nouveautés. Gradle est en version 2 depuis juillet 2014. Deux technologies plus que prometteuses: JavaFX donne un coup de jeune au développement d’applications desktop en Java en apportant un navigateur web intégré, le support des WebSockets, de la 3D, et bien d’autres. Gradle est l’outil de d’automatisation de build à la mode, apportant de superbes possibilités par rapport rapport à maven, outil vieillissant, grâce à l’engouement de la communauté vis à vis de cet outil mais aussi par le fait de la technologie utilisée en son sein: groovy. Venez découvrir comment il est possible de réaliser rapidement une application à la mode en JavaFX avec un outil à la mode également. Bref venez à une session trendy.
Le temps est révolu où Java EE ne serait qu’à développer des applications de mise à jour de données, avec JSF / EJB / JPA. Aujourd’hui Java EE s’est assoupli et s’est ouvert sur le monde, avec CDI comme clé de voûte et a repoussé nos limites grâce à des capacités d’extension puissantes et faciles d’utilisation comme JCA.
Dans un premier temps, nous reviendrons rapidement sur la place de CDI dans JavaEE 7 et sur ses mécanismes d’extension. Dans un deuxième temps, nous verrons les techniques de connecteurs JCA et comment ils peuvent aussi constituer une possibilité d’ouverture simple à mettre en œuvre. JCA fournit des techniques pour gérer des connexions sortantes ou entrantes, sur des formats ou protocoles variés.
Last year, AOL adopted a new content strategy and has positioned itself as a premier destination for original content. Core to this strategy is having reusable, highly efficient and optimized common code and experiences at scale, which is where jQuery comes in. Check in with Dave Artz to see how jQuery has helped his front-end standards team tackle unique challenges like optimizing 3rd party widget performance, overriding plugin functionality, and managing dependencies and updates across 100+ sites spanning multiple back-end platforms.
Presentation given at Open Source Summit Japan 2016 about the state of the cloud native technology (Cloud Native Computing Foundation) and the standardization of container technology (Open Container Initiative)
The Art of the Pitch: WordPress Relationships and SalesLaura Byrne
Clients don’t know what they don’t know. What web solutions are right for them? How does WordPress come into the picture? How do you make sure you understand scope and timeline? What do you do if sometime changes?
All these questions and more will be explored as we talk about matching clients’ needs with what your agency offers without pulling teeth or pulling your hair out. Practical tips, and strategies for successful relationship building that leads to closing the deal.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
PHP Frameworks: I want to break free (IPC Berlin 2024)Ralf Eggert
In this presentation, we examine the challenges and limitations of relying too heavily on PHP frameworks in web development. We discuss the history of PHP and its frameworks to understand how this dependence has evolved. The focus will be on providing concrete tips and strategies to reduce reliance on these frameworks, based on real-world examples and practical considerations. The goal is to equip developers with the skills and knowledge to create more flexible and future-proof web applications. We'll explore the importance of maintaining autonomy in a rapidly changing tech landscape and how to make informed decisions in PHP development.
This talk is aimed at encouraging a more independent approach to using PHP frameworks, moving towards a more flexible and future-proof approach to PHP development.
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
Kubernetes & AI - Beauty and the Beast !?! @KCD Istanbul 2024Tobias Schneck
As AI technology is pushing into IT I was wondering myself, as an “infrastructure container kubernetes guy”, how get this fancy AI technology get managed from an infrastructure operational view? Is it possible to apply our lovely cloud native principals as well? What benefit’s both technologies could bring to each other?
Let me take this questions and provide you a short journey through existing deployment models and use cases for AI software. On practical examples, we discuss what cloud/on-premise strategy we may need for applying it to our own infrastructure to get it to work from an enterprise perspective. I want to give an overview about infrastructure requirements and technologies, what could be beneficial or limiting your AI use cases in an enterprise environment. An interactive Demo will give you some insides, what approaches I got already working for real.
DevOps and Testing slides at DASA ConnectKari Kakkonen
My and Rik Marselis slides at 30.5.2024 DASA Connect conference. We discuss about what is testing, then what is agile testing and finally what is Testing in DevOps. Finally we had lovely workshop with the participants trying to find out different ways to think about quality and testing in different parts of the DevOps infinity loop.
Transcript: Selling digital books in 2024: Insights from industry leaders - T...BookNet Canada
The publishing industry has been selling digital audiobooks and ebooks for over a decade and has found its groove. What’s changed? What has stayed the same? Where do we go from here? Join a group of leading sales peers from across the industry for a conversation about the lessons learned since the popularization of digital books, best practices, digital book supply chain management, and more.
Link to video recording: https://bnctechforum.ca/sessions/selling-digital-books-in-2024-insights-from-industry-leaders/
Presented by BookNet Canada on May 28, 2024, with support from the Department of Canadian Heritage.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
16. All exercises focus around...
creating a java project “MyFirstProject”
create a java class
type in a program that prints “Hello, World”
execute the program
verify that the program printed “Hello, World”
24. Create a simple Test
@RunWith(SWTBotJunit4ClassRunner.class)
public class Test01 {
@Test
public void thisOneFails() throws Exception {
fail("this test fails");
}
@Test
public void thisOnePasses() throws Exception {
pass();
}
}
27. Finding widgets
SWTWorkbenchBot bot = new SWTWorkbenchBot();
SWTBot[Widget] widget = bot.[widget][With][Matcher(s)]();
SWTBotText text = bot.textWithLabel("Username:");
Think of the bot as something that can
do tasks for you (e.g., find widgets, click
on them, etc.)
28. Finding obscure widgets
Use matchers and WidgetMatcherFactory!
withLabel("Username:") Matcher pushButtonToProceedToNextStep = allOf(
withMnemonic("Finish") widgetOfType(Button.class),
withText("&Finish") withStyle(SWT.PUSH),
inGroup("Billing Address") withRegex("Proceed to step (.*) >")
widgetOfType(Button.class) );
withStyle(SWT.RADIO)
withTooltip("Save All") SWTBotButton button = new SWTBotButton(
withRegex("Welcome, (.*)") (Button)
bot.widget(pushButtonToProceedToNextStep)
);
29. Performing actions
button.click() // click on a button
// chain methods to make them concise
bot.menu("File").menu("New").menu("Project...").click();
tree.expand("Project").expand("src").expand("Foo.java").contextMenu("Delete").clic
k(); // delete Foo.java
list.select("Orange", "Banana", "Mango"); // make a selection in a list
list.select(2, 5, 6); // make a selection using indexes
31. Objectives
Get introduced to the SWTBot API
SWTWorkbenchBot is your friend
Tasks
beforeClass() - close the welcome view
canCreateANewProject() - create a java project
Run the test!
Ensure SWTBot logging works
32. beforeClass()
@BeforeClass
public static void beforeClass() throws Exception {
bot = new SWTWorkbenchBot();
bot.viewByTitle("Welcome").close();
}
39. Find all widgets
Depth first traversal of UI elements
1.Find top level widgets
1.Find children of each widget
2.For each child do (1) and (2)
40. Finding widgets
public SWTBotTree treeWithLabelInGroup(String l, String g, int i) {
// create the matcher
Matcher matcher =
allOf(
widgetOfType(Tree.class), withLabel(l), inGroup(g)
);
// find the widget, with redundancy built in
Tree tree = (Tree) widget(matcher, index);
// create a wrapper for thread safety
// and convinience APIs
return new SWTBotTree(tree, matcher);
}
42. Thread Safety (Query state)
public class SWTBotCheckBox {
public boolean isChecked() {
// evaluate a result on the UI thread
return syncExec(new BoolResult() {
public Boolean run() {
return widget.getSelection();
}
});
}
}
43. Thread Safety(change state)
public class SWTBotCheckBox {
public void select() {
asyncExec(new VoidResult() {
public void run() {
widget.setSelection(true);
}
});
notifyListeners();
}
protected void notifyListeners() {
notify(SWT.MouseDown);
notify(SWT.MouseUp);
notify(SWT.Selection);
}
}
45. Objectives
Tasks
canCreateANewJavaClass()
create a new java class: HelloWorld
Source folder: MyFirstProject/src
Package: org.eclipsecon.project
Click Finish!
Run the test!
50. canExecuteJavaApplication()
@Test
public void canExecuteJavaApplication() throws Exception {
bot.menu("Run").menu("Run").click();
// FIXME: verify that the program printed 'Hello World'
}
53. Objectives
Learn about SWTBot and the Matcher API
Tasks
canExecuteJavaApplication()
Run the Java application
Grab the Console view
Verify that “Hello World” is printed
Run the tests!
55. Matchers
Under the covers, SWTBot uses Hamcrest
Hamcrest is a framework for writing ‘match’ rules
SWTBot is essentially all about match rules
bot.widget(WidgetMatcherFactory.widgetO
fType(StyledText.class),
consoleViewComposite);
60. Objectives
Learn about waiting and SWTBot Condition API
Tasks
afterClass()
Select the Package Explorer view
Select MyFirstProject
Right click and delete the project
Run the test!
61. afterClass()
@AfterClass
public static void afterClass() throws Exception {
SWTBotView packageExplorerView = bot.viewByTitle("Package Explorer");
packageExplorerView.show();
Composite packageExplorerComposite = (Composite) packageExplorerView.getWidget();
Tree swtTree =
(Tree) bot.widget(WidgetMatcherFactory.widgetOfType(Tree.class), packageExplorerComposite);
SWTBotTree tree = new SWTBotTree(swtTree);
tree.select("MyFirstProject");
bot.menu("Edit").menu("Delete").click();
// the project deletion confirmation dialog
SWTBotShell shell = bot.shell("Delete Resources");
shell.activate();
bot.checkBox("Delete project contents on disk (cannot be undone)").select();
bot.button("OK").click();
bot.waitUntil(shellCloses(shell));
}
62. Handling long operations
describe a condition
poll for the condition at intervals
wait for it to evaluate to true or false
of course there’s a timeout
SWTBot has an ICondition
67. Abstractions are good!
They simplify writing tests for QA folks
Build page objects for common “services”
Project Explorer
The Editor
The Console View
The main menu bar, tool bar
71. Sample Domain Object
public class JavaProject {
public JavaProject create(String projectName){
// create a project and return it
}
public JavaProject delete(){
// delete the project and return it
}
public JavaClass createClass(String className){
// create a class and return it
}
}
73. Page Objects?
Represent the services offered by the page to the test
developer
Internally knows the details about how these services
are offered and the details of UI elements that offer
them
Return other page objects to model the user’s journey
through the application
Different results of the same operation modeled
74. Page Objects... should not
Expose details about user interface elements
Make assertions about the state of the UI
75. A Sample Page Object
public class LoginPage {
public HomePage loginAs(String user, String pass) {
// ... clever magic happens here
}
public LoginPage loginAsExpectingError(String user, String pass) {
// ... failed login here, maybe because one or both of
// username and password are wrong
}
public String getErrorMessage() {
// So we can verify that the correct error is shown
}
}
76. Using Page Objects
// the bad test
public void testMessagesAreReadOrUnread() {
Inbox inbox = new Inbox(driver);
inbox.assertMessageWithSubjectIsUnread("I like cheese");
inbox.assertMessageWithSubjectIsNotUndread("I'm not fond of tofu");
}
// the good test
public void testMessagesAreReadOrUnread() {
Inbox inbox = new Inbox(driver);
assertTrue(inbox.isMessageWithSubjectIsUnread("I like cheese"));
assertFalse(inbox.isMessageWithSubjectIsUnread("I'm not fond of tofu"));
}
77. LoginPage login = new LoginPage();
HomePage home = login.loginAs("username", "secret");
SearchPage search = home.searchFor("swtbot");
assertTrue(search.containsResult("http://eclipse.org/swtbot"));
79. Objectives
Learn about page and domain objects
Tasks
Create a NewProjectBot
Opens the new project wizard
Allows you to set the project name and click finish
Modify canCreateANewJavaProject()
Run the test!
80. NewProjectBot
public class NewProjectBot {
private static SWTWorkbenchBot bot;
public NewProjectBot() {
bot.menu("File").menu("New").menu("Project...").click();
bot.shell("New Project").activate();
bot.tree().select("Java Project");
bot.button("Next >").click();
}
public void setProjectName(String projectName) {
bot.textWithLabel("Project name:").setText(projectName);
}
public void finish() {
bot.button("Finish").click();
}
}
81. Modify Project Wizard Code
@Test
public void canCreateANewJavaProject() throws Exception {
// use the NewProjectBot abstraction
NewProjectBot newProjectBot = new NewProjectBot();
newProjectBot.setProjectName("MyFirstProject");
newProjectBot.finish();
assertProjectCreated();
}
83. Logging
Turn logging on always, it helps :)
http://wiki.eclipse.org/SWTBot/
FAQ#How_do_I_configure_log4j_to_turn_on
_logging_for_SWTBot.3F
84. Slow down executions
Useful for debugging at times...
SWTBotPreferences.PLAYBACK_DELAY
-Dorg.eclipse.swtbot.playback.delay=20
or via code...
long oldDelay = SWTBotPreferences.PLAYBACK_DELAY;
// increase the delay
SWTBotPreferences.PLAYBACK_DELAY = 10;
// do whatever
// set to the original timeout of 5 seconds
SWTBotPreferences.PLAYBACK_DELAY = oldDelay;
85. Changing Timeout
SWTBotPreferences.TIMEOUT
-Dorg.eclipse.swtbot.search.timeout=10000
or via code...
long oldTimeout = SWTBotPreferences.TIMEOUT;
// increase the timeout
SWTBotPreferences.TIMEOUT = 10000;
// do whatever
// set to the original timeout of 5 seconds
SWTBotPreferences.TIMEOUT = oldTimeout;
86. Identifiers
In our examples, we used labels as matchers mostly
SWTBot allows you to use IDs as matchers
IDs are less brittle than labels!
text.setData(SWTBotPreferences.DEFAULT_
KEY,”id”)
bot.textWithId(“id”)
87. Page Objects
Use Page Objects to simplify writing tests
Allows more people than just normal devs to write tests
Should:
* Represent the services offered by the page to the test developer
* Internally knows the details about how these services are offered and the details of UI elements that offer them
* Return other page objects to model the user’s journey through the application
* Different results of the same operation modeled differently
Should not:
* Expose details about user interface elements
* Make assertions about the state of the UI