Hello,
I need to cover Menu functionality by unit tests, however I'm struggling to obtain Menu object.
Following test case fails (mMenu is null):
public void testMenu() {
sendKeys(KeyEvent.KEYCODE_MENU);
mMenu = (Menu) mActivity.findViewById(com.###.###.R.id.main_menu);
assertNotNull(mMenu);
}
Please advice.
Thank you....
If someone writes a new unit test but they forget to add it to a suite, the continuous build will continue to pass happily even if someone later breaks the test. Is there a way to discover JUnit tests that aren't included in a suite?
EDIT
I know I could move to JUnit 4 but then the question becomes, how do I find tests that are missing ...
I've been finding some unit tests that assume that the results of database queries are in a particular order, yet the query being run doesn't include an order by clause.
I would like to find more of these unit tests, so that I can examine whether the test is at fault in its assumptions, or the code is at fault in its lack of specifying ...
I understand in Junit 4, @Before can be used to setup test fixtures for the test class's multiple test methods.
However, in my system, there are common test objects i would like to have available for all tests.
What is the most appropriate name for these objects and what is a good best practice way to store them?
...
I am setting up JUnit 4.7 tests with Selenium 1.x and Spring 3.0.
I want to extend Selenium's SeleneseTestCase for the shortcuts and conventions it provides (more importantly, the Selenium IDE generated code seems to expect this). Yet I want the Spring context and other goodness to be present during the execution.
Because I cannot exte...
In junit test, should I create another test suite named as ExampleBAT to do this, and this test suite contains the selected test cases?
Thanks.
...
I am currently using an online system running in Google App Engine to enable students to practice coding in python. The system is inspired by codingbat by Nick Parlante and the public version of Beanshell running on appengine.
I would like to extend our system to support Java. In our current system, the Python doctest feature makes it ...
I have a project 'ABC' with the main code and junit tests. I do have the requirement that i can execute the set unit tests against a older version of the product artefacts.
To solve this requirement i would create a maven project which only contains the junit tests.
Another maven product builds my product code and places the artifact ...
Using junit 4.8 and the new @Category annotations, is there a way to choose a subset of categories to run with maven's surefire plugin?
For example I have:
@Test
public void a() {
}
@Category(SlowTests.class)
@Test
public void b() {
}
And I'd like to run all non-slow tests as in: (note that the -Dtest.categories was made up by me......
I have a link with an id:
<a href="#" onclick="return false();" id="lol">
In my test:
selenium.click("lol"); //when running the test, the click will just end up selecting the item, not firing off the frameworks javascript
This does not register the click the same! There is javascript that is part of a complex framework which will c...
For example, a test case named ExampleTest
ExampleTest {
testA{};
testB{};
testC();
}
I could run all this class with TestSuite.addTestSuite(ExampleTest.class);
but, how to select testA and testB run into TestSuite?
...
Hi All,
I have a database process written in PL/SQL that i would like to test using DBUNIT. The pl/sql program processes data from one table and generates new data into a new table. In some cases it also updates fields on the original table.
I am a bit confused in how i can use dbunit to test this. Reading up on it, it looks like i h...
i am trying to do the spring tutorials from the spring website. one of the tutorials include bulding an ant build file which when i build I keep getting this error
BUILD FAILED
build.xml:146: You must not specify nested elements when using refid
When i click on the error it seems to be pointing at this location
<target name="tests" d...
I was wondering how different surefire is when executing TestNG than TestNG ant tasks? The reason is that I am seeing consistent difference in behavior when trying to run a TestNG test that extends a JUnit test base (this is a workaround to run JBehave tests in TestNG described here: http://jbehave.org/documentation/faq/). Surefire detec...
I'm working on legacy code that builds an index of popular terms in another index. There are no unit tests in place, and the indexing process is a pain to wait for because the first index takes so long to build.
I want to structure the second (popular term) index differently. Is there a best practice for testing to see if a Lucene inde...
I just discovered when creating some CRUD tests that you can't set data in one test and have it read in another test (data is set back to its initialization between each test).
All I'm trying to do is (C)reate an object with one test, and (R)ead it with the next. Does JUnit have a way to do this, or is it ideologically coded such that ...
I'd like to know if there is something similar to junit-addons DirectorySuiteBuilder (documentation) that works with jUnit 4. Simply stated, I want to load every file name *Test.java in a directory and build a suite out of them.
I realize that I can build a suite that runs every test in a directory using ant, but I would prefer to not ...
Class under test MyClass.java
JUnit test case name alternatives:
TestMyClass.java
MyClassTest.java
http://moreunit.sourceforge.net seems to use "Test" as prefix default but I have seen both uses. Both seems to be recognized when running the entire project as unit test in eclipse as it is the annotation inside classes that are parsed ...
I'm using Spring Test and JUnit to run DAO integration tests. The test class is annotated as follows:
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration( { "/testPersist-applicationContext.xml" })
@Transactional
I use the @BeforeTransaction annotation on a method to insert some test data -- that I would expect to be there ...
I am developing a simulator for a machine. It reads a file in, stores it in a string (as a binary number) to an array that is supposed to simulate the memory of a computer. Then it gets passed to an interpreter that takes gets the first element of the array, and based on the first 4 characters it gets sent to another class.
An example o...