Search Results

Search found 2 results on 1 pages for 'puneetinderkaur'.

Page 1/1 | 1 

  • android:junit running Parameterized testcases.

    - by puneetinderkaur
    Hi, i wan to run a single testcase with different parameters. in java it possible through junit4 and code is like this package com.android.test; import static org.junit.Assert.assertEquals; import java.util.Arrays; import java.util.Collection; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; @RunWith(Parameterized.class) public class ParameterizedTestExample { private int number; private int number2; private int result; private functioncall coun; //constructor takes parameters from array public ParameterizedTestExample(int number, int number2, int result1) { this.number = number; this.number2 = number2; this.result = result1; coun = new functioncall(); } //array with parameters @Parameters public static Collection<Object[]> data() { Object[][] data = new Object[][] { { 1, 4, 5 }, { 2, 7, 9 }, { 3, 7, 10 }, { 4, 9, 13 } }; return Arrays.asList(data); } //running our test @Test public void testCounter() { assertEquals("Result add x y", result, coun.calculateSum(this.number, this.number2), 0); } } Now my question is can we Run the same with android testcases where we have deal with context. when i try to run the code using android junit. it gives me error NoClassDefinationFound.

    Read the article

1