0

I was trying to automate an Eclipse-based standalone application. I recorded a script using Silk4J and I am also able to run the script separately.

Under the same package I have created one more .java file which invokes the script. But I am not able to run the .java file as "Silk4j Test". The option is not available.

What changes should I make in order to run the .java file which will eventually run the script?

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
  • Do you have a code sample? "But I am not able to run the .java file" isn't very specific. – Tripp Kinetics Mar 02 '15 at 18:18
  • Thanks for replying. I have recorded a script using Silk4J and the script is saved as '.java' file. When I right click on the file to run it, I see two options - 'Run As -> JUnit Test' and 'Run As -> Silk4J Test' and running it as 'Silk4J Test' runs the script and shows the result in 'Silk True Error log explorer'. Now, I have created one more java file which simply calls the previous script. When I right click on the file to run it, I see only one option - 'Run As -> Java Application' which works fine but doesn't show the results in 'error log explorer'. Hope, it clarifies. – Sushant Dasgupta Mar 04 '15 at 16:46
  • 1
    Did you use "@Test" before the declaration of the method which is calling the recorded script? Without that, eclipse won't know that this new .java file is a test. – Johnbo Mar 05 '15 at 00:11

1 Answers1

1

A Silk4J test is actually a JUnit test. Until today I could not find a real difference running a test as Silk4J test or as JUnit test.

If the option "Run as Silk4J test" and "Run as JUnit test" are not available, the most likely reason is that your method is not marked as a JUnit test.

You need the @Test annotation:

import org.junit.Test;
[...]
@Test
public void test()
{
    protected Desktop desktop = new Desktop();
    BaseState baseState = new BaseState();
    baseState.execute(desktop);
    [...]
}
Thomas Weller
  • 55,411
  • 20
  • 125
  • 222