Skip to content
Advertisement

Tag: testing

Create Post Api in Java for Test Rail

Im trying to create a java post request to create a test run on test rail, however it doesn’t seem to be working heres my code: The testrail documentation is here im looking for the add run http://docs.gurock.com/testrail-api2/reference-runs Any help here how to make this actually work , is completing but nothing is happening. I’m a tester but struggling with

Android Espresso: How to create test-suite which may launch separate test classes with different activities?

I have just started studying Espresso tests, but I have searched throw StackOverFlow topics and couldn’t found solution for my needs. Prehistory of my question: I have android application with lots of activities. Generally separate UI tests were created for different flows of the app (each flow require separate activity, so that’s why I have implemented tests in a different

Test if an exception is caught with Junit

I’ll begin with a code example; I have to test a function, which handles data-packets. In this function, the data-packet is opened and when it doesn’t contain all expected data, an InvalidParameterExeption is thrown which is logged. So, if everything goes well, my exception is printed in my terminal. But how can I test this? I can’t use this: (because

How do I unit test spring security @PreAuthorize(hasRole)?

What do I need in order to unit test the hasRole part of a PreAuthorize annotation on a controller method? My test should succeed because the logged in user only has one of the two roles, but instead it fails with the following assertion error: java.lang.AssertionError: Status Expected :401 Actual :200 I have the following method in MyController: I created

TestNG. can’t run a single test method

I have Selenium+Eclipse+Java Project+Eclipse TestNG plugin. For example, my code is: When i run TestClass as TestNG, both tests are executed. I can’t understand why test2 is executed also. Because there is a comment “//” before @Test annotations. Any ideas? thanks in advance Answer First, you should clean the class files, then compile the project again

Mockito mock objects returns null

I try to implement some tests for my JSF application and for the mocks I am using mockito. (I also use spring) The test succeeds, but when I want to retrieve the instance with the getInstance method. All Parameters which I have set before (via the constructor before) are null. I am new to mocked objects, so is this behavior

Exclude individual test from ‘before’ method in JUnit

All tests in my test class execute a ‘before’ method (annotated with JUnit’s @Before) before the execution of each test. I need a particular test not to execute this before method. Is there a way to do it? Answer Unfortunately you have to code this logic. JUnit does not have such feature. Generally you have 2 solutions: Just separate test

Advertisement