Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » scout » Scout Neon & Testing
Scout Neon & Testing [message #1748922] Wed, 30 November 2016 08:24 Go to next message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 178
Registered: November 2014
Senior Member

Hi there,

I'm just wondering what your testing strategies are regarding the new Scout HTML framework.

With the drop of OSGI bundles plain unit testing is much easier than ever.

But how are you conducting your UI tests?

How are you testing the state of your UI based on permissions or specific values? Lets say an Admin-Role is able to edit a field whereas for a regular user this field is not visible or at least disabled.

How do you test such cases?

Thanks

Peter
Re: Scout Neon & Testing [message #1748927 is a reply to message #1748922] Wed, 30 November 2016 08:55 Go to previous messageGo to next message
Ivan Motsch is currently offline Ivan MotschFriend
Messages: 123
Registered: March 2010
Senior Member
Yes, it is easier now.
geneneral java unit testing is done using junit

when going into integration testing much can be done using mocking and
the powerful bean replacement mechanism of scout BeanManager.
java integration server tests are also done with junit
java integration client tests are also done with junit using a testing back-end

javascript tests are done using jasmine and phantomjs.
external tests are done using selenium.

Please check the various testing maven modules in the scout open source repo.
Re: Scout Neon & Testing [message #1748934 is a reply to message #1748927] Wed, 30 November 2016 09:28 Go to previous messageGo to next message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 178
Registered: November 2014
Senior Member

Hi,

what do you mean with:

Ivan Motsch wrote on Wed, 30 November 2016 08:55
Please check the various testing maven modules in the scout open source repo.


Could you please point me to where I can find this?

Peter
Re: Scout Neon & Testing [message #1748953 is a reply to message #1748922] Wed, 30 November 2016 11:55 Go to previous messageGo to next message
Ivan Motsch is currently offline Ivan MotschFriend
Messages: 123
Registered: March 2010
Senior Member
http://git.eclipse.org/c/scout/org.eclipse.scout.rt.git/
Re: Scout Neon & Testing [message #1748954 is a reply to message #1748953] Wed, 30 November 2016 11:56 Go to previous messageGo to next message
Ivan Motsch is currently offline Ivan MotschFriend
Messages: 123
Registered: March 2010
Senior Member
and this is the current branch 6.1
http://git.eclipse.org/c/scout/org.eclipse.scout.rt.git/?h=releases%2F6.1.x
Re: Scout Neon & Testing [message #1748955 is a reply to message #1748934] Wed, 30 November 2016 11:58 Go to previous messageGo to next message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 31
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Member
Unfortunately the selenium test suite is not yet available in the open source repo. If you're interested in doing Selenium tests, I could give you a few hints on where to start with Scout and Selenium. We plan to release the test suite as open source, but right now we test against an internal application, so we must first change the tests to work with the Scout widgets app, which is already available on GitHub.
Re: Scout Neon & Testing [message #1748983 is a reply to message #1748955] Wed, 30 November 2016 18:19 Go to previous messageGo to next message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 178
Registered: November 2014
Senior Member

Hi,

of course I'm interested. Any help and tips are appreciated Smile

Thanks a lot.

Peter
Re: Scout Neon & Testing [message #1749127 is a reply to message #1748922] Fri, 02 December 2016 07:54 Go to previous messageGo to next message
Benjamin Schulte is currently offline Benjamin SchulteFriend
Messages: 17
Registered: December 2016
Junior Member
Peter Pfeifer wrote on Wed, 30 November 2016 08:24
Hi there,
How are you testing the state of your UI based on permissions or specific values? Lets say an Admin-Role is able to edit a field whereas for a regular user this field is not visible or at least disabled.


Here is the code I used in my project to get this checked.

public class TestClass {

	// Register a mock service
	@BeanMock
	private IAccessControlService accessControl;

	@Before
	public void setup() {
	Mockito.when(accessControl.checkPermission(Matchers.any())).thenReturn(true);

	}

	@Test
	public void testButtonEnablings() {

		// Test 1: with Updatepermission
		// check if it is active 
		Assert.assertTrue(
				BEANS.get(IAccessControlService.class).checkPermission(new UpdatePermission()));

... create Form

		Assert.assertTrue(form.getMenuByClass(class).isEnabled());

		// Test 2: without Updatepermission
		// mit Mockito den Rechteservice verdrehen und zur Sicherheit nachprüfen
		// ob das so auch wirkt
		Mockito.when(accessControl.checkPermission(Matchers.isA(UpdatePermission.class)))
				.thenReturn(false);
		Assert.assertFalse(
				BEANS.get(IAccessControlService.class).checkPermission(new UpdatePermission()));

... create Form

		// die Menüs sollen disabled sein
		Assert.assertFalse(
				form.getMenuByClass(class).isEnabled());
	}
Re: Scout Neon & Testing [message #1749690 is a reply to message #1748983] Fri, 09 December 2016 17:40 Go to previous messageGo to next message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 31
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Member
Hi Peter

I moved our Selenium utility- / base classes to the OSS Eclipse Scout repo.
You can use the new module "org.eclipse.scout.rt.ui.html.selenium" as a base for your tests.

See: http://git.eclipse.org/c/scout/org.eclipse.scout.rt.git/tree/org.eclipse.scout.rt.ui.html.selenium?h=releases/6.1.x&id=84d777aaf991df70154f5a80a2c45c372b56ea6d

I also added a sample project to our GitHub repo which contains our demo applications. There you'll find the module "org.eclipse.scout.widgets.ui.html.app.selenium ". It has a single test, which clicks on a button on the ButtonForm. I think it's a good starting point to begin writing your own Selenium tests for Eclipse Scout applications.

See: https://github.com/BSI-Business-Systems-Integration-AG/org.eclipse.scout.docs/tree/releases/6.1.x/code/widgets/org.eclipse.scout.widgets.ui.html.app.selenium

In order to run the test on your local machine, you must have the widgets application up and runnning on localhost port 8082. To start the test, simply launch WidgetsSeleniumTestSuite as JUnit Test.


Re: Scout Neon & Testing [message #1749835 is a reply to message #1749690] Tue, 13 December 2016 06:35 Go to previous message
Peter Pfeifer is currently offline Peter PfeiferFriend
Messages: 178
Registered: November 2014
Senior Member

Hi Andre,

thanks a lot! Looks promising. I'll have a deeper look at it in my christmas holidays Smile

Peter
Previous Topic:SmartField & ElasticSearch
Next Topic:Changelog for releases
Goto Forum:
  


Current Time: Wed May 24 00:35:04 GMT 2017

Powered by FUDForum. Page generated in 0.05576 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software