Using Selenium WebDriver, Protractor with Scalatest in an SBT project - webdriver

Our project setup is as following:
We are using 'Play framework' and SBT as a build tool.
We have Jenkins for continuous delivery
We are using Scalatest for writing Selenium tests
Additionally we have Sonarqube for consolidating test results.
For Frontend we are using AngularJS for dynamic content.
We wanted to use Protractor as it can access AngularJS specific elements, but installing it locally is not what we want. Instead we want to have a dependency listed in Build.scala file and somehow we should be able to write Protractor code in Scalatest. How to go about it?

Related

Stuck with creating Keyword library using Java in Eclipse and using that JAR file in RIDE

I'm new to ROBOT framework and must create library keyword using java and utilize the JAR files in RIDE editor. I have followed the below steps. But still have confusions in where to start up. Please help me to achieve this.
Steps:
1) Installed Python, wxPython, pybot, RIDE, selenium2library successfully and I'm able to work with RIDE using predefined keywords.
2) For creating own java library, Installed Eclipse Mars, Java, ROBOT IDE manually using the link https://github.com/NitorCreations/RobotFramework-EclipseIDE/wiki/Installation
The question here is,
Anything i'm missing to install?
How to proceed further with Robot Framework coding?
Note: I'm reading many materials in parts to proceed things. But that is confusing me what are the steps to be followed. Is there any single material that i can get having the sequences of steps that need to be followed for my requirements?
The below links I referred with,
https://github.com/NitorCreations/RobotFramework-EclipseIDE/wiki/Usage
Maven error "Failure to transfer..."
Create a Maven project in Eclipse complains "Could not resolve archetype"
http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#using-set-test-suite-global-variable-keywords
Let's start with the basics. RIDE is an editor for Robot Script files. Robot Script files are executed by the Robot Framework robot application. It is important to understand the difference between these two applications. One creates files and the other uses them.
Assuming for a moment here that you have some custom functionality in a Jar file that you would like to make available inside the Robot Script files test cases. If this is indeed the case then your focus should be on create Robot Test Libraries. In the documentation there are numerous java examples given for basing your own library on.
This means that you do not need Maven, unless you want to, to create your library. Also Eclipse IDE is not needed nor is RIDE. The library you create can be used by Robot Framework even when it's run from the command line. Feel free to use them for what they are good at: writing Robot Scripts efficiently and running Robot through menu options instead of command line windows.
When you are familiar with Eclipse and comfortable with it's features, then I can also recommend using the Eclipse Application RED which is a mature Eclipse add on for creating, running and debugging Robot scripts.
There are two ways of implementing a Java routine in Robot Framework and it depends a bit on how you run Robot Framework: Python or Jython. Running Python means that you need to run the Java in a separate JVM container and connect to it. The simplest way is via Command Line interaction. This may cause some security concerns. The second approach is to use the Remote Library approach. A good example of this is the Robot Framework Sikuli Library. An added bonus is that you can run Robot and your Java application on two separate machines/servers.
The Jython way has been discussed on StackOverflow before and I gladly refer to it. Please bear in mind that although the examples refer to RIDE, the Library org.company.Keywordlibrary works in all IDE's, provided robot framework is run using Jython.
In the Jython documentation it clearly explains how to setup an Eclipse based IDE with Jython. Do keep in mind that it's recommended to use the same interpreter in development and production. I.e. if you create your scripts in Jython, do run them in 'production' also using Jython. Otherwise you open yourself up to interpreter differences where functionality does not work or behaves differently then expected.
An alternative approach with Jython is the all-in-one Robot Framework Maven JAR plugin. Adding a custom Java Library in this setup is not too difficult. A nice short tutorial can be found on the blog of Valerio Bruno. If this is your preferred route for development, then you may want to read the RED howto on integrating the Robot Framework Maven jar.
Working on your custom functionality is likely going to be a independent project in Eclipse, but can be linked to an Robot project via the Class Path settings in red.xml if you use RED or the CLASS_PATH environment variable.
Done! I have installed RED and required add on using following below steps. It worked successfully with predefined keywords. Now I'm gonna create user defined keywords/libraries using the same editor. I don't know where to start up. Will it work creating just a java project? Should I need to include any additional libraries?
Steps followed to proceed with RED:
1. RED Version Conclusion: https://github.com/nokia/RED/blob/master/release.md
2. RED Installation Instructions: https://github.com/nokia/RED/blob/master/installation.md
3. ROBOT Framework prerequisites using RED: https://github.com/nokia/RED/blob/master/red_help/first_steps/download_install.html.md
4. To verify Installations in Eclipse: Help -> Installation Details to check if RED is visible on installed features list
5. Create Project and Tests using RED in Eclipse: https://github.com/nokia/RED/blob/master/red_help/first_steps/create_run.html.md
6. RED Steps: https://github.com/nokia/RED/blob/master/First_steps.md
7. Quick STart: https://github.com/nokia/RED/blob/master/red_help/user_guide/quick_start.html.md

How to build gulp css files using TFS (Local builds using Task Runner Explorer)

We have the following issue in our build system:
We build an ASP.NET project which has many scss files.. We want to compile them using Gulp.
When working local, no problem, we use the Task Runner Explorer in VS2015 to automate the pre-build event, but, when building using TFS, we don't have access to this tool and thus it leaves us with no css file.
My question is, what would be considered the best way to automate this pre-build event (creating css file using Gulp in TFS2015)?
Thanks a lot!
In both VSTS and TFS 2017 you can just add the out-of-the-box Gulp Task to your build and configure it like any other task.
If you have an old version of TFS then you may need to use PowerShell to achieve the same thing:
http://colinsalmcorner.com/post/jspm-npm-gulp-and-webdeploy-in-a-teambuild
You may also want to check the Marketplace for a Build Task for Gulp that you can download: http://marketplace.visualstudio.com

How to install grunt-template automatically

I start learning grunt for javascript project management. Grunt requires a series of templates in order to run the tasks. All the guide or examples are saying to install the template manually by running git clone *** on ~/.grunt-init directory. I wander whether there is any automatic way to install all the required templates from current project. Just like what maven or gradle are doing.
It's not a direct answer but check out yeoman for scaffolding front end Web apps. It has a whole lot of cool integrations with grunt.js that will automatically run a bunch of grunt tasks on your project for you. You should definitely check it out.

Can a traditional maven based project be converted to sbt to get rapid compile times?

If there is a project that is currently setup using maven, is it possible to easily convert the project over to sbt so I can run the application and get quick 'running app' compile times?
I am currently using sbt with play and it works great.
Do I have to port all the dependencies into sbt manually or is there a way to tell sbt to look in the pom.xml file or something?

Recommended structure for testing Javascript with QUnit in ASP.NET

I have a standard ASP.NET MVC (version 2 preview 2) solution with the actual project and server-side unit tests in separate projects.
Because this project is very client-side heavy, I want to make a ClientTest project as well that uses QUnit to test the main project.
I've thought of creating a regular ASP.NET webforms project with a single HTML file that would load the various scripts in my Scripts/ directory and test them with QUnit. Unfortunately this will spawn another ASP.NET Development Server. I could configure the port of the running MVC project server before running the tests, but there's got to be a better way that isn't just throwing the test html file into the main MVC project.
Does anyone know of a better way of going about this?
I like your idea of placing the QUnit tests in a separate project. What about using XCOPY to copy the scripts in the pre-build event?
Say your MVC project is MyProj.Web and your QUnit test project is MyProj.ClientTest (replace with your project names).
Create a Scripts folder in your ClientTest project.
From Project > MyProj.ClientTest Properties > Build Events, add the following to Pre-build event command line:
XCOPY "$(SolutionDir)MyProj.Web\Scripts" "$(ProjectDir)Scripts" /S /Y
Then in your HTML just include the appropriate JavaScript files from the Scripts folder.
Note: You will have to rebuild your ClientTest project to refresh JavaScript files when you want to rerun tests. Adjust folder names, paths and XCOPY options as needed.
Perhaps you could pick and choose techniques from this article, including using the command-line, harnessing NUnit with WatiN, and scraping test results for reporting. This solution wouldn't require a separate WebForms project to harness the tests in, since it's all handled by WatiN.
It's not too clear to me why using MVC makes a difference - if you want to integrate your tests into a CI build then gWiz's suggestion is the route to go.
If your requirement is that you want to run your tests interactively directly on the real page without affecting the look of that page then you could check out the FireUnit plugin for Firebug. You can also wrap FireUnit around QUnit as described on John Resig's blog.
If you're concerned about including test stuff then include the relevant scripts in your test/debug builds and disable/remove them in your production builds.

Resources