Selenium Forum: Functional And Regression Testing Tool.
Would you like to react to this message? Create an account in a few clicks or log in to continue.
Search
Display results as :
Advanced Search
Latest topics
AEM Training | Free Online DemoWed Apr 21, 2021 5:45 pmazharuddin
c# PageFactory - issue initializing elementsFri Nov 01, 2019 8:40 pmthegoatboy
Selenium making automatic connection to random urlsMon Jul 08, 2019 12:58 pmrepairtechsolutions1
How can we design the custom framework in Selenium RCMon Jun 24, 2019 2:26 pmrandybonnettes
What are the new features in Selenium 3.0Tue Jun 18, 2019 5:37 pmpappyvicky
What are you using Selenium for? Fri Apr 12, 2019 3:52 amzhl
LIMITATIONS OF SELENIUMWed Apr 10, 2019 11:23 amswara
Navigation
 Portal
 Index
 Memberlist
 Profile
 FAQ
 Search

Go down
kevsbox
kevsbox
Posts : 4
Join date : 2015-04-22
Age : 53
Location : Here

Run java code after tests Empty Run java code after tests

Thu Apr 23, 2015 7:16 pm
Hi

I want to run some code after all of my tests have completed and after the html output has been generated, so after the lines shown below from my build.xml

Code:
<target description="Create HTML report" name="junitreport" >
        <junitreport todir="${junit.output.dir}">
            <fileset dir="${junit.output.dir}">
                <include name="TEST-*.xml"/>
            </fileset>
            <report format="frames" todir="${junit.output.dir}"/>
        </junitreport>
    </target>

So code in question is design to tidy up the html a little. See below

Code:
   public void tidyHTML(String folderName)
    {
     String content="";
        File dir = new File(folderName);
 File[] directoryListing = dir.listFiles();
 if (directoryListing != null) {
    for (File child : directoryListing) {
    
 try {
 content = IOUtils.toString(new FileInputStream(child), "utf-8");
 } catch (IOException e) {
 e.printStackTrace();
 }
     content = content.replaceAll("& lt;","<");
     content = content.replaceAll("& gt",">");
     try
     {
 IOUtils.write(content, new FileOutputStream(child), "utf-8");
 } catch (IOException e)
     {
 e.printStackTrace();
 }
    }
 } else {
  }
        
    }

So can anyone show me an example on how to call this in the build.xml file please.

Thanks in advance
kevsbox
kevsbox
Posts : 4
Join date : 2015-04-22
Age : 53
Location : Here

Run java code after tests Empty Re: Run java code after tests

Thu Apr 23, 2015 9:51 pm
Sorted Very Happy
Back to top
Permissions in this forum:
You cannot reply to topics in this forum