How to write Java code using ther Jubula client API - api

I am new to the testing environment and have been searching for tutorials on Jubula client API.
Fortunately I have managed to find one, but still I am unable to launch my project. Till now I have installed the JUnit plugin in Jubula and configured the AUT on the standalone. Am I supposed to straight away make the JUnit unit test class or something else has to be done?

There is an FAQ on the Jubula Testing Portal about this:
http://testing.bredex.de/faqs/jubula-api-setup.html

You need to connect to the AUT first and map the objects from the app accordingly for usage and launch the test application.
Assign the variables or objects from the Swing or HTML and perform the required testing according to need.
For example:
public static final ComponentIdentifier btnFileExit = MakeR.createCI(Object from Jubula); //$NON-NLS-1$
Now, perform the required actions on the application and webpage, respectively.

Related

Selenium,Cucumber & Gherkin

I'm learning to use the above testing software and was just wondering if there is any way so that selenium detects whatever browser the user is using rather then a specific driver having to be defined i.e.
private WebDriver driver= new FirefoxDriver()
Another quick question is how can I loop a test so that it repeats a set number of time?
Try using QAF. It has all configuration out side the code. For example you don't need to specify which driver you need to initiate in code instead you can provide as property in property file or in run configuration file like:
driver.name=firefoxDriver
There are lots of features specific to web, mobile web and native automation.
Here you can find step-by-step-tutorial to start with.
If you were using Java you could specify the browser in a properties file.
Failing that, you could use an environment variable.
Or you could put your choice in a file in your file system and read the value.
Lots of choices.

Anyone used Specflow to do testing of Nservice bus handlers

I have one end point deployed couple of service components.
I want to test drive it by writing couple of specs.
I used Specflow to write specs. But trying to figuring out is there any sample around.
I saw the NServicebus.AcceptanceTesting stuff but that is not by Specflow and it has lots of code ceremony to start with. It is not that much straight forward.
Any thoughts on Specflow specs for NServicebus ?
I installed NServicebus.Testing project in my specflow and using that I invoked endpoint handlers and performed my testing. It was easy and simple
In NserviceBus 5 version I tried this.
In order to send command I did below in my test case:
using NServiceBus.Testing;
[When(#"Create Auction Command is placed")]
public void WhenCreateAuctionCommandIsPlaced()
{
var createAuction = new CreateAuction(234);
Test.Handler(bus => new CreateAuctionHandler(bus))
.OnMessage(createAuction);
}

How to integrate Galen reports in Jenkins

I've started to use Galen framework to test the layout of my website pages and I also have my other test, written in Selenium, integrated into Jenkins.
I'm using Java+JUnit+Maven and I would like to know if anyone has managed to integrate the Galen reporting into Jenkins and how.
Because for the moment I am using something like:
assertThat(layoutReport.errors(), is(0));
which tells me if there were errors in the tests but not where.
Thanks!
P.S. If someone with reputation could make the tag galen-framework so that we can group these type of questions, it would be great :D
In your case you could use Galen for generating HTML reports as it normally does when you run tests with it. Though you will have to manage the creation of GalenTestInfo objects.
Here is how the HTML report generation works. Imagine you have somewhere obtainAllTests method defined which returns a list of all executed tests.
List<GalenTestInfo> tests = obtainAllTests();
new HtmlReportBuilder().build(tests, "target/galen-html-reports");
Somewhere in your code you could create a GalenTestInfo and add it to some collection:
GalenTestInfo testInfo = GalenTestInfo.fromString("Here goes the name of your test");
Once you have done the layout checking and obtained LayoutReport object you could add this report to the report of the test. Here is how you can do it:
LayoutReport layoutReport = Galen.checkLayout(driver,
specPath, includedTags, null,
new Properties(), null);
testInfo.getReport().layout(layoutReport, "A title for your layout check");
You can find more insights in this project https://github.com/galenframework/galen-sample-java-tests. It has a basic setup for Galen tests in Java + TestNG + Maven. The reports in it are collected in a singleton GalenReportsContainer. There is also a reporter implemented in GalenReportingListener which takes all those tests from GalenReportsContainer and generates HTML reports.
You can see a full example for Java (TestNG and JUnit) and JavaScript here:
https://github.com/hypery2k/galen_samples.
I use the HTML Plugin together with Jenkins, see example here

Integration between Rally and Robot framework?

Does anybody know of an integration between Rally ALM and robotframework?
I'm looking for something that would log test results in robotframework back to Rally test cases.
With the pyral rally module for Python, seems like it could be fairly straightforward.
As far as I can tell there is nothing out there to do this-- but its pretty easy to do, only needing about 50 lines of python code for a simple integration that logs robot framework to Rally test case results.
In my case, I have it log results for any test who's name starts with a Rally test case id: (e.g. "TCXXXX My Test Name").
The trick is to user the RobotFramework listener API (See: Elapsed time and result of a test in variables) and pyral, the Rally python API. Key for my needs was to define an "end_test" listener:
def end_test(self, name, attrs):
match = re.search('^(TC\d+)\s*(.*)', name)
tcId = match.group(1)
testName = match.group(2)
if tcId:
tcr = self.__logTestCaseResultToRally(tcId, testName, attrs)
self.__cleanTestCaseState()
In robotframework, I include this listener file, which also has some additional methods to add attachments and other information like notes to a test result (these can be directly called as libraries in your robotframework file):
def addAttachment(self, attachment):
if os.path.isfile(attachment) and os.access(attachment, os.R_OK):
self.attachments.append(attachment)
This method simply saves the attachment path in the listener object so that when end_test() is called, it has access to the file names to attach to the rally test case. __cleanTestCaseState() zeros these out so they are cleared before the next test cast starts.
Actually, I've never used Rally!
But in my opinion, With robot framework, I like using Testlink for testcase management system & jenkin for CI control system :)
You can search in the internet for installation.
Hope it useful :)

How to test JavaFX with Cucumber?

I want to write a JavaFX Application using BDD and Cucumber.
I already found the TestFX library, that could help me here, but still didn't find a proper setup. My main problem is the restarting of the Application for the different scenarios.
I want to write a Background step like this:
Given that the application is freshly launched
This step can be implemented by
thread = new Thread(() -> Application.launch(appClass));
thread.start();
However the JavaFX lifecycle forbids the restart of the application. My next idea was to let the application alive, but to reset the scene of the application before each scenario. Here I am actually hanging. So far I did not find a way to get the started Application instance and to set a new Scene to its Stage. Any suggestions?
Or is there any easier way to do BDD with JavaFX?
please check bellow web URL : (JavaFX with Cucumber)
http://permalink.gmane.org/gmane.comp.programming.tools.cucumber/13614