junit-runner

How to open navigation drawer menu in Robotium automation script in android

匆匆过客 提交于 2019-12-11 11:28:28
问题 I have a application with navigation drawer i want to open the drawer menu in Robotium automation script.my application minimum Api level is 11 so i am using action bar sherlock for action bar implementation. Please guide me in right way 回答1: none of the methods mentioned in documentation seem to work. Best option is to swipe rightwards private void swipeToRight() { Display display = solo.getCurrentActivity().getWindowManager().getDefaultDisplay(); int width = display.getWidth(); int height =

What is the logic of @Rule(JUnit) declaration and assignment in a Groovy class

穿精又带淫゛_ 提交于 2019-12-11 06:32:36
问题 Trying some variants of rules creation in a groovy file, I have come to the thought, that @Rule doesn't describe DECLARATION, but ASSIGNMENT. So, the runner, when loading the test, tries every rule for the correct assignment. //Correct variants: @Rule public ErrorCollector collector1= new ErrorCollector(); public ErrorCollector collector2= null; @Rule collector2= new ErrorCollector(); public ErrorCollector collector3; @Rule collector3= new ErrorCollector(); // incorrect variants: @Rule public

How can I run kotlintest tests with gradle?

爱⌒轻易说出口 提交于 2019-12-07 02:01:12
问题 The kotlintest tests run perfectly fine when started from Intellij, but when I try to run them with the gradle test task command, only my regular JUnit tests are found and run. The kotlintest code: import io.kotlintest.matchers.shouldBe import io.kotlintest.specs.StringSpec class HelloKotlinTest : StringSpec() { init { println("Start Kotlin UnitTest") "length should return size of string" { "hello".length shouldBe 5 } } } build.gradle: apply plugin: 'org.junit.platform.gradle.plugin'

Parameterized jUnit test without changing runner

不羁岁月 提交于 2019-12-07 01:26:12
问题 Is there a clean way to run parameterized jUnit 4 tests without changing the runner, i.e. without using @RunWith(Parameterized.class) ? I have unit tests which require a special runner already and I can't replace this one with Parameterized . Maybe there is some kind of "runner chaining" so I could both runners at the same time? (Just a wild guess...) 回答1: org.junit.runners.Parameterized is created by org.junit.internal.builders.AnnotatedBuilder by reflect mechanism. Maybe you could extend

Globally setting a JUnit runner instead of @RunWith

僤鯓⒐⒋嵵緔 提交于 2019-12-07 00:13:20
问题 Without looking into JUnit source itself (my next step) is there an easy way to set the default Runner to be used with every test without having to set @RunWith on every test? We've got a huge pile of unit tests, and I want to be able to add some support across the board without having to change every file. Ideally I'm hope for something like: -Djunit.runner="com.example.foo". 回答1: I don't think this is possible to define globally, but if writing you own main function is an option, you can do

How can I run kotlintest tests with gradle?

感情迁移 提交于 2019-12-05 06:34:24
The kotlintest tests run perfectly fine when started from Intellij, but when I try to run them with the gradle test task command, only my regular JUnit tests are found and run. The kotlintest code: import io.kotlintest.matchers.shouldBe import io.kotlintest.specs.StringSpec class HelloKotlinTest : StringSpec() { init { println("Start Kotlin UnitTest") "length should return size of string" { "hello".length shouldBe 5 } } } build.gradle: apply plugin: 'org.junit.platform.gradle.plugin' buildscript { ext.kotlinVersion = '1.1.3' ext.junitPlatformVersion = '1.0.0-M4' repositories { maven { url

Is it possible to mock a static method on a final class using a PowerMockRule instead of the PowerMockRunner?

女生的网名这么多〃 提交于 2019-12-04 20:59:33
问题 According to the PowerMock docs, I should be able to run using a PowerMockRule instead of @RunWith(PowerMockRunner.class) and get the same results. I seem to have found a case where this isn't true. The below sample runs fine: package com.test.powermockstatics; import static org.junit.Assert.assertEquals; import static org.powermock.api.mockito.PowerMockito.mockStatic; import static org.powermock.api.mockito.PowerMockito.when; import org.junit.Test; import org.junit.runner.RunWith; import org

how to generate html report if my Junit is not run by Ant but by JunitCore.run

扶醉桌前 提交于 2019-12-03 22:33:17
I worked on a project in which testclasses are run via JunitCore.run(testClasses) not via Ant because I have to run the project even with no ANT framework (so no Testng for the same reason). But I still need to create html and xml reports same as JUNIT/ANT. How to generate them in my case? Right now I found https://github.com/barrypitman/JUnitXmlFormatter/blob/master/src/main/java/barrypitman/junitXmlFormatter/AntXmlRunListener.java may be used to generate xml report. How do I generate html similar to junit-noframes.html? Are there existing methods to convert the TESTS-TestSuites.xml to junit

Multiple JUnit XML results on Jenkins, publish with separate graph?

亡梦爱人 提交于 2019-12-01 20:26:25
问题 I have multiple tests running as a part of Android Jenkins build including Unit test and Functional tests. I am able to publish the test results on Jenkins successfully but I want to see seperate result graph for Unit tests and Functional Test. Jenkins JUnit publisher only shows one graph for multiple XML files. Any help? 来源: https://stackoverflow.com/questions/36725740/multiple-junit-xml-results-on-jenkins-publish-with-separate-graph

Multiple JUnit XML results on Jenkins, publish with separate graph?

倖福魔咒の 提交于 2019-12-01 18:44:20
I have multiple tests running as a part of Android Jenkins build including Unit test and Functional tests. I am able to publish the test results on Jenkins successfully but I want to see seperate result graph for Unit tests and Functional Test. Jenkins JUnit publisher only shows one graph for multiple XML files. Any help? 来源: https://stackoverflow.com/questions/36725740/multiple-junit-xml-results-on-jenkins-publish-with-separate-graph