Permalink
Browse files

use TestNG

  • Loading branch information...
1 parent 729113c commit 5175833af3cbab4a1eae7a75887725f08fa8e3b0 @taweili committed Feb 6, 2014
Showing with 41 additions and 42 deletions.
  1. +7 −7 pom.xml
  2. +34 −35 src/test/java/com/ardublock/MainTest.java
View
14 pom.xml
@@ -109,12 +109,12 @@
<version>1.3.2</version>
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.10</version>
- <scope>test</scope>
- </dependency>
-</dependencies>
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>6.3.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
<url>http://ardublock.com/</url>
</project>
@@ -7,7 +7,6 @@
import javax.xml.parsers.ParserConfigurationException;
-import org.junit.Ignore;
import org.xml.sax.SAXException;
import com.ardublock.core.Context;
@@ -19,56 +18,56 @@
import edu.mit.blocks.renderable.RenderableBlock;
import edu.mit.blocks.workspace.Workspace;
-@Ignore
+import org.testng.annotations.*;
+
public class MainTest
{
private Main main;
private Translator translator;
private Context context;
- public static void main(String args[]) throws SAXException, IOException, ParserConfigurationException, SubroutineNameDuplicatedException, SocketNullException, SubroutineNotDeclaredException
- {
- MainTest test = new MainTest();
- test.setupTest();
- test.testFiles();
- //test.teardown();
- }
-
private void teardown() {
main.shutdown();
}
- public void setupTest() throws SAXException, IOException, ParserConfigurationException
+ @BeforeClass
+ public void setUp() throws SAXException, IOException, ParserConfigurationException
{
+ System.out.println("### setUp()");
main = new Main();
- main.startArdublock();
- context = Context.getContext();
- Workspace workspace = context.getWorkspaceController().getWorkspace();
- translator = new Translator(workspace);
-
+ // main.startArdublock();
+ // context = Context.getContext();
+ // Workspace workspace = context.getWorkspaceController().getWorkspace();
+ // translator = new Translator(workspace);
}
+ @Test
public void testFiles() throws SAXException, IOException, ParserConfigurationException, SubroutineNameDuplicatedException, SocketNullException, SubroutineNotDeclaredException
{
-
- String savedFiles[] = {
- "src/test/resources/examples/factorial.abp",
- "src/test/resources/examples/single-loop.abp",
- };
-
-
-
- for (String savedFile : savedFiles)
- {
- translator.reset();
- File file = new File(savedFile);
- context.loadArduBlockFile(file);
- Set<RenderableBlock> loopBlockSet = translator.findEntryBlocks();
- Set<RenderableBlock> subroutineBlockSet = translator.findSubroutineBlocks();
-
- String code = translator.translate(loopBlockSet, subroutineBlockSet);
- System.out.println(code);
- }
+ System.out.println("### testFiles");
+ // String savedFiles[] = {
+ // "src/test/resources/examples/factorial.abp",
+ // "src/test/resources/examples/single-loop.abp",
+ // };
+ //
+ //
+ //
+ // for (String savedFile : savedFiles)
+ // {
+ // translator.reset();
+ // File file = new File(savedFile);
+ // context.loadArduBlockFile(file);
+ // Set<RenderableBlock> loopBlockSet = translator.findEntryBlocks();
+ // Set<RenderableBlock> subroutineBlockSet = translator.findSubroutineBlocks();
+ //
+ // String code = translator.translate(loopBlockSet, subroutineBlockSet);
+ // System.out.println(code);
+ // }
+ }
+
+ @Test
+ public void testSingleLoop() {
+ System.out.println("### testSingleLoop");
}
}

0 comments on commit 5175833

Please sign in to comment.