algunos problemas relacionados con las pruebas

  1. I am not able to perform the input from console.

            public static void abcde1() throws Exception
                 Run1 run123=new run1();
                 ApplicationContext context = new ClassPathXmlApplicationContext(
       ServiceClient serviceClient = (ServiceClien)context.getBean("customer");
                 run123.setup(serviceClient);//setup belongs to another class

    2.This function belongs to another Run1.(BufferRead is defined there only and it takes as the input.

        public void setup(ServiceClient serviceClient) throws Exception {
         System.out.println("enter some ");     
        System.out.println("Enter the UserName the user wants to login With");
    String userName = bufferRead.readLine();

In program i m calling this test by referring to the testng.xml


preguntado el 28 de agosto de 12 a las 13:08

Are you using the command-line? Are you using a DOS, bash or other shell? -

i m not able to get the output when i use the command line as well as the console present in the eclipse -

Why do you want to use console input in Unit tests in the first place? Unit tests are ment to be ran automatically as fast as possible. You may have hundrends of tests. -

I want to do so because i want to provide user the oppurtunity to tell me what he wants to do which i give in the form of a menu. -

This menu is actually a menu to perform various tests which i m doing by just calling those functions and not by testNG.For eg. if i want to create n no of tasks or something then the user will provide the value.The issue is not realted to @Test as i can use the main too to startup the program -

1 Respuestas

I tested the following using Eclipse Indigo:

    public void tests() throws Exception {    
        System.out.println("Please enter the text");
        BufferedReader reader = new BufferedReader(new InputStreamReader(;

and it works fine. Simply select the console when running the tests, type your input text and hit the return key.

Respondido 28 ago 12, 13:08

Yeah it works fine through Eclipse as i previously mentioned.The issue is when i run through pom.xml or through the command line it runs and asks for the first input and then does not go to the next statement. - user1629432

Its not working for me when i m running through maven(pom.xml).I guess Bufferreader is not working properly. - user1629432

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.