Start your SoapUI and create new soapUI project lik this:
Click OK to all questions. Your workspace now contains 'test-project' soapUI project under which you can find 'exampleSOAP' interface and 'exampleSOAP MockService'.
Start mock service by righ-click on 'exampleSOAP MockService' and select 'Start minimized'. If you have clean workspace without any changes in Preferences in SoapUI, mock service should listen on:
http://COMPUTER_NAME:8088/mockexampleSOAP
You can also open WSDL file in you browser by following URL:
http://COMPUTER_NAME:8088/mockexampleSOAP?WSDL
Next we can test your mock service by some request. Open 'Request1' under 'exampleSOAP/NewOperation':
You can see message '-no endpoint set-' or something like 'http://www.example.org/' in list box above request body. We need to add URL of our mock service to this list. Right-click on 'exampleSOAP MockService' and select 'Add Endpoint to Interface'.
Select new URL of our mock service in list box in request1 window.
Here is output:
We have running mock service and we can test it by SoapUI now. Save our project and open Preferences (Ctrl+Alt+P). Here we need to configure SSL for our mock service:
SSL port is different from port of your mock service (SSL = 18088, Service = 8088). Save preferences (File > Save preferences) and restart whole SoapUI. It has some issue with loading of certificates if you do not restart.
Start mock service againt.
Change endpoint protocol from https to http in URL and port from 8088 to 18088. Test you mock service. Is it working?
If you need to start you mock service without GUI, you can do it. Go to bin directory and try follow command:
Today we will try to test google.com page by Selenium. You can see structure of environment on following picture:
Selenium server installation
We will start by Selenium server which is connected to browser. In my example is used Internet Explorer.
Download Selenium server from Selenium. It will be only simple jar like selenium-server-standalone-2.35.0.jar. Next we need WebDriver driver for IE. It is under "The Internet Explorer Driver Server" on the same page. You will download IEDriverServer_Win32_2.35.1.zip file, which contains IEDriverServer.exe.
Copy both files into one directory and create starting script, for example start.bat:
SET JAVA_HOME="c:\progra~2\Java\jdk1.7.0_17"
SET PATH=%JAVA_HOME%\bin;%PATH%
java -jar selenium-server-standalone-2.35.0.jar -Dwebdriver.ie.driver=IEDriverServer.exe -port 14444
Start server by created script. Result can be something like:
You can see line with Selenium server URL in console: INFO - RemoteWebDriver instances should connect to: http://127.0.0.1:14444/wd/hub
We will use it later. Server side is ready.
Create Maven project
Now we need some test. Create directory structure. Maven can help you:
Create class GooglePage.java under src/test/java/com.mil.selenium.page. This class represents "Page Object" pattern so it models page (Google.com) to object.
package com.mil.selenium.page;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
public class GooglePage {
@FindBy(name = "q")
private WebElement search;
public void search(String query) {
search.sendKeys(query);
search.sendKeys(Keys.RETURN);
}
}
Next class is TestNG test which will call Page Object class.
Check testSearch() method. We open Google page, enter some query and check if there is some result. Simple.
If you want to close Internet Explorer browser after test, you need to call driver.quit(). See afterClass() method.
This test class cannot be started without Arquillian configuration. The following file is located in: src\test\resources\arquillian.xml
<?xml version="1.0" encoding="UTF-8"?>
<arquillian xmlns="http://jboss.org/schema/arquillian"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.org/schema/arquillian
http://jboss.org/schema/arquillian/arquillian_1_0.xsd">
<!-- Uncomment to have test archives exported to the file system for inspection -->
<!-- <engine> -->
<!-- <property name="deploymentExportPath">target/</property> -->
<!-- </engine> -->
<!-- Force the use of the Servlet 3.0 protocol with all containers, as it
is the most mature -->
<defaultProtocol type="Servlet 3.0" />
<!-- Example configuration for a remote JBoss AS 7 instance -->
<container qualifier="jboss" default="true">
<!-- If you want to use the JBOSS_HOME environment variable, just delete
the jbossHome property -->
<!-- configuration>
<property name="jbossHome">PATH_TO_JBOSS</property>
</configuration-->
</container>
<extension qualifier="webdriver">
<property name="browserCapabilities">internetExplorer</property>
<property name="javascriptEnabled">true</property>
<property name="remoteReusable">true</property>
<property name="remoteAddress">http://localhost:14444/wd/hub</property>
</extension>
<extension qualifier="graphene">
<property name="waitAjax">5</property>
<property name="waitGui">5</property>
<property name="waitModel">10</property>
</extension>
<!-- this is because of the dependency on testng-listener containing graphene
and drone, which automatically starts selenium server -->
<extension qualifier="selenium-server">
<property name="skip">true</property>
</extension>
</arquillian>
You do not need to change anything in this file. Only remoteAddress if you have Selenium server on different computer (mentioned previously).
Test run
Now you can test it. Try it by: mvn clean test
Your test will conect to configured Selenium server which will open Internet Explorer browser for your test.
Any issues? Ask please.
Do you have any experiences with OSGi? Do you know how to create OSGi bundle in Eclipse? Do you know how to start JBoss AS with OSGi support? You will know now ;)
Eclipse configuration
We need to configure Eclipse first. In my case it is Eclipse 4.3. You need to configure OSGi Framework under Preferences > Plug-in Development > Target Platform. Currently all plug-ins are included and it can cause many exceptions. So select (Active) platform, click Edit.
Click Content tab and select only these plug-ins:
org.eclipse.osgi
org.eclipse.equinox.console
org.apache.felix.gogo.runtime
org.apache.felix.gogo.shell
Creating bundle
Now we need to create our bundle (plug-in) under New > Plug-in Project like this:
Choose "Hello OSGi Bundle" as template. Your project will contain one simple activator which writes some message to System.out in case of start and stop of bundle.
Start OSGi framework in Eclipse
It is time to test our bundle. Right click on MANIFEST.MF file and choose Run As > OSGi Framework. If everything is OK, you should see start message from activator in console.
Try ss command to list all bundles:
We can try to export your new bundle to jar file. Righ click on bundle-test project, Export > Plug-in Development > Deployable plug-ins and fragments, choose your directory where jar will be created. Done.
Deploy bundle to JBoss AS
Start your JBoss 7 like: standalone.bat -c standalone-osgi.xml and copy your bundle jar into deployment directory. Quite simple, isn't it.
If you need Maven in your project, you can do it. Here is example of pom.xml: