Background: I'm trying to test a Hive query as part of our testing framework. I want to create short tests that test a small subset of the data in order for the queries to return fast, and be able to run them on every computer (even private laptops). The goal is to be able to just checkout the code, build using maven and run the tests.
Question: Is there a way for me to start a standalone hadoop (or some sort of simulator) only using java code, without downloads and installations that can be ran as part of the tests?
My goal is to have a test that in its #Before method set ups hadoop inside the tests which is deleted at the end of the test.
Have you looked at the MiniCluster apis (http://wiki.apache.org/hadoop/HowToDevelopUnitTests) ?
Here is a blog post that covers how to use the this API is some detail : http://www.lopakalogic.com/articles/hadoop-articles/hadoop-testing-with-minicluster/
It looks like what you might be looking for.
Take a look at HiveQLUnit - A open source project to unit test Hive.
Fast - It runs in memory through the use of HiveContext.
Standalone - Can run from your laptop/dexktop without server installations.
Maven Integration - Included in maven central and can be included easily as a maven dependency within your project.
JUnit Integration - Fully integrates with the JUnit unit testing framework
It also solves your problem of executing standalone unit tests from your favorite IDE.
It can execute unit tests from your favorite IDE on any operating system including Windows, Linux and Mac OSX. Here is some guidance around using HiveQLUnit - Documentation.
Note: I am affiliated with the HiveQLUnit OS project.
Related
I have recently setup integration of Selenium (Java bindings) with TestNG and Jenkins in a Windows environment, which is running absolutely fine.
I have created a batch file of TestNG and executed it through Jenkins using Windows batch file command. Now the situation is that I have to run these Selenium test cases on a Linux (Centos 7) environment as the Jenkins is setup there.
I am not quite sure how I should approach that. I have gone through some articles, but really could not find anything related to this for Selenium/Java things.
I have already done some initial steps, but I'm stuck after that:
I have setup CentOS 7;
Installed Java on it;
Installed Jenkins on it;
I have also installed xvfb as it would be required for headless execution.
From here I need some guidance in terms of how to proceed further, or put all things together. For example, should I move Selenium/Java project on VM and somehow run the TestNG file through Jenkins? (but not sure how to do that need some steps to follow or are there any more prerequisite to it). Or some other approach which is better.
It would be great if someone can guide me towards any article or can explain here with steps.
Here's what you can try doing to get this working:
You need a version control system(VCS) such as GIT/SVN, wherein you would need to push in your test code. That way, your Jenkins Instance will be able to pull in code from the VCS.
Once you have pushed in your code into the VCS, you can create a build job which would pull code from your VCS, build it using a build tool such as Maven/Gradle/Ant and then execute your tests (again using the build tool)
To learn how to setup your Jenkins instance with Git (One of the popular VCS flavors), please refer to this blog.
To learn how to go about setting up a Continuous Integration system with Selenium, you can also refer to this blog post of mine.
We have application which use Cucumber framework for testing our second application, the applications runs on own processes (black box testing), currently we do following steps:
1) Run DB
2) Run main application
3) Run test application which use Cukumber framework for testing main application
Question is: how we can do this automatically by using TeamCity ?
Create a Command Line build step:
Point to the working directory
Run your Cucumber tests from the command line. Example.
Here is more info on Cucumber's CLI.
My approach would be to write a script that sets up all dependencies. I.e. starting the database, starting the second application and then run the Cucumber stuff. The script would be possible to run on the CI server, i.e. TeamCity or on a developers system so it is easy verify that they didn't break anything before committing.
Restricting the execution to TeamCity only would not be my preferred approach.
This lead toa solution taht depends on your dev and CI environment. Are you running on Windows or on Linux? The scripts will different depending on the operating system.
Hello everyone I am a grader for a programming language class and i am trying to use jenkins continuous integration for running some junit tests on their code that is pushed to github.
I was able to get all the committed jobs to the jenkins, but can i run a python file in order to push a testing class to their code and then build their projects an get an xml report about their program test...??
Jenkins allows you to run any external command so you can just call your Python script afterwards
I have an eclipse application, where in i can create projects and perform some operations. I have written a test cases using Junit for some functions. To run these test functions, i am doing Right click on test class and Run as Junit Plug-in test and it is working properly. I am unable to do both the things at the same time. What i need is to run my eclipse application and Junit plug-in test simultaneously without human intervention. Junit plug-in test has to be done at run time. If there is a way to do that, then please suggest me the solution.
When you run it as Junit plugin test, then it already launches your eclipse plugins (and application), so there is absolutely no need to try to launch an additional application.
What probably confuses you, is that the test run and the "normal" manual run use two different workspaces. So if you try to access some files in your test which you created during normal operation, they will not exist. But you should never rely on such things, instead you have to create the necessary artifacts in the test setup method.
What GUI should use to run my JUnit tests, and how exactly do I do that? My entire background is in .NET, so I'm used to just firing up my NUnit gui and running my unit tests. If the lights are green, I'm clean.
Now, I have to write some Java code and want to run something similar using JUnit. The JUnit documentation is nice and clear about adding the attributes necessary to create tests, but its pretty lean on how to fire up a runner and see the results of those tests.
JUnit stopped having graphical runners following the release of JUnit 4.
If you do have an earlier version of JUnit you can use a graphical test runner by entering on the command line[1]:
java junit.swingui.TestRunner [optional TestClass]
With the optional test class the specified tests will run straight away. Without it you can enter the class into the GUI.
The benefits of running your tests this way is that you don't have the overhead of an entire IDE (if you're not already running one). However, if you're already working in an IDE such as Eclipse, the integration is excellent and is a lot less hassle to get the test running.
If you do have JUnit 4, and really don't want to use an IDE to run the tests, or want textual feedback, you can run the text UI test runner. In a similar vein as earlier, this can be done by entering on the command line[1]:
java junit.textui.TestRunner [TestClass]
Though in this case the TestClass is not optional, for obvious reasons.
[1] assuming you're in the correct working directory and the classpath has been setup, which may be out of scope for this answer
Eclipse is by-far the best I've used. Couple JUnit with a code coverage plug-in and Eclipse will probably be the best unit-tester.
There's a standalone JUnit runner that has a UI, but I recommend using one of the builtin test runners in the Java IDEs (Eclipse, Netbeans, and IntelliJ all have good ones). They all support JUnit, and most support TestNG as well.
If you want a standalone test runner (not the build-in IDE one), then for Junit3 you can use
junit.textui.TestRunner %your_class% - command line based runner
junit.swingui.TestRunner [%your_class%] - runner with user interface (swing-powered)
For Junit4, the UI-powered runners were removed and so far I haven't found a convenient solution to run new Junit4 tests on old swing-powered runner without additional libraries. But you can use JUnit 4 Extensions that provides a workaround to use junit.swingui.TestRunner. More here
Why you need a GUI runner? Can't you just run the tests from the IDE itself?
In .Net we have TestDriven.net, in Java there must be something equivalent. You can check out IntelliJ IDEA, it has the unit testing support built-in.