Spring Test Without Maven - spring

I want to do unit test on Spring Web Application using Spring Test. When I tried to learn in web got all the tutorials with maven. We are not using maven in our project. Is there any way to do this test without maven.

maven is a tool for build processes. You really don't have to use it.
What you need is to write tests with a testing framework, for exapmle junit
The dependencies you need (spring, junit) must be in your classpath. If you're not using maven then any other way you prefer.
You can use this question to run tests from command line if that's what you need.
To make it clear in other words - maven provides you with a build cycle that downloads your dependencies and put them in your classpath. This is something that you can do manually (configure your classpath and put needed jars in the classpath). The second thing maven gives you is the test life-cycle. But you don't have to use it and you can run unit-tests from command line according to the link I put in bullet 3 or running through the IDE. Most of eclipse and Intellij versions come with built-in support for running tests.

Related

What is the recommended usage pattern for karaf-maven-plugin?

I have a bunch of java classes and a bundle activator class that I need to deploy to karaf.
I see that the karat-maven-plugin has kar packaging and karaf-assembly.
Also it generates features.xml
I can generate features.xml directly and it generates lines with wrap: for some of my dependent non-osgi jars.
But when I run karat-assembly, I run into the issue of the assembly goal not realizing that these jars are not osgi and end up with errors.
What it the recommended way to get a custom karaf with my application installed ?
Does the karat-assembly packaging need to have a features.xml generated and provided beforehand ? Or is it supposed to do the feature set generation by itself ? If it is the latter, then how do I get around the problem of the karat-assembly not recognizing non-osgi jars ?
I have spent a LOT of time with google and am stumped.
This is my procedure for creating a custom karaf distribution. It may not be "best practice" but it works for me. Maybe you can customize for your needs.
After developing my Camel routes and testing I generate my feature file based on a feature template found in /src/main/feature/feature.xml. The karaf-maven-plugin will generate the feature will in the feature folder inside /target.
I do a clean deploy to our maven artifactory.
I have a custom Karaf project do a clean install on that project. The project has dependencies to the initial project and I add all the features as boot level feature.
Once build I unzip the distribution and run the Karaf app. If everything looks ok its ready to be shipped.

Is it necessary to have Maven and Junit or TestNG to run sauce labs for mobile testing

We have a custom framework built for Selenium with Java and we do not use Junit or TestNG and Maven. We are using to ant build our project. So I wanted to understand is it necessary to have Maven and Junit or TestNG to run sauce labs for mobile testing? We are planning to include Appium in our framework and would like explore way for executing our test on sauce lab.
If there are any alternate option we have then please point me to them.
Thanks,
Raghav
So, since you are using Ant, then the answer is No you do not need maven. Both Ant and Maven are project dependency management tools.
As far as the testing framework goes, you don't have to use any of them, but the reason you would want to use them, is for Pass/Fail recognition.
With a testing framework you can run each test individually and see a green pass, or red fail within your IDE. As well as suite management (See TestMethodRunner) It's possible that SauceLabs can detect these frameworks and detect failures as well, so I wouldn't see why you wouldn't use at least jUnit or TestNG.

Automating Selendroid and Selenium Tests through maven

Is it possible to automate Selendroid Tests for Android as well as Selenium for Web Browsers(together) through maven? Do i need to create seperate pom files for both or is it possible to use a single pom file to run both type of Tests?
Can i use any other framework to test Android and WebApps together through maven?
You can use a single pom file. Just configure plugins for each test type you want to use.

possible to parameterise junit tests and run with maven?

I have a bunch of selenium webdriver tests split in different classes. I run these tests across a number of sites but I don't want to run them all on every site.
In the past I used msBuild and c# and wrote testng tests for software automation and I could add something like #Version1.5 after #Test then when I run my tests if the version in my properties file wasn't 5.1 it would skip that test.
Is something like this possible using maven and junit in Java?
Would JUnit Categories to the trick? Maven Surefire supports them but I am not sure how you would dynamically turn them on or off. You could definitely set up maven profiles to turn them on or off and then pass the appropriate profile as part of the maven command.

Maven: Dealing with a truly circular dependency

I have a somewhat complex situation and I'm not sure what the best way to set up my Maven environment is.
I'm writing a framework to allow the creation of tests for a particular system. The system can host a variety of applications, and I have a set of tests for each application, which I'd like to keep separate from the framework (which handles the general concept of a "test", and message sending/receiving etc). Also, the framework provides a generic UI, so it can be built as a war and deployed allowing you to run and configure tests.
What I'm currently doing is building the framework both as a jar and war, listing the framework as a dependency in each application test suite, and pulling in all the framework code using an overlay so each suite can build its own war to deploy. This is gross.
What I'd like is to be able to specify (probably via profiles) which test suites to build in the framework, and end up with a single framework.war file with the specified suites included. Trying to build the poms for this I keep running into a circular dependency because:
To build the tests, the test projects must depend on the framework
To pull in the specified test jars, the framework must depend on those test projects
Things I've tried:
Make the test suites sub-projects of the framework:
This doesn't work as (I think) I can't package the final result as war (only pom packaging for aggregator projects)
List the test .jars as system dependencies:
This works, but it's gross to have to manually specify a path to the jar
Put the tests as java packages inside the framework and compile only what you want via filters:
technically possible, but I would really prefer the logical separation into separate maven projects as each test suite can be configured too, and I'd like to keep all that config out of the framework pom
What would be ideal would be a parent project pom that would:
compile the framework with no tests
compile the specified test suites
rebuild the framework .war, including the specified test suite jars
I'm not sure if this is possible and/or even advisable, but it seems the best solution to me. Thanks in advance for any suggestions for organizing this project.

Resources