Passer au contenu principal
Administrator Guide
Dernière mise à jour : 2023-06-23
Référence : annotations du test AUnit

Référence : annotations du test AUnit

Annotation
Description
Exemple
@AssemblyTest
Désigne un test comme étant un test Unitét et l’associe à un ensemble.
@AssemblyTest(project = "AUnitTrainer", displayLabel = "Citizens of the Cloud")
@UnitTest
Désigne un cas de test individuel.
@UnitTest(startComponent = "Simple-Mediation") public void testSimpleMediation() throws Exception { setMessagePart(0, "test/simple-input.xml", "text/xml"); }
@AssertBefore
Exécute les assertions avant d’exécuter une composante d’ensemble nommée ou une étape.
@AssertBefore(id="Store-Output") public void verifySummaryDoc() throws Exception { assertEquals("10", evaluateExpression("parts[0].xpath('count(/summary/wd:WorkerSummary)')")); }
@AssertAfter
Exécute les assertions après l’exécution d’une composante d’ensemble nommée ou d’une étape.
@AssertAfter(id = "Simple-Mediation", step="transform") public void verifySimpleMediation() throws Exception { assertTrue(compare(getTestResourceInputStream("test/simple-expected.xml"), "text/xml", (InputStream) getMediationContext().getMessage().getMessagePart(0, InputStream.class), "text/xml", Comparator.dom)); } @AssertAfter(id="Process", step="transform") public void verifySummary() throws Exception { assertEquals("Ace Developer", evaluateExpression("parts[0].xpath('/wd:WorkerSummary/wd:Name')")); assertEquals("2010-07-27-07:00", evaluateExpression("parts[0].xpath('/wd:WorkerSummary/wd:HireDate')")); }
@AssertAfterCompletion
Exécute les assertions une fois l’ensemble terminé.
@AssertAfterCompletion public void verifyErrorHandling() throws Exception { assertEquals(3, evaluateExpression("props['error.count']")); }
@AtComponent
Définit l'emplacement où le test réceptionne l'ensemble pour effectuer la vérification et définit le comportement du test pour la composante nommée.
@AtComponent(id="Get-Workers") public Action handleGetWorkersInvocation() throws Exception { setMessagePart(0, "test/fromworkdayin/workdayin_workers_response.xml", "text/xml"); return new StandardAction(Action.Type.mock); }